Learn R Programming

tsdecomp (version 0.2)

ARMAacov: Compute Theoretical Autocovariances of an ARMA Model

Description

Compute the theoretical autocovariances of an ARMA model.

Usage

ARMAacov(ar = numeric(0), ma = numeric(0), lag.max = max(p, q + 1), sigma2 = 1)

Arguments

ar
numeric vector of AR coefficients.
ma
numeric vector of MA coefficients.
lag.max
integer, maximum lag to be computed. The default is max(p, q+1), where p and q are orders of the AR and MA terms, length(ar) and length(ma), respectively.
sigma2
numeric, the variance of the innovations.

Value

A vector of autocovariances named by lag order.

References

Brockwell, P. J. and Davis, R. A. (1991) Time Series: Theory and Methods, Second Edition. Springer. \Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("#1")}10.1007/978-1-4419-0320-4http://doi.org/10.1007/978-1-4419-0320-4doi:\ifelse{latex}{\out{~}}{ }latex~ 10.1007/978-1-4419-0320-4

Pollock, D. S. G. (1999) A Handbook of Time-Series Analysis Signal Processing and Dynamics. Academic Press. Chapter 17. \Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("#1")}10.1016/B978-012560990-6/50002-6http://doi.org/10.1016/B978-012560990-6/50002-6doi:\ifelse{latex}{\out{~}}{ }latex~ 10.1016/B978-012560990-6/50002-6

See Also

ARMAtoMA.

Examples

Run this code
# Autocovariances of an ARMA(2,1)
# method 1: using ARMAacov()
a1 <- ARMAacov(ar=c(0.8,-0.6), ma=0.4, lag.max=10)

# method 2: upon the coefficients of the infinite MA representation
psi <- c(1, ARMAtoMA(ar=c(0.8,-0.6), ma=0.4, lag.max=50))
a2 <- c(sum(psi^2), rep(0, length(a1)-1))
for (i in seq_along(a2[-1]))
  a2[i+1] <- sum(psi[seq_len(length(psi)-i)] * psi[-seq_len(i)])

# for a high enough number of 'psi' coefficients
# both methods are equivalent
all.equal(a1, a2, check.names=FALSE)
#[1] TRUE

Run the code above in your browser using DataLab