Learn R Programming

tseriesTARMA (version 0.5-1)

predict.TARMA: Forecast from fitted TARMA models.

Description

Forecasting with TARMA models

Usage

# S3 method for TARMA
predict(
  object,
  x,
  n.ahead = 0,
  n.sim = 1000,
  quant = c(0.05, 0.95),
  pred.matrix = FALSE,
  ...
)

Value

A list with components pred.matrix, pred, and pred.interval. The latter two are ts objects that contain the prediction and the quantiles of the prediction density, respectively. If pred.matrix = TRUE then the prediction density from which the quantiles are computed is also returned.

Arguments

object

A TARMA fit upon x.

x

The fitted time series.

n.ahead

The number of steps ahead for which prediction is required.

n.sim

The number of Monte Carlo replications used to simulate the prediction density.

quant

Vector of quantiles (in the interval [0, 1]) to be computed upon the prediction density.

pred.matrix

Logical. if TRUE prints also the whole simulated prediction density for each prediction horizon from 1 to n.ahead.

...

Additional arguments.

Author

Simone Giannerini, simone.giannerini@uniud.it

Greta Goracci, greta.goracci@unibz.it

Details

If n.ahead = 0 it gives the fitted values from the model. If the fit is from TARMA.fit2 and includes covariates, these are ignored.

References

  • Gia21tseriesTARMA

See Also

TARMA.fit and TARMA.fit2 for TARMA modelling. plot.tsfit for plotting TARMA fits and forecasts.

Examples

Run this code
## a TARMA(1,1,1,1) model
set.seed(13)
x1   <- TARMA.sim(n=200, phi1=c(0.5,-0.5), phi2=c(0.0,0.5), theta1=-0.5, theta2=0.7, d=1, thd=0.2)
fit1 <- TARMA.fit(x1, method='L-BFGS-B',tar1.lags = 1, tar2.lags = 1, tma1.lags = 1, 
        tma2.lags = 1, d=1, threshold=0.2)
xp1  <- predict(fit1,x1,n.ahead=2)
xp1

Run the code above in your browser using DataLab