Fit best ARIMA model to univariate time series
Returns best ARIMA model according to either AIC, AICc or BIC value. The function conducts a search over possible model within the order constraints provided.
auto.arima(x, d = NA, D = NA, max.p = 5, max.q = 5, max.P = 2, max.Q = 2, max.order = 5, start.p=2, start.q=2, start.P=1, start.Q=1, stationary = FALSE, ic = c("aic","aicc", "bic"), stepwise=TRUE, trace=FALSE, approximation=length(x)>100 | frequency(x)>12, xreg=NULL, test=c("kpss","adf","pp"), allowdrift=TRUE)
- a univariate time series
- Order of first-differencing. If missing, will choose a value based on KPSS test.
- Order of seasonal-differencing. If missing, will choose a value based on CH test.
- Maximum value of p
- Maximum value of q
- Maximum value of P
- Maximum value of Q
- Maximum value of p+q+P+Q if model selection is not stepwise.
- Starting value of p in stepwise procedure.
- Starting value of q in stepwise procedure.
- Starting value of P in stepwise procedure.
- Starting value of Q in stepwise procedure.
TRUE, restricts search to stationary models.
- Information criterion to be used in model selection.
TRUE, will do stepwise selection (faster). Otherwise, it searches over all models. Non-stepwise selection can be very slow, especially for seasonal models.
TRUE, the list of ARIMA models considered will be reported.
TRUE, estimation is via conditional sums of squares and the information criteria used for model selection are approximated. The final model is still computed using maximum likelihood estimation. Approximation should be used
- Optionally, a vector or matrix of external regressors, which must have the same number of rows as x.
- Type of unit root test to use. See
TRUE, models with drift terms are considered.
Non-stepwise selection can be slow, especially for seasonal data. Non-seasonal differences chosen using the KPSS test. Seasonal differences chosen using a variation on the Canova-Hansen test. Stepwise algorithm outlined in Hyndman and Khandakar (2008).
- Same as for
Hyndman, R.J. and Khandakar, Y. (2008) "Automatic time series forecasting: The forecast package for R", Journal of Statistical Software, 26(3).
fit <- auto.arima(WWWusage) plot(forecast(fit,h=20))