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(y, 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) > 150 | frequency(x) > 12),
truncate = NULL, 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,
x = y, ...)
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 OCSB 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.
Maximum number of non-seasonal differences
Maximum number of seasonal differences
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.
If TRUE
, restricts search to stationary models.
If FALSE
, restricts search to non-seasonal models.
Information criterion to be used in model selection.
If TRUE
, will do stepwise selection (faster).
Otherwise, it searches over all models. Non-stepwise selection can be very
slow, especially for seasonal models.
If TRUE
, the list of ARIMA models considered will be
reported.
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.
An integer value indicating how many observations to use in
model selection. The last truncate
values of the series are used to
select a model when truncate
is not NULL
and
approximation=TRUE
. All observations are used if either
truncate=NULL
or approximation=FALSE
.
Optionally, a vector or matrix of external regressors, which
must have the same number of rows as y
.
Type of unit root test to use. See ndiffs
for
details.
This determines which seasonal unit root test is used.
See nsdiffs
for details.
If TRUE
, models with drift terms are considered.
If TRUE
, models with a non-zero mean are considered.
Box-Cox transformation parameter. Ignored if NULL. Otherwise, data transformed before model is estimated.
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.
If TRUE
and stepwise = FALSE
, then the
specification search is done in parallel. This can give a significant
speedup on mutlicore machines.
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.
Deprecated. Included for backwards compatibility.
Additional arguments to be passed to arima
.
Same as for Arima
The default arguments are designed for rapid estimation of models for many time series.
If you are analysing just one time series, and can afford to take some more time, it
is recommended that you set stepwise=FALSE
and approximation=FALSE
.
The number of seasonal differences is sometimes poorly chosen. If your data shows strong
seasonality, try setting D=1
rather than relying on the automatic selection of D
.
Non-stepwise selection can be slow, especially for seasonal data. The stepwise algorithm outlined in Hyndman and Khandakar (2008) is used except that the default method for selecting seasonal differences is now the OCSB test rather than the Canova-Hansen test. There are also some other minor variations to the algorithm described in Hyndman and Khandakar (2008).
Hyndman, R.J. and Khandakar, Y. (2008) "Automatic time series forecasting: The forecast package for R", Journal of Statistical Software, 26(3).
# NOT RUN {
fit <- auto.arima(WWWusage)
plot(forecast(fit,h=20))
# }
Run the code above in your browser using DataLab