| Arima | R Documentation |
Largely a wrapper for the stats::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 y.
Arima(
y,
order = c(0, 0, 0),
seasonal = c(0, 0, 0),
xreg = NULL,
include.mean = TRUE,
include.drift = FALSE,
include.constant = NULL,
lambda = model$lambda,
biasadj = attr(lambda, "biasadj"),
method = c("CSS-ML", "ML", "CSS"),
model = NULL,
x = y,
...
)
y |
a numeric vector or univariate time series of class |
order |
a specification of the non-seasonal part of the ARIMA
model: the three integer components |
seasonal |
a specification of the seasonal part of the ARIMA
model, plus the period (which defaults to |
xreg |
Optionally, a numerical vector or matrix of external regressors,
which must have the same number of rows as |
include.mean |
Should the ARIMA model include a mean term? The default
is |
include.drift |
Should the ARIMA model include a linear drift term?
(i.e., a linear regression with ARIMA errors is fitted.) The default is
|
include.constant |
If |
lambda |
Box-Cox transformation parameter. If |
biasadj |
Use adjusted back-transformed mean for Box-Cox
transformations. If transformed data is used to produce forecasts and fitted
values, a regular back transformation will result in median forecasts. If
biasadj is |
method |
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. Can be abbreviated. |
model |
Output from a previous call to |
x |
Deprecated. Included for backwards compatibility. |
... |
Additional arguments to be passed to |
The fitted model is a regression with ARIMA(p,d,q) errors
y_t = c + \beta' x_t + z_t
where x_t is a vector of regressors at time t and z_t is an
ARMA(p,d,q) error process. If there are no regressors, and d=0, then c
is an estimate of the mean of y_t. For more information, see Hyndman &
Athanasopoulos (2018). For details of the estimation algorithm, see the
stats::arima() function in the stats package.
See the stats::arima() function in the stats package.
The additional objects returned are:
x |
The time series data |
xreg |
The regressors used in fitting (when relevant). |
sigma2 |
The bias adjusted MLE of the innovations variance. |
Rob J Hyndman
Hyndman, R.J. and Athanasopoulos, G. (2018) "Forecasting: principles and practice", 2nd ed., OTexts, Melbourne, Australia. https://OTexts.com/fpp2/.
auto.arima(), forecast.Arima().
library(ggplot2)
WWWusage |>
Arima(order = c(3, 1, 0)) |>
forecast(h = 20) |>
autoplot()
# Fit model to first few years of AirPassengers data
air.model <- Arima(
window(AirPassengers, end = 1956 + 11 / 12),
order = c(0, 1, 1),
seasonal = list(order = c(0, 1, 1), period = 12),
lambda = 0
)
plot(forecast(air.model, h = 48))
lines(AirPassengers)
# Apply fitted model to later data
air.model2 <- Arima(window(AirPassengers, start = 1957), model = air.model)
# Forecast accuracy measures on the log scale.
# in-sample one-step forecasts.
accuracy(air.model)
# out-of-sample one-step forecasts.
accuracy(air.model2)
# out-of-sample multi-step forecasts
accuracy(
forecast(air.model, h = 48, lambda = NULL),
log(window(AirPassengers, start = 1957))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.