Learn R Programming

forecastSNSTS (version 1.3-0)

acfARp: Compute autocovariances of an AR(p) process

Description

This functions returns the autocovariances \(Cov(X_{t-k}, X_t)\) of a stationary time series \((Y_t)\) that fulfills the following equation: $$Y_t = \sum_{j=1}^p a_j Y_{t-j} + \sigma \varepsilon_{t},$$ where \(\sigma > 0\), \(\varepsilon_t\) is white noise and \(a_1, \ldots, a_p\) are real numbers satisfying that the roots \(z_0\) of the polynomial \(1 - \sum_{j=1}^p a_j z^j\) lie strictly outside the unit circle.

Usage

acfARp(a = NULL, sigma, k)

Arguments

a

vector \((a_1, \ldots, a_p)\) of coefficients; default NULL, corresponding to p = 0, white noise with variance \(\sigma^2\),

sigma

standard deviation of \(\varepsilon_t\); default 1,

k

lag for which to compute the autocovariances.

Value

Returns autocovariance at lag k of the AR(p) process.

Examples

Run this code
# NOT RUN {
## Taken from Section 6 in Dahlhaus (1997, AoS)
a1 <- function(u) {1.8 * cos(1.5 - cos(4*pi*u))}
a2 <- function(u) {-0.81}
# local autocovariance for u === 1/2: lag 1
acfARp(a = c(a1(1/2), a2(1/2)), sigma = 1, k = 1)
# local autocovariance for u === 1/2: lag -2
acfARp(a = c(a1(1/2), a2(1/2)), sigma = 1, k = -1)
# local autocovariance for u === 1/2: the variance
acfARp(a = c(a1(1/2), a2(1/2)), sigma = 1, k = 0)
# }

Run the code above in your browser using DataLab