# auto.arima {forecast}

### Description

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.

### Usage

auto.arima(x, d=NA, D=NA, max.p=5, max.q=5, max.P=2, max.Q=2, max.order=5, max.d=2, max.D=1, start.p=2, start.q=2, start.P=1, start.Q=1, stationary=FALSE, seasonal=TRUE, ic=c("aicc", "aic", "bic"), stepwise=TRUE, trace=FALSE, approximation=(length(x)>100 | frequency(x)>12), xreg=NULL, test=c("kpss","adf","pp"), seasonal.test=c("ocsb","ch"), allowdrift=TRUE, allowmean=TRUE, lambda=NULL, biasadj=FALSE, parallel=FALSE, num.cores=2)

### Arguments

- x
- a univariate time series
- d
- Order of first-differencing. If missing, will choose a value based on KPSS test.
- D
- Order of seasonal-differencing. If missing, will choose a value based on OCSB test.
- max.p
- Maximum value of p
- max.q
- Maximum value of q
- max.P
- Maximum value of P
- max.Q
- Maximum value of Q
- max.order
- Maximum value of p+q+P+Q if model selection is not stepwise.
- max.d
- Maximum number of non-seasonal differences
- max.D
- Maximum number of seasonal differences
- start.p
- Starting value of p in stepwise procedure.
- start.q
- Starting value of q in stepwise procedure.
- start.P
- Starting value of P in stepwise procedure.
- start.Q
- Starting value of Q in stepwise procedure.
- stationary
- If
`TRUE`

, restricts search to stationary models. - seasonal
- If
`FALSE`

, restricts search to non-seasonal models. - ic
- Information criterion to be used in model selection.
- stepwise
- If
`TRUE`

, will do stepwise selection (faster). Otherwise, it searches over all models. Non-stepwise selection can be very slow, especially for seasonal models. - trace
- If
`TRUE`

, the list of ARIMA models considered will be reported. - approximation
- If
`TRUE`

, estimation is via conditional sums of squares andthe information criteria used for model selection are approximated. The final model is still computed using maximum likelihood estimation. Approximation should be used for long time series or a high seasonal period to avoid excessive computation times. - xreg
- Optionally, a vector or matrix of external regressors, which must have the same number of rows as x.
- test
- Type of unit root test to use. See
`ndiffs`

for details. - seasonal.test
- This determines which seasonal unit root test is used. See
`nsdiffs`

for details. - allowdrift
- If
`TRUE`

, models with drift terms are considered. - allowmean
- If
`TRUE`

, models with a non-zero mean are considered. - lambda
- Box-Cox transformation parameter. Ignored if NULL. Otherwise, data transformed before model is estimated.
- biasadj
- Use adjusted back-transformed mean for Box-Cox transformations. If TRUE, point forecasts and fitted values are mean forecast. Otherwise, these points can be considered the median of the forecast densities.
- parallel
- If
`TRUE`

and`stepwise = FALSE`

, then the specification search is done in parallel. This can give a significant speedup on mutlicore machines. - num.cores
- Allows the user to specify the amount of parallel processes to be used if
`parallel = TRUE`

and`stepwise = FALSE`

. If`NULL`

, then the number of logical cores is automatically detected and all available cores are used.

### Details

Non-stepwise selection can be slow, especially for seasonal data. Stepwise algorithm outlined in Hyndman and Khandakar (2008) except that the default method for selecting seasonal differences is now the OCSB test rather than the Canova-Hansen test.

### Values

Same as for `arima`

### References

Hyndman, R.J. and Khandakar, Y. (2008) "Automatic time series forecasting: The forecast package for R", *Journal of Statistical Software*, **26**(3).

### See Also

`Arima`

Documentation reproduced from package forecast, version 7.1. License: GPL (>= 2)