R/sGARCH-internals.R
GARCH_companion_matrix.RdConstruct the companion matrix of an GARCH model
GARCH_companion_matrix(alpha = 0, beta = 0)numeric matrix of size p+q x p+q.
Version 1.0.3
# ARCH(1) / GARCH(1) ~ Base 2 x 2
GARCH_companion_matrix(alpha = c(0.4))
#> [,1] [,2]
#> [1,] 0 0.4
#> [2,] 0 0.0
#> attr(,"arOrder")
#> [1] 1
#> attr(,"maOrder")
#> [1] 1
GARCH_companion_matrix(beta = c(0.4))
#> [,1] [,2]
#> [1,] 0.4 0
#> [2,] 0.0 0
#> attr(,"arOrder")
#> [1] 1
#> attr(,"maOrder")
#> [1] 1
# Only ARCH + 1 column of zero
GARCH_companion_matrix(alpha = c(0.4, 0.3, 0.1))
#> [,1] [,2] [,3] [,4]
#> [1,] 0 0.4 0.3 0.1
#> [2,] 1 0.0 0.0 0.0
#> [3,] 0 1.0 0.0 0.0
#> [4,] 0 0.0 0.0 0.0
#> attr(,"arOrder")
#> [1] 1
#> attr(,"maOrder")
#> [1] 3
# Only GARCH + 1 column of zero
GARCH_companion_matrix(beta = c(0.4, 0.3, 0.1))
#> [,1] [,2] [,3] [,4]
#> [1,] 0.4 0.3 0.1 0
#> [2,] 0.0 0.0 0.0 0
#> [3,] 0.0 1.0 0.0 0
#> [4,] 0.0 0.0 1.0 0
#> attr(,"arOrder")
#> [1] 3
#> attr(,"maOrder")
#> [1] 1
# FULL
GARCH_companion_matrix(c(0.4, 0.2), c(0.3, 0))
#> [,1] [,2] [,3] [,4]
#> [1,] 0.3 0 0.4 0.2
#> [2,] 1.0 0 0.0 0.0
#> [3,] 0.0 0 0.0 0.0
#> [4,] 0.0 0 1.0 0.0
#> attr(,"arOrder")
#> [1] 2
#> attr(,"maOrder")
#> [1] 2