Next: Arima Macros Help File Up: MacAnova Help File Previous: yates()   Contents


yulewalker(vec [, inverse:T]), vec a REAL vector or matrix.

Keywords: time series
yulewalker(Rho) computes a REAL vector of autoregressive (AR)
coefficients phi[1], phi[2], ... phi[p] of a p-th order AR time series
whose autocorrelations r[1], r[2], ... r[p], are in REAL vector Rho,
where p = nrows(Rho).  The values of phi satisfy the Yule-Walker
equations rho[j] = sum(phi[k]*rho[j-k],j=1,...,p), k = 1,...,p, with
rho[0] = 1, rho[-j] = rho[j].

When Rho is a matrix, yulewalker(Rho) computes AR coefficients from each
column separately, that is, yulewalker(Rho)[,j] = yulewalker(Rho[,j]), j
= 1,...,ncols(Rho).  If Rho is a generalized matrix (at most two
dimensions >= 1), yulewalker(Rho) = yulewalker(matrix(Rho)) (see
'matrices', matrix()).

When any column of Rho is not a valid autocorrelation function, that is,
if the implied Toeplitz correlation matrix is not positive definite,
yulewalker() prints a warning message, sets the element in the result
where the violation occurred to the most extreme value possible and any
subsequent elements to zero.  For instance, yulewalker(vector(-.3,
-.9,.5)) returns the result vector(-.6, -1, 0).

A typical usage is
  Cmd> rhohat <- autocor(y, 10) # compute 1st 10 autocorrelations

  Cmd> phihat <- yulewalker(rhohat)

phihat is a vector of length 10 containing the coefficients of the
autoregressive series whose first 10 autocorrelations are the same as
rhohat.  Thus yulewalker() provides a method-of-moments way to estimate
the parameters of an AR (autoregressive) model.

When time series y is in fact a normal stationary AR series of order
length(rhohat), these estimates are asymptotically equivalent to maximum
likelihood estimates.

NOTE: autocor() is a macro in file tser.mac.  Type help(autocor) for

yulewalker(Phi,inverse:T) computes auto correlations corresponding to
autoregressive coefficients in the columns of REAL vector or matrix Phi.

Effectively yulewalker(Phi,inverse:T) is the inverse function to
yulewalker() in that yulewalker(yulewalker(Rho),inverse:T) should the
same as Rho, except for rounding error.

One important usage is
  Cmd> rho <- yulewalker(padto(Phi,n), inverse:T)

where n >= nrows(Phi).  This computes the first n autocorrelations of
the autoregressive series with autoregression coefficients in Phi.

See also padto(), partacf(), toeplitz().

Gary Oehlert 2003-01-15