arima {arima2}  R Documentation 
ARIMA Modeling of Time Series
Description
Fit an ARIMA model to a univariate time series. This function builds on
the ARIMA model fitting approach used in stats::arima()
by fitting
model parameters via a random restart algorithm.
Usage
arima(
x,
order = c(0L, 0L, 0L),
seasonal = list(order = c(0L, 0L, 0L), period = NA),
xreg = NULL,
include.mean = TRUE,
transform.pars = TRUE,
fixed = NULL,
init = NULL,
method = c("CSSML", "ML", "CSS"),
n.cond,
SSinit = c("Rossignol2011", "Gardner1980"),
optim.method = "BFGS",
optim.control = list(),
kappa = 1e+06,
diffuseControl = TRUE,
max_iters = 100,
max_repeats = 10,
max_inv_root = 1,
min_inv_root_dist = 0,
eps_tol = 1e04
)
Arguments
x 
a univariate time series 
order 
A specification of the nonseasonal 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 vector or matrix of external regressors,
which must have the same number of rows as 
include.mean 
Should the ARMA model include a mean/intercept term? The
default is 
transform.pars 
logical; if true, the AR parameters are
transformed to ensure that they remain in the region of
stationarity. Not used for 
fixed 
optional numeric vector of the same length as the total number of coefficients to be estimated. It should be of the form
where The entries of the The argument 
init 
optional numeric vector of initial parameter
values. Missing values will be filled in, by zeroes except for
regression coefficients. Values already specified in 
method 
fitting method: maximum likelihood or minimize conditional sumofsquares. The default (unless there are missing values) is to use conditionalsumofsquares to find starting values, then maximum likelihood. Can be abbreviated. 
n.cond 
only used if fitting by conditionalsumofsquares: the number of initial observations to ignore. It will be ignored if less than the maximum lag of an AR term. 
SSinit 
a string specifying the algorithm to compute the
statespace initialization of the likelihood; see

optim.method 
The value passed as the 
optim.control 
List of control parameters for 
kappa 
the prior variance (as a multiple of the innovations variance) for the past observations in a differenced model. Do not reduce this. 
diffuseControl 
Boolean indicator of whether or initial observations will have likelihood values ignored if controlled by the diffuse prior, i.e., have a Kalman gain of at least 1e4. 
max_iters 
Maximum number of random restarts for methods "CSSML" and
"ML". If set to 1, the results of this algorithm is the same as

max_repeats 
Integer. If the last 
max_inv_root 
positive numeric value less than or equal to 1. This number represents the maximum size of the inverted MA or AR polynomial roots for a new parameter estimate to be considered an improvement to previous estimates. Concerns of numeric stability arise when the size of polynomial roots are near unity circle. The default value 1 means that the the parameter values corresponding with the best loglikelihood will be returned, even if they are near unity. Suitable values of this parameter are near the value 1. 
min_inv_root_dist 
positive numeric value less than 1. This number represents the minimum distance between AR and MA polynomial roots for a new parameter estimate to be considered an improvement on previous estimates. This is intended to avoid the possibility of returning parameter estimates with nearly canceling roots. Appropriate choices are values near 0. 
eps_tol 
Tolerance for accepting a new solution to be better than a previous solution in terms of loglikelihood. The default corresponds to a one tenthousandth unit increase in loglikelihood. 
Value
A list of class c("Arima2", "Arima")
. This list contains all of the
same elements as the output of stats::arima, along with some additional
elements. All elements of the output list are:
coef
A vector of AR, MA, and regression coefficients. These can be extracted by the stats::coef method.
sigma2
The MLE of the variance of the innovations.
var.coef
The estimated variance matrix of the coefficients
coef
, which can be extracted by the stats::vcov method.mask
A vector containing boolean values, indicating which parameters of the model were estimated.
loglik
The maximized loglikelihood (of the differenced data).
aic
The AIC value corresponding to the loglikelihood.
arma
A compact form of the model specification, as a vector giving the number of AR, MA, seasonal AR and seasonal MA coefficients, plus the period and the number of nonseasonal and seasonal differences.
residuals
The fitted innovations.
call
The matched call.
series
The name of the series x.
code
The convergence value returned by stats::optim.
n.cond
The number of initial observations not used in the fitting.
nobs
The number of observations used for the fitting.
model
A list representing the Kalman Filter used in the fitting.
x
The input time series.
num_starts
Number of restarts before convergence criteria was satisfied.
all_values
Numeric vector of length
num_starts
containing the loglikelihood of every parameter initialization.
Examples
# example code
set.seed(12345)
arima(miHuron_level$Average, order = c(2, 0, 1), max_iters = 100)