Fit Autoregression Using the Yule-Walker Equations

DESCRIPTION:
Fits a model of the form x(t) = a(1)x(t-1) + ... + a(p)x(t-p) + e(t) using Whittle's recursion form of the Yule-Walker equations.

USAGE:
ar.yw(x, aic=T, order.max=<<see below>>)

REQUIRED ARGUMENTS:
x:
a univariate or multivariate time series, or a vector, or a matrix with columns representing univariate components of a multivariate time series. Missing values are allowed only at the beginning and end of series.

OPTIONAL ARGUMENTS:
aic:
logical flag: if TRUE, use the Akaike information criterion to choose the best order not greater than order.max. If FALSE, order.max will be the order of the model fitted.
order.max:
the maximum order of autoregression to fit to the time series. The default value is 10 * log10(n.used/ncol(x)).

VALUE:
a list with the following components:
order:
the order of the autoregression fitted. If aic=TRUE, then this is the order less than or equal to order.max which minimizes the AIC, otherwise, it is order.max.
ar:
the autoregressive coefficients. These are in an order by "nser" by "nser" array, where "nser" is the number of univariate components of x (1 or ncol(x)). If order is 0, ar will have dimensions 1 by "nser" by "nser" and will be filled with zeros. The first level of the first dimension corresponds to one observation back in time, the second level corresponds to two observations back, etc. The second dimension corresponds to the predicted series, and the third corresponds to the predicting series.
var.pred:
the estimated prediction variance ("nser" by "nser" matrix) of the process with AR coefficients ar.
aic:
vector of the values of Akaike's information criterion for orders 0 through order.max. These have the minimum value subtracted from all of them so the minimum is always zero.
n.used:
the length of the nonmissing part of the input time series.
order.max:
the input or default value of order.max.
partialacf:
vector of the partial autocorrelation coefficients. These are useful for choosing the proper order of autoregression.
resid:
a time series representing the estimate of e(t) for the model above. The estimates contained in ar are used in the forward direction on the series with mean(s) removed.
method:
the string "yule-walker".
series:
the name used for the input x. Transformations are included.

DETAILS:
Continuous strings of missing values are removed from the ends of the series. Any remaining missing values will cause an error.

First the autocovariance matrices of the time series are estimated and then Whittle's recursion (a multivariate extension of the Levinson-Durbin method) is used to estimate the autoregressive coefficients. The output may be used in spec.ar to estimate the spectrum of the process, or acf.plot to produce a plot of the partial autocorrelation function.

The estimation is performed using the sample mean of each univariate series as the estimate of the mean. Remember that the coefficients in ar are for the series with the mean(s) removed.


REFERENCES:
Whittle, P. (1983). Prediction and Regulation by Linear Least-Squares Methods, 2nd ed. Univ. Minnesota Press, Minn.

SEE ALSO:
acf.plot , ar , ar.burg , spec.ar .

EXAMPLES:
a <- ar.yw(log(lynx))
acf.plot(a, conf=T)             # look at the partial correlations
tsplot(a$aic)                   # and at the shape of Akaike's criteria.
llynx.ar.fit <- ar.yw(log(lynx), aic=F, order=11)  # Fit an AR(11).