Covariances of sample autocorrelations
nvcovOfAcf.Rd
Compute covariances of autocorrelations.
Arguments
- 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
acf
.
Details
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).
References
Boshnakov GN (1996). “Bartlett's formulae---closed forms and recurrent equations.” Ann. Inst. Statist. Math., 48(1), 49--59. ISSN 0020-3157, doi:10.1007/BF00049288 .
Brockwell PJ, Davis RA (1991). Time series: theory and methods. 2nd ed.. Springer Series in Statistics. Berlin etc.: Springer-Verlag..
Note
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.
Examples
## 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))
#> ma2 iid
#> [1,] 0.09452061 0.1385929
#> [2,] 0.16935276 0.1385929
#> [3,] 0.17400093 0.1385929
#> [4,] 0.17400093 0.1385929
#> [5,] 0.17400093 0.1385929
#> [6,] 0.17400093 0.1385929
#> [7,] 0.17400093 0.1385929
acr <- autocorrelations(list(ma = c(0.8, 0.1)), maxlag = 7)
nvBD <- nvcovOfAcfBD(acr, 2, maxlag = 4)
all.equal(nv, nvBD) # TRUE
#> [1] TRUE