Simulate Diagonal Covariance Matrices from the Multivariate Normal Distribution
Source:R/RcppExports.R
SimCovDiagN.Rd
This function simulates random diagonal covariance matrices from the multivariate normal distribution. The function ensures that the generated covariance matrices are positive semi-definite.
Arguments
- n
Positive integer. Number of replications.
- sigma_diag
Numeric matrix. The covariance matrix (\(\boldsymbol{\Sigma}\)).
- vcov_sigma_diag_l
Numeric matrix. Cholesky factorization (
t(chol(vcov_sigma_vech))
) of the sampling variance-covariance matrix of \(\mathrm{vech} \left( \boldsymbol{\Sigma} \right)\).
See also
Other Simulation of State Space Models Data Functions:
LinSDE2SSM()
,
LinSDECovEta()
,
LinSDECovY()
,
LinSDEMeanEta()
,
LinSDEMeanY()
,
ProjectToHurwitz()
,
ProjectToStability()
,
SSMCovEta()
,
SSMCovY()
,
SSMMeanEta()
,
SSMMeanY()
,
SimAlphaN()
,
SimBetaN()
,
SimBetaN2()
,
SimCovN()
,
SimIotaN()
,
SimPhiN()
,
SimPhiN2()
,
SimSSMFixed()
,
SimSSMIVary()
,
SimSSMLinGrowth()
,
SimSSMLinGrowthIVary()
,
SimSSMLinSDEFixed()
,
SimSSMLinSDEIVary()
,
SimSSMOUFixed()
,
SimSSMOUIVary()
,
SimSSMVARFixed()
,
SimSSMVARIVary()
,
SpectralRadius()
,
TestPhi()
,
TestPhiHurwitz()
,
TestStability()
,
TestStationarity()
Examples
n <- 10
sigma_diag <- c(1, 1, 1)
vcov_sigma_diag_l <- t(chol(0.001 * diag(3)))
SimCovDiagN(
n = n,
sigma_diag = sigma_diag,
vcov_sigma_diag_l = vcov_sigma_diag_l
)
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 1.037143 0.00000 0.000000
#> [2,] 0.000000 1.01046 0.000000
#> [3,] 0.000000 0.00000 1.042843
#>
#> [[2]]
#> [,1] [,2] [,3]
#> [1,] 1.020923 0.000000 0.0000000
#> [2,] 0.000000 1.014463 0.0000000
#> [3,] 0.000000 0.000000 0.9894816
#>
#> [[3]]
#> [,1] [,2] [,3]
#> [1,] 0.9979561 0.000000 0.0000000
#> [2,] 0.0000000 1.001538 0.0000000
#> [3,] 0.0000000 0.000000 0.9954625
#>
#> [[4]]
#> [,1] [,2] [,3]
#> [1,] 1.004346 0.000000 0.0000000
#> [2,] 0.000000 1.000931 0.0000000
#> [3,] 0.000000 0.000000 0.9629609
#>
#> [[5]]
#> [,1] [,2] [,3]
#> [1,] 1.010956 0.000000 0.0000000
#> [2,] 0.000000 1.020065 0.0000000
#> [3,] 0.000000 0.000000 0.9734267
#>
#> [[6]]
#> [,1] [,2] [,3]
#> [1,] 1.036298 0.000000 0.00000
#> [2,] 0.000000 1.004114 0.00000
#> [3,] 0.000000 0.000000 1.03409
#>
#> [[7]]
#> [,1] [,2] [,3]
#> [1,] 0.988666 0.000000 0.000000
#> [2,] 0.000000 1.019745 0.000000
#> [3,] 0.000000 0.000000 1.008761
#>
#> [[8]]
#> [,1] [,2] [,3]
#> [1,] 1.02682 0.000000 0.000000
#> [2,] 0.00000 1.041622 0.000000
#> [3,] 0.00000 0.000000 1.029924
#>
#> [[9]]
#> [,1] [,2] [,3]
#> [1,] 0.9748926 0.000000 0.0000000
#> [2,] 0.0000000 1.037662 0.0000000
#> [3,] 0.0000000 0.000000 0.9818589
#>
#> [[10]]
#> [,1] [,2] [,3]
#> [1,] 0.9839876 0.0000000 0.000000
#> [2,] 0.0000000 0.9579473 0.000000
#> [3,] 0.0000000 0.0000000 1.002912
#>