sarima.for {astsa}R Documentation

ARIMA Forecasting

Description

ARIMA forecasting.

Usage

sarima.for(xdata,n.ahead,p,d,q,P=0,D=0,Q=0,S=-1,tol=sqrt(.Machine$double.eps),
         no.constant=FALSE, plot=TRUE, plot.all=FALSE,
         xreg = NULL, newxreg = NULL, fixed=NULL, ...)

Arguments

xdata

univariate time series

n.ahead

forecast horizon (number of periods)

p

AR order

d

difference order

q

MA order

P

SAR order; use only for seasonal models

D

seasonal difference; use only for seasonal models

Q

SMA order; use only for seasonal models

S

seasonal period; use only for seasonal models

tol

controls the relative tolerance (reltol) used to assess convergence. The default is sqrt(.Machine$double.eps), the R default.

no.constant

controls whether or not a constant is included in the model. If no.constant=TRUE, no constant is included in the model. See sarima for more details.

plot

if TRUE (default) the data (or some of it) and the forecasts and bounds are plotted

plot.all

if TRUE, all the data are plotted in the graphic; otherwise, only the last 100 observations are plotted in the graphic.

xreg

Optionally, a vector or matrix of external regressors, which must have the same number of rows as the series. If this is used, newxreg MUST be specified.

newxreg

New values of xreg to be used for prediction. Must have at least n.ahead rows.

fixed

optional numeric vector of the same length as the total number of parameters. If supplied, only parameters corresponding to NA entries will be estimated.

...

additional graphical arguments

Details

For example, sarima.for(x,5,1,0,1) will forecast five time points ahead for an ARMA(1,1) fit to x. The output prints the forecasts and the standard errors of the forecasts, and supplies a graphic of the forecast with +/- 1 and 2 prediction error bounds.

Value

pred

the forecasts

se

the prediction (standard) errors

References

You can find demonstrations of astsa capabilities at FUN WITH ASTSA.

The most recent version of the package can be found at https://github.com/nickpoison/astsa/.

In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.

The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.stat.pitt.edu/stoffer/tsda/.

See Also

sarima

Examples

sarima.for(log(AirPassengers),12,0,1,1,0,1,1,12) 

# fun with the graphic 
sarima.for(log(AirPassengers),12,0,1,1,0,1,1,12, gg=TRUE, col=4, main='arf') 

#  with regressors:
nummy   = length(soi)
n.ahead = 24 
nureg   = time(soi)[nummy] + seq(1,n.ahead)/12
sarima.for(soi,n.ahead,2,0,0,2,0,0,12, xreg=time(soi), newxreg=nureg) 

[Package astsa version 1.14 Index]