Simulate Covariance Matrices from the Multivariate Normal Distribution
Source:R/RcppExports.R
SimCovN.Rd
This function simulates random covariance matrices from the multivariate normal distribution. The function ensures that the generated covariance matrices are positive semi-definite.
See also
Other Simulation of State Space Models Data Functions:
LinSDE2SSM()
,
LinSDECovEta()
,
LinSDECovY()
,
LinSDEMeanEta()
,
LinSDEMeanY()
,
ProjectToHurwitz()
,
ProjectToStability()
,
SSMCovEta()
,
SSMCovY()
,
SSMMeanEta()
,
SSMMeanY()
,
SimAlphaN()
,
SimBetaN()
,
SimBetaN2()
,
SimCovDiagN()
,
SimIotaN()
,
SimPhiN()
,
SimPhiN2()
,
SimSSMFixed()
,
SimSSMIVary()
,
SimSSMLinGrowth()
,
SimSSMLinGrowthIVary()
,
SimSSMLinSDEFixed()
,
SimSSMLinSDEIVary()
,
SimSSMOUFixed()
,
SimSSMOUIVary()
,
SimSSMVARFixed()
,
SimSSMVARIVary()
,
SpectralRadius()
,
TestPhi()
,
TestPhiHurwitz()
,
TestStability()
,
TestStationarity()
Examples
n <- 10
sigma <- matrix(
data = c(
1.0, 0.5, 0.3,
0.5, 1.0, 0.4,
0.3, 0.4, 1.0
),
nrow = 3
)
vcov_sigma_vech_l <- t(
chol(
0.001 * diag(3 * (3 + 1) / 2)
)
)
SimCovN(
n = n,
sigma = sigma,
vcov_sigma_vech_l = vcov_sigma_vech_l
)
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 0.9453100 0.4995039 0.2295634
#> [2,] 0.4995039 0.9846987 0.4474894
#> [3,] 0.2295634 0.4474894 0.9983945
#>
#> [[2]]
#> [,1] [,2] [,3]
#> [1,] 1.0595277 0.5006539 0.3065987
#> [2,] 0.5006539 0.9467486 0.4189609
#> [3,] 0.3065987 0.4189609 1.0348725
#>
#> [[3]]
#> [,1] [,2] [,3]
#> [1,] 1.0249734 0.5172577 0.2286775
#> [2,] 0.5172577 1.0125949 0.3977968
#> [3,] 0.2286775 0.3977968 0.9706371
#>
#> [[4]]
#> [,1] [,2] [,3]
#> [1,] 1.0288240 0.4096426 0.3213520
#> [2,] 0.4096426 1.0645402 0.3742215
#> [3,] 0.3213520 0.3742215 0.9844067
#>
#> [[5]]
#> [,1] [,2] [,3]
#> [1,] 1.0289707 0.5065213 0.3237028
#> [2,] 0.5065213 0.9572151 0.3597157
#> [3,] 0.3237028 0.3597157 0.9643785
#>
#> [[6]]
#> [,1] [,2] [,3]
#> [1,] 0.9954098 0.4975186 0.3238913
#> [2,] 0.4975186 0.9484577 0.3898989
#> [3,] 0.3238913 0.3898989 1.0065099
#>
#> [[7]]
#> [,1] [,2] [,3]
#> [1,] 1.0439838 0.4841791 0.3070641
#> [2,] 0.4841791 0.9440822 0.3471224
#> [3,] 0.3070641 0.3471224 1.0097071
#>
#> [[8]]
#> [,1] [,2] [,3]
#> [1,] 0.9638273 0.5174320 0.3290599
#> [2,] 0.5174320 0.9734041 0.3846425
#> [3,] 0.3290599 0.3846425 0.9959778
#>
#> [[9]]
#> [,1] [,2] [,3]
#> [1,] 1.0286602 0.491940 0.2803007
#> [2,] 0.4919400 1.006822 0.4009730
#> [3,] 0.2803007 0.400973 1.0796971
#>
#> [[10]]
#> [,1] [,2] [,3]
#> [1,] 0.9974445 0.5318089 0.3512592
#> [2,] 0.5318089 0.9680744 0.4099154
#> [3,] 0.3512592 0.4099154 0.9502194
#>