predict.tenAR: Predict funcions for Tensor Autoregressive Models

View source: R/tenAR.R

predict.tenARR Documentation

Predict funcions for Tensor Autoregressive Models

Description

S3 method for the 'tenAR' class using the generic predict function. Prediction based on the tensor autoregressive model or reduced rank MAR(1) model. If rolling = TRUE, returns the rolling forecasts.

Usage

## S3 method for class '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.

...

Additional arguments passed to the method.

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 <- predict(est, n.ahead = 1)
# rolling forcast
n0 = t - min(50,t/2)
pred.rolling <- 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 <- predict(est, n.ahead = 1)
# rolling forcast
n0 = t - min(50,t/2)
pred.rolling <- predict(est, n.ahead = 5, rolling=TRUE, n0=n0)

tensorTS documentation built on May 29, 2024, 10:23 a.m.