Fit ARIMA model to univariate time series
Largely a wrapper for the
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
Arima(x, order = c(0, 0, 0), seasonal = list(order = c(0, 0, 0), period = NA), xreg = NULL, include.mean = TRUE, include.drift = FALSE, transform.pars = TRUE, fixed = NULL, init = NULL, method = c("CSS-ML", "ML", "CSS"), n.cond, optim.control = list(), kappa = 1e6, model=NULL)
- a univariate time series
- A specification of the non-seasonal part of the ARIMA model: the three components (p, d, q) are the AR order, the degree of differencing, and the MA order.
- A specification of the seasonal part of the ARIMA model, plus the period (which defaults to frequency(x)). This should be a list with components order and period, but a specification of just a numeric vector of length 3 will be turned into a suitable list
- Optionally, a vector or matrix of external regressors, which must have the same number of rows as x.
- Should the ARIMA model include a mean term? The default is TRUE for undifferenced series, FALSE for differenced ones (where a mean would not affect the fit nor predictions).
- Should the ARIMA model include a linear drift term? (i.e., a linear regression with ARIMA errors is fitted.) The default is FALSE.
- Logical. If true, the AR parameters are transformed to ensure that they remain in the region of stationarity. Not used for method = "CSS".
- optional numeric vector of the same length as the total number of parameters. If supplied, only NA entries in fixed will be varied. transform.pars = TRUE will be overridden (with a warning) if any AR parameters are fixed. It may be wise to set transform.p
- optional numeric vector of initial parameter values. Missing values will be filled in, by zeroes except for regression coefficients. Values already specified in fixed will be ignored.
- Fitting method: maximum likelihood or minimize conditional sum-of-squares. The default (unless there are missing values) is to use conditional-sum-of-squares to find starting values, then maximum likelihood.
- Only used if fitting by conditional-sum-of-squares: the number of initial observations to ignore. It will be ignored if less than the maximum lag of an AR term.
- List of control parameters for optim.
- the prior variance (as a multiple of the innovations variance) for the past observations in a differenced model. Do not reduce this.
- Output from a previous call to
Arima. If model is passed, this same model is fitted to
xwithout re-estimating any parameters.
arima function in the stats package.
- See the
arimafunction in the stats package. The additional objects returned are
x The time series data xreg The regressors used in fitting (when relevant).
fit <- Arima(WWWusage,order=c(3,1,0)) plot(forecast(fit,h=20)) air.model <- Arima(AirPassengers[1:100],c(0,1,1)) air.model2 <- Arima(AirPassengers,model=air.model) outofsample <- ts(fitted(air.model2)[-c(1:100)],s=1957+4/12,f=12)