This function allows to call any function "of class forecast
" in a unified way.
genericforecast(FUN, y, h, level = 95, ...)
Arguments
- FUN
A forecasting function.
- y
A time series (ts
object or vector).
- h
Forecasting horizon.
- level
The confidence level.
- ...
Additional arguments to be passed to the forecasting function.
Value
An object of class forecast
.
Examples
y <- fdeaths
h <- 25L
plot(genericforecast(FUN=forecast::thetaf, y, h))
plot(genericforecast(FUN=ahead::dynrmf, y, h))
plot(genericforecast(FUN=forecast::tbats, y=y, h=h, use.box.cox = TRUE, use.trend=FALSE))