tenAR.predict: Predictions for Tensor Autoregressive Models

View source: R/tenAR.R

tenAR.predictR Documentation

Predictions for Tensor Autoregressive Models

Description

Prediction based on the tensor autoregressive model or reduced rank MAR(1) model. If rolling = TRUE, returns the rolling forecasts.

Usage

tenAR.predict(object, n.ahead = 1, xx = NULL, rolling = FALSE, n0 = NULL)

Arguments

object

a model object returned by tenAR.est().

n.ahead

prediction horizon.

xx

T^{\prime} \times d_1 \times \cdots \times d_K new tensor time series to be used for prediction. Must have at least n.ahead length.

rolling

TRUE or FALSE, rolling forecast, is FALSE by default.

n0

only if rolling = TRUE, the starting point of rolling forecast.

Value

a tensor time series of length n.ahead if rolling = FALSE;

a tensor time series of length T^{\prime} - n_0 - n.ahead + 1 if rolling = TRUE.

See Also

'predict.ar' or 'predict.arima'

Examples

set.seed(333)
dim <- c(2,2,2)
t = 20
xx <- tenAR.sim(t, dim, R=2, P=1, rho=0.5, cov='iid')
est <- tenAR.est(xx, R=1, P=1, method="LSE")
pred <- tenAR.predict(est, n.ahead = 1, xx = xx)
# rolling forcast
n0 = t - min(50,t/2)
pred.rolling <- tenAR.predict(est, n.ahead = 5, xx = xx, rolling=TRUE, n0)

# prediction for reduced rank MAR(1) model
dim <- c(2,2)
t = 20
xx <- tenAR.sim(t, dim, R=1, P=1, rho=0.5, cov='iid')
est <- matAR.RR.est(xx, method="RRLSE", k1=1, k2=1)
pred <- tenAR.predict(est, n.ahead = 1)
# rolling forcast
n0 = t - min(50,t/2)
pred.rolling <- tenAR.predict(est, n.ahead = 5, rolling=TRUE, n0=n0)

tensorTS documentation built on May 8, 2022, 5:05 p.m.