Rev 8147 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{arima0}\alias{arima0}\alias{arima0.diag}\alias{print.arima0}\alias{predict.arima0}\title{ARIMA Modelling of Time Series -- Preliminary Version}\usage{arima0(x, order = c(0, 0, 0),seasonal = list(order = c(0, 0, 0), period = NA),xreg = NULL, include.mean, na.action = na.fail,delta = 0.01, transform.pars = 2)predict(arima0.obj, n.ahead = 1, newxreg, se.fit = TRUE)arima0.diag(fit, gof.lag = 10)}\arguments{\item{x}{a univariate time series}\item{order}{A specification of the non-seasonal part of the ARIMAmodel: the three components are (p, d, q), the AR order, the degreeof differencing and the MA order.}\item{seasonal}{A specification of the seasonal part of the ARIMAmodel, plus the period (which defaults to \code{frequency(x)}).}\item{xreg}{Optionally, a vector or matrix of external regressors,which must have the same number of rows as \code{x}.}\item{include.mean}{Should the ARIMA model includea mean term? The default is \code{TRUE} for undifferenced series,\code{FALSE} for differenced ones (where a mean would not affectthe fit nor predictions).}\item{na.action}{Function to be applied to remove missing values.}\item{delta}{A value to indicate at which point `fast recursions'should be used. See the Details section.}\item{transform.pars}{If greater than 0, the ARMA parameters aretransformed to ensure that they remain in the region ofinvertibility. If equal to 2, the optimization is rerun onthe original scale to find the Hessian.}\item{arima0.obj, fit}{The result of an \code{arima0} fit.}\item{newxreg}{New values of \code{xreg} to be used forprediction. Must have at least \code{n.ahead} rows.}\item{n.ahead}{The number of steps ahead for which prediction is required.}\item{se.fit}{Logical: should standard errors of prediction be returned?}\item{gof.lag}{Number of lags to be used in goodness-of-fit test.}}\description{Fit an ARIMA model to a univariate time series by exact maximumlikelihood, and forecast from the fitted model.}\details{Different definitions of ARIMA models have different signs for theAR and/or MA coefficients. The definition here has\deqn{X_t = a_1X_{t-1} + \cdots + a_pX_{t-p} + e_t + b_1e_{t-1} + \dots + b_qe_{t-q}}{\code{X[t] = a[1]X[t-1] + \dots + a[p]X[t-p] + e[t] + b[1]e[t-1] + \dots + b[q]e[t-q]}}and so the MA coefficients differ in sign from those ofS-PLUS. Further, if \code{include.mean} is true, this formulaapplies to \eqn{X-m} rather than \eqn{X}.The exact likelihood is computed via a state-space representation ofthe ARMA process, and the innovations and their variance found by aKalman filter using the Fortran code of Gardener \emph{et al.}(1980). This has the option to switch to `fast recursions' (assumean effectively infinite past) if the innovations variance is closeenough to its asymptotic bound. The argument \code{delta} sets thetolerance: at its default value the approximation is normallynegligible and the speed-up considerable. Exact computations can beensured by setting \code{delta} to a negative value.The variance matrix of the estimates is found from the Hessian ofthe log-likelihood, and so may only be a rough guide, especially forfits close to the boundary of invertibility.Optimization is (currently) done by \code{\link{nlm}}. It will workbest if the columns in \code{xreg} are roughly scaled to zero meanand unit variance.Finite-history prediction is used. This is only statisticallyefficient if the MA part of the fit is invertible, so\code{predict.arima0} will give a warning for non-invertible MAmodels.}\value{For \code{arima0}, a list of class \code{"arima0"} with components:\item{coef}{a vector of AR, MA and regression coefficients,}\item{sigma2}{the MLE of the innovations variance.}\item{var.coef}{the estimated variance matrix of the coefficients\code{coef}. If \code{transform.pars = 1}, only the portioncorresponding to the untransformed parameters is returned.}\item{loglik}{the maximized log-likelihood (of the differenced data).}\item{arma}{A compact form of the specification, as a vector givingthe number of AR, MA, seasonal AR and seasonal MA coefficients,plus the period and the number of non-seasonal and seasonaldifferences.}\item{aic}{the AIC value corresponding to the log-likelihood.}\item{resid}{the residuals.}\item{call}{the matched call.}\item{series}{the name of the series \code{x}.}\item{convergence}{the value returned by \code{\link{optim}}.}For \code{predict.arima0}, a time series of predictions, or if\code{se.fit = TRUE}, a list with components \code{pred}, thepredictions, and \code{se}, the estimated standard errors. Bothcomponents are time series.}\references{Brockwell, P. J. and Davis, R. A. (1996) \emph{Introduction to TimeSeries and Forecasting.} Springer, New York. Sections 3.3 and 8.3.Gardener, G, Harvey, A. C. and Phillips, G. D. A. (1980) AlgorithmAS154. An algorithm for exact maximum likelihood estimation ofautoregressive-moving average models by means of Kalman filtering.\emph{Applied Statistics} \bold{29}, 311--322.Harvey, A. C. (1993) \emph{Time Series Models},2nd Edition, Harvester Wheatsheaf, section 4.4.Harvey, A. C. and McKenzie, C. R. (1982) Algorithm AS182.An algorithm for finite sample prediction from ARIMA processes.\emph{Applied Statistics} \bold{31}, 180--187.}\author{B.D. Ripley}\note{This is a preliminary version, and will be replaced in due course.The standard errors of prediction exclude the uncertainty in theestimation of the ARMA model and the regression coefficients.The results are likely to be different from S-PLUS's\code{arima.mle}, which computes a conditional likelihood and doesnot include a mean in the model. Further, the convention used by\code{arima.mle} reverses the signs of the MA coefficients.}\seealso{\code{\link{ar}}}\examples{data(lh)arima0(lh, order=c(1,0,0))arima0(lh, order=c(3,0,0))arima0(lh, order=c(1,0,1))predict(arima0(lh, order=c(3,0,0)), n.ahead=12)data(USAccDeaths)fit <- arima0(USAccDeaths, order=c(0,1,1), seasonal=list(order=c(0,1,1)))fitpredict(fit, n.ahead=6)data(LakeHuron)arima0(LakeHuron, order=c(2,0,0), xreg=1:98)}\keyword{ts}