
arima
function in the stats package. The main difference is that this function
allows a drift term. It is also possible to
take an ARIMA model from a previous call to Arima
and re-apply it to the data x
.Arima(x, order=c(0,0,0), seasonal=c(0,0,0),
xreg=NULL, include.mean=TRUE, include.drift=FALSE,
include.constant, lambda=model$lambda, transform.pars=TRUE,
fixed=NULL, init=NULL, method=c("CSS-ML","ML","CSS"), n.cond,
optim.control=list(), kappa=1e6, model=NULL)
ts
.include.mean
is set to be TRUE for undifferenced series and include.drift
is set to be TRUE for differenced series. Note that if there is more than one difference taken, no constant is included regardless of the valArima
. If model is passed, this same model is fitted to
x
without re-estimating any parameters.arima
function in the stats package. The additional objects returned arearima
function in the stats package.arima
, forecast.Arima
.fit <- Arima(WWWusage,order=c(3,1,0))
plot(forecast(fit,h=20))
# Fit model to first few years of AirPassengers data
air.model <- Arima(window(AirPassengers,end=1956+11/12),order=c(0,1,1),
seasonal=list(order=c(0,1,1),period=12),lambda=0)
plot(forecast(air.model,h=48))
lines(AirPassengers)
# Apply fitted model to later data
air.model2 <- Arima(window(AirPassengers,start=1957),model=air.model)
# Forecast accuracy measures on the log scale.
# in-sample one-step forecasts.
accuracy(air.model)
# out-of-sample one-step forecasts.
accuracy(air.model2)
# out-of-sample multi-step forecasts
accuracy(forecast(air.model,h=48,lambda=NULL),
log(window(AirPassengers,start=1957)))
Run the code above in your browser using DataLab