Skip to contents

Truncates a forecast at the first horizon whose prediction-interval width exceeds max_width, giving an explicit mechanism to bound forecasts by a specified error margin.

Usage

morie_ts_trim_forecast(forecast, max_width)

Arguments

forecast

A morie_ts_forecast.

max_width

Maximum acceptable interval width (upper - lower).

Value

A morie_ts_forecast truncated to the acceptable horizon.

Examples

m <- morie_ts_arima(cumsum(rnorm(80)), order = c(1, 1, 0))
fc <- morie_ts_forecast(m, h = 30)
morie_ts_trim_forecast(fc, max_width = 5)$h
#> [1] 1