predict.factors function

Make predictions from a "factors" object

Make predictions from a "factors" object

This function makes predictions from a "factors" object.

## S3 method for class 'factors' predict( object, newdata = NULL, n.ahead = 10, control_ARIMA = list(), control_VAR = list(), ... )

Arguments

  • object: An object of class "factors" constructed by Factors.
  • newdata: Optional. A new data matrix to predict from.
  • n.ahead: An integer specifying the number of steps ahead for prediction.
  • control_ARIMA: A list of arguments passed to the function auto.arima() of forecast. See 'Details' and the manual of auto.arima(). The default is list(ic = "aic").
  • control_VAR: A list of arguments passed to the function VAR() of vars. See 'Details' and the manual of VAR(). The default is list(type = "const", lag.max = 6, ic = "AIC").
  • ...: Currently not used.

Returns

  • ts_pred: A matrix of predicted values.

Details

Forecasting for yt{\bf y}_t can be implemented in two steps:

Step 1. Get the hh-step ahead forecast of the r^×1\hat{r} \times 1

time series x^t\hat{\bf x}_t [See Factors], denoted by x^n+h\hat{\bf x}_{n+h}, using a VAR model (if r^>1\hat{r} > 1) or an ARIMA model (if r^=1\hat{r} = 1). The orders of VAR and ARIMA models are determined by AIC by default. Otherwise, they can also be specified by users through the arguments control_VAR

and control_ARIMA, respectively.

Step 2. The forecasted value for yt{\bf y}_t is obtained by y^n+h=A^x^n+h\hat{\bf y}_{n+h}= \hat{\bf A}\hat{\bf x}_{n+h}.

Examples

library(HDTSA) data(FamaFrench, package = "HDTSA") ## Remove the market effects reg <- lm(as.matrix(FamaFrench[, -c(1:2)]) ~ as.matrix(FamaFrench$MKT.RF)) Y_2d = reg$residuals res_factors <- Factors(Y_2d, lag.k = 5) pred_fac_Y <- predict(res_factors, n.ahead = 1)

See Also

Factors

  • Maintainer: Chen Lin
  • License: GPL-3
  • Last published: 2025-01-28