Skip to contents

Asymptotic covariance matrix of periodic mean.

Usage

meanvarcheck(parmodel, n)

meancovmat(parmodel, n, cor = FALSE, result = "var")

Arguments

parmodel

a periodic model.

n

number of observations (TODO: need clarification here).

cor

if TRUE, return correlations

result

if "var", return the diagonal of the covariance matrix, otherwise return the matrix.

Details

Computes asymptotic covariance or correlation matrix of the periodic means.

Value

if result = "var" a matrix, otherwise a vector

Author

Georgi N. Boshnakov

See also

Examples

x <- arima.sim(list(ar=0.9), n=1000)
proba1 <- fitPM(c(3,2,2,2), x)

meancovmat(proba1, 100)
#> [1] 0.988953 1.094719 1.121733 1.171675
meancovmat(proba1, 100, cor = TRUE)
#>           [,1]      [,2]      [,3]      [,4]
#> [1,] 1.0000000 0.9827059 0.9813786 0.9848972
#> [2,] 0.9827059 1.0000000 0.9862408 0.9808960
#> [3,] 0.9813786 0.9862408 1.0000000 0.9880167
#> [4,] 0.9848972 0.9808960 0.9880167 1.0000000
meancovmat(proba1, 100, result = "")
#>          [,1]     [,2]     [,3]     [,4]
#> [1,] 0.988953 1.022498 1.033640 1.060186
#> [2,] 1.022498 1.094719 1.092897 1.110907
#> [3,] 1.033640 1.092897 1.121733 1.132694
#> [4,] 1.060186 1.110907 1.132694 1.171675
meancovmat(proba1, 100, cor = TRUE, result = "")
#>           [,1]      [,2]      [,3]      [,4]
#> [1,] 1.0000000 0.9827059 0.9813786 0.9848972
#> [2,] 0.9827059 1.0000000 0.9862408 0.9808960
#> [3,] 0.9813786 0.9862408 1.0000000 0.9880167
#> [4,] 0.9848972 0.9808960 0.9880167 1.0000000

meanvarcheck(proba1, 100)
#> [1] 0.8907291 0.9859517 1.0093846 1.0544765