Skip to contents

Compute asymptotic covariance matrix for PAR model

Usage

parcovmatlist(parmodel, n, cor = FALSE, result = "list")

Arguments

parmodel

PAR model, object of class parModel

n

length of the series or a vector with one element for each season.

cor

If TRUE return correlation matrix.

result

if "list", the default, return a list, if "Matrix" return a Matrix object, otherwise return an ordinary matrix, see Details.

Details

Uses eq. (3.3) in the reference.

If result = "list", parcovmatlist returns a list whose s-th element is the covariance matrix of the PAR parameters for the s-th season. Otherwise, if result = "Matrix" it returns a block-diagonal matrix created by .bdiag() from package "Matrix". If result = "matrix" it returns an ordinary matrix (with the current implementation this is returned for any value other than "list" or "Matriix").

Value

a list, matrix or block-diagonal matrix, as described in Details

References

McLeod AI (1994). “Diagnostic checking of periodic autoregression models with application.” Journal of Time Series Analysis, 15(2), 221--233.

Author

Georgi N. Boshnakov

Examples

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

parcovmatlist(proba1, 100)
#> [[1]]
#>               [,1]        [,2]          [,3]
#> [1,]  0.0399320003 -0.03408642 -0.0004527097
#> [2,] -0.0340864206  0.06997021 -0.0363389519
#> [3,] -0.0004527097 -0.03633895  0.0432953704
#> 
#> [[2]]
#>             [,1]        [,2]
#> [1,]  0.03984116 -0.03382292
#> [2,] -0.03382292  0.03674098
#> 
#> [[3]]
#>             [,1]        [,2]
#> [1,]  0.03997347 -0.03604842
#> [2,] -0.03604842  0.04140085
#> 
#> [[4]]
#>             [,1]        [,2]
#> [1,]  0.03987707 -0.03582995
#> [2,] -0.03582995  0.04223474
#> 
parcovmatlist(proba1, 100, cor = TRUE)
#> [[1]]
#>             [,1]       [,2]        [,3]
#> [1,]  1.00000000 -0.6448583 -0.01088776
#> [2,] -0.64485828  1.0000000 -0.66022974
#> [3,] -0.01088776 -0.6602297  1.00000000
#> 
#> [[2]]
#>            [,1]       [,2]
#> [1,]  1.0000000 -0.8840355
#> [2,] -0.8840355  1.0000000
#> 
#> [[3]]
#>            [,1]       [,2]
#> [1,]  1.0000000 -0.8861263
#> [2,] -0.8861263  1.0000000
#> 
#> [[4]]
#>            [,1]       [,2]
#> [1,]  1.0000000 -0.8730714
#> [2,] -0.8730714  1.0000000
#> 
sqrt(diag(parcovmatlist(proba1, 100, cor = TRUE)[[1]]))
#> [1] 1 1 1

meanvarcheck(proba1, 100)
#> [1] 0.6783456 0.6309466 0.6427926 0.6871145