Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

TacvfAR

Theoretical Autocovariance Function of AR


Description

The theoretical autocovariance function of an AR(p) with unit variance is computed. This algorithm has many applications. In this package it is used for the computation of the information matrix, in simulating p initial starting values for AR simulations and in the computation of the exact mle for the mean.

Usage

TacvfAR(phi, lag.max = 20)

Arguments

phi

vector of AR coefficients

lag.max

computes autocovariances lags 0,1,...,maxlag

Details

The algorithm given by McLeod (1975) is used.

The built-in R function ARMAacf could also be used but it is quite complicated and apart from the source code, the precise algorithm used is not described. The only reference given for ARMAacf is the Brockwell and Davis (1991) but this text does not give any detailed exact algorithm for the general case.

Another advantage of TacvfAR over ARMAacf is that it will be easier for to translate and implement this algorithm in other computing environments such as MatLab etc. since the code is entirely written in R.

Value

Vector of length = (lag.max+1) containing the autocovariances at lags 0,...,lag.max is returned.

Author(s)

A.I. McLeod

References

McLeod, A.I. (1975), Derivation of the theoretical autocorrelation function of autoregressive moving-average time series. Applied Statistics, 24, 255-256.

See Also

Examples

#calculate and plot the autocorrelations from an AR(2) model
# with parameter vector c(1.8,-0.9).
 g<-TacvfAR(c(1.8,-0.9),20)
 AcfPlot(g/g[1], LagZeroQ=FALSE)

FitAR

Subset AR Model Fitting

v1.94
GPL (>= 2)
Authors
A.I. McLeod, Ying Zhang and Changjiang Xu
Initial release
2013-03-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.