Produces forecasts from a functional time series model using various univariate time series forecasting methods applied to the coefficients.

Forecasts a functional time series model using various univariate time series methods.

# S3 method for class 'ftsm'
forecast(
  object,
  h = 10,
  method = c("ets", "arima", "ar", "ets.na", "rwdrift", "rw", "struct", "arfima",
    "ridge2f"),
  level = 95,
  jumpchoice = c("fit", "actual"),
  pimethod = c("parametric", "nonparametric"),
  B = 100,
  usedata = nrow(object$coeff),
  adjust = TRUE,
  model = NULL,
  damped = NULL,
  stationary = FALSE,
  FUN = NULL,
  FUN_method = c("block-bootstrap", "surrogate", "kde", "bootstrap", "fitdistr"),
  FUN_nsim = B,
  FUN_block_size = 5,
  FUN_seed = 123L,
  ...
)

# S3 method for class 'ftsm'
forecast(
  object,
  h = 10,
  method = c("ets", "arima", "ar", "ets.na", "rwdrift", "rw", "struct", "arfima",
    "ridge2f"),
  level = 95,
  jumpchoice = c("fit", "actual"),
  pimethod = c("parametric", "nonparametric"),
  B = 100,
  usedata = nrow(object$coeff),
  adjust = TRUE,
  model = NULL,
  damped = NULL,
  stationary = FALSE,
  FUN = NULL,
  FUN_method = c("block-bootstrap", "surrogate", "kde", "bootstrap", "fitdistr"),
  FUN_nsim = B,
  FUN_block_size = 5,
  FUN_seed = 123L,
  ...
)

Arguments

object

An object of class ftsm returned by ftsm().

h

Forecast horizon (number of periods to forecast).

method

Forecasting method: "ets" (default), "arima", "ar", "ets.na", "rwdrift", "rw", "struct", or "arfima".

level

Confidence level for prediction intervals (default: 80).

jumpchoice

Method for handling the jump-off point: "fit" (default) or "actual".

pimethod

Method for prediction intervals: "parametric" (default) or "nonparametric".

B

Number of bootstrap replications for nonparametric prediction intervals (default: 100).

usedata

Number of observations to use for fitting (default: all available).

adjust

Logical. If TRUE, adjust forecasts for bias (default: TRUE).

model

ETS model specification (optional).

damped

Logical. If TRUE, use damped trend (optional).

stationary

Logical. If TRUE, force stationarity (default: FALSE).

FUN

forecasting function (if provided, method is ignored)

FUN_method

Method to be used for conformalization (simulation of calibrated residuals) when FUN is not NULL.

FUN_nsim

Number of simulations when FUN is not NULL.

FUN_block_size

Block size for block-bootstrap when FUN is not NULL.

FUN_seed

Seed for reproducibility when FUN is not NULL.

...

Additional arguments passed to the forecasting method.

Value

An object of class ftsf containing:

mean

Point forecasts as a functional time series object

lower

Lower prediction bounds (parametric method)

upper

Upper prediction bounds (parametric method)

fitted

One-step fitted values

error

One-step forecast errors

coeff

Forecasts and prediction intervals for each coefficient

coeff.error

Errors in coefficient estimation

var

Variance components

model

The original ftsm object

bootsamp

Bootstrap samples (nonparametric method)

An object of class ftsf containing:

method

Forecasting method used

x

Time points

y

Original functional time series

fitted

Fitted values

residuals

Residuals

mean

Point forecasts

lower

Lower prediction intervals

upper

Upper prediction intervals

level

Confidence level

xname

Name of x variable

yname

Name of y variable

Details

This function forecasts a functional time series by applying univariate time series forecasting methods to the coefficients obtained from a functional principal component analysis. The forecasts are then transformed back to functional space.

For the method = "ets" option, the model parameter can be specified as:

  • A single character string: Applied to all coefficients except the first

  • A vector of length nb-1: Applied to coefficients 2 through nb

  • A vector of length nb: Applied to all coefficients

The first coefficient (mean function) always uses "ANN" model unless specified otherwise.

References

Hyndman, R.J., & Shang, H.L. (2009). Forecasting functional time series. Journal of the Korean Statistical Society, 38(3), 199-221.

See also

ftsm, plot.ftsf

ftsm, plot.ftsf

Examples

if (FALSE) { # \dontrun{
# Fit functional time series model
fmodel <- ftsm(y = fts(data))

# Forecast using ETS method
forecast_ets <- forecast(fmodel, h = 10, method = "ets")

# Forecast using ARIMA method
forecast_arima <- forecast(fmodel, h = 10, method = "arima")

# Forecast with custom function
custom_forecast <- forecast(fmodel, h = 10, FUN = forecast::thetaf)

# Plot forecasts
plot(forecast_ets)
} # }

if (FALSE) { # \dontrun{
# Fit functional time series model
fit <- ftsm(pm_10_GR, order = 3)
# Forecast 12 periods ahead
fc <- forecast(fit, h = 12, method = "ets")
# Plot forecasts
plot(fc)

fit <- ftsm(pm_10_GR, order = 3, mean=FALSE); fc <- forecast(fit, h = 12, method = "ridge2f")
# Forecast 12 periods ahead
# Plot forecasts
plot(fc)

} # }