armaccf_xe: Crosscovariances between an ARMA process and its innovations

View source: R/armacalc.R

armaccf_xeR Documentation

Crosscovariances between an ARMA process and its innovations

Description

Compute autocovariances of ARMA models and crosscovariances between an ARMA process and its innovations.

Usage

armaccf_xe(model, lag.max = 1)
armaacf(model, lag.max, compare)

Arguments

model

the model, a list with components ar, ma and sigma2 (for the time being, sigmasq is also accepted, if model$sigma2 is NULL).

lag.max

maximal lag for the result.

compare

if TRUE compute the autocovariances also using tacvfARMA() and return both results for comparison.

Details

Given a causal ARMA model, armaccf_xe computes theoretical crosscovariances R_{xe}(0), R_{xe}(1), R_{xe}(lag.max), where R_{xe}(k)=E(X_{t}e_{t-k}), between an ARMA process and its innovations. Negative lags are not considered since R_{xe}(k)=0 for k<0. The moving average polynomial may have roots on the unit circle.

This is a simple illustration of the equations I give in my time series courses.

armaacf computes ARMA autocovariances. The default method computes computes the zero lag autocovariance using armaccf_xe() and multiplies the autocorrelations obtained from ARMAacf (which computes autocorrelations, not autocovariances). If compare = TRUE it also uses tacvfARMA from package ltsa and returns both results in a matrix for comparison. The matrix has columns "native", "tacvfARMA" and "difference", where the last column contains the (zapped) differences between the autocorrelations obtained by the two methods.

The ARMA parameters in argument model follow the Brockwell-Davis convention for the signs. Since tacvfARMA() uses the Box-Jenkins convention for the signs, the moving average parameters are negated for calls to tacvfARMA().

Value

for armaccf_xe, the crosscovariances for lags 0, ..., maxlag.

for armaacf, the autocovariances, see Details.

Note

armaacf is useful for exploratory computations but autocovariances is more convenient and eliminates the need to know function names for particular cases.

Author(s)

Georgi N. Boshnakov

References

\insertRef

McLeodYuKrougly2007sarima

Examples

## Example 1 from ?ltsa::tacvfARMA
z <- sqrt(sunspot.year)
n <- length(z)
p <- 9
q <- 0
ML <- 5
out <- arima(z, order = c(p, 0, q))

phi <- theta <- numeric(0)
if (p > 0) phi <- coef(out)[1:p]
if (q > 0) theta <- coef(out)[(p+1):(p+q)]
zm <- coef(out)[p+q+1]
sigma2 <- out$sigma2

armaacf(list(ar = phi, ma = theta, sigma2 = sigma2), lag.max = 20)
## this illustrates that the methods
## based on ARMAacf and tacvARMA are equivalent:
armaacf(list(ar = phi, ma = theta, sigma2 = sigma2), lag.max = 20, compare = TRUE)

## In the original example in ?ltsa::tacvfARMA
## the comparison is with var(z), not with the theoretical variance:
rA <- ltsa::tacvfARMA(phi, - theta, maxLag=n+ML-1, sigma2=sigma2)
rB <- var(z) * ARMAacf(ar=phi, ma=theta, lag.max=n+ML-1)
## so rA and rB are different.
## but the difference is due to the variance:
rB2 <- rA[1] * ARMAacf(ar=phi, ma=theta, lag.max=n+ML-1)
cbind(rA[1:5], rB[1:5], rB2[1:5])

## There is no need to use specific functions,
## autocovariances() is most convenient for routine use:
armalist <- list(ar = phi, ma = theta, sigma2 = sigma2)
autocovariances(armalist, maxlag = 10)

## even better, set up an ARMA model:
mo <- new("ArmaModel", ar = phi, ma = theta, sigma2 = sigma2)
autocovariances(mo, maxlag = 10)

GeoBosh/sarima documentation built on March 27, 2024, 6:31 p.m.