View source: R/autocovariances.R
nvcovOfAcf | R Documentation |
Compute covariances of autocorrelations.
nvcovOfAcf(model, maxlag)
nvcovOfAcfBD(acf, ma, maxlag)
acfOfSquaredArmaModel(model, maxlag)
model |
a model, see Details. |
maxlag |
a positive integer number, the maximal lag. |
acf |
autocorrelations. |
ma |
a positive integer number, the order of the MA(q) model. The default
is the maximal lag available in |
nvcovOfAcf
computes the unscaled asymptotic autocovariances of
sample autocorrelations of ARMA models, under the classical
assumptions when the Bartlett's formulas are valid. It works directly
with the parameters of the model and uses Boshnakov (1996). Argument
model
can be any specification of ARMA models for which
autocorrelations()
will work, e.g. a list with components "ar",
"ma", and "sigma2".
nvcovOfAcfBD
computes the same quantities but uses the formula
given by Brockwell & Davis (1991) (eq. (7.2.6.), p. 222), which is
based on the autocorrelations of the model. Argument
acf
contains the autocorrelations.
For nvcovOfAcfBD
, argument ma
asks to treat the provided
acf as that of MA(ma
). Only the values for lags up to
ma
are used and the rest are set to zero, since the
autocorrelations of MA(ma
) models are zero for lags greater
than ma
.
To force the use of all autocorrelations provided in acf
, set
ma
to the maximal lag available in acf
or omit
ma
, since this is its default.
acfOfSquaredArmaModel(model, maxlag)
is a convenience function
which computes the autocovariances of the "squared" model, see
Boshnakov (1996).
an (maxlag,maxlag)
-matrix
The name of nvcovOfAcf
stands for “n
times the
variance-covariance matrix”, so it needs to be divided by n
to
get the asymptotic variances and covariances.
Georgi N. Boshnakov
boshnakov1996aismsarima
\insertRefBrockwellDavis1991sarima
whiteNoiseTest
## MA(2)
ma2 <- list(ma = c(0.8, 0.1), sigma2 = 1)
nv <- nvcovOfAcf(ma2, maxlag = 4)
d <- diag(nvcovOfAcf(ma2, maxlag = 7))
cbind(ma2 = 1.96 * sqrt(d) / sqrt(200), iid = 1.96/sqrt(200))
acr <- autocorrelations(list(ma = c(0.8, 0.1)), maxlag = 7)
nvBD <- nvcovOfAcfBD(acr, 2, maxlag = 4)
all.equal(nv, nvBD) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.