best.arima {forecast} | R Documentation |
Returns best ARIMA model according to either AIC or BIC value. The function conducts a search over possible model within the order constraints provided.
best.arima(x, d = ndiffs(x), D = 0, max.p = 5, max.q = 5, max.P = 2, max.Q = 2, max.order = 5, stationary = FALSE, drift = TRUE, trend = FALSE, ic = c("aic", "bic"))
x |
a univariate time series |
d |
Order of first-differencing. Will choose something sensible based on KPSS test. |
D |
Order of seasonal-differencing. Default is 0. Must be manually set. |
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 |
stationary |
If TRUE, restricts search to stationary models. |
drift |
If TRUE, allows (but doesn't force) the inclusion of drift in models with d>0. |
trend |
If TRUE, allows (but doesn't force) the inclusion of a linear trend in models with d=0. |
ic |
Information criterion to be used in model selection. |
Can be slow, especially for seasonal data. Non-seasonal differences chosen using kpss.test
.
Seasonal differences must be chosen manually.
Same as for arima
Rob J Hyndman
fit <- best.arima(WWWusage) plot(forecast(fit,h=20))