Simulate Transition Matrices from the Multivariate Normal Distribution and Project to Stability
Source:R/RcppExports.R
SimBetaN2.RdThis function simulates random transition matrices
from the multivariate normal distribution
then projects each draw to the stability region
using ProjectToStability().
Arguments
- n
Positive integer. Number of replications.
- beta
Numeric matrix. The transition matrix (\(\boldsymbol{\beta}\)).
- vcov_beta_vec_l
Numeric matrix. Cholesky factorization (
t(chol(vcov_beta_vec))) of the sampling variance-covariance matrix of \(\mathrm{vec} \left( \boldsymbol{\beta} \right)\).- margin
Double in \((0, 1)\). Target upper bound for the spectral radius (default = 0.98).
- tol
Small positive double added to the denominator in the scaling factor to avoid division by zero (default = 1e-12).
See also
Other Simulation of State Space Models Data Functions:
LinSDE2SSM(),
LinSDECovEta(),
LinSDECovY(),
LinSDEInterceptEta(),
LinSDEInterceptY(),
LinSDEMeanEta(),
LinSDEMeanY(),
ProjectToHurwitz(),
ProjectToStability(),
SSMCovEta(),
SSMCovY(),
SSMInterceptEta(),
SSMInterceptY(),
SSMMeanEta(),
SSMMeanY(),
SimAlphaN(),
SimBetaN(),
SimBetaNCovariate(),
SimCovDiagN(),
SimCovN(),
SimIotaN(),
SimMVN(),
SimMuN(),
SimNuN(),
SimPhiN(),
SimPhiN2(),
SimPhiNCovariate(),
SimSSMFixed(),
SimSSMIVary(),
SimSSMLinGrowth(),
SimSSMLinGrowthIVary(),
SimSSMLinSDEFixed(),
SimSSMLinSDEIVary(),
SimSSMOUFixed(),
SimSSMOUIVary(),
SimSSMVARFixed(),
SimSSMVARIVary(),
SpectralRadius(),
TestPhi(),
TestPhiHurwitz(),
TestStability(),
TestStationarity()
Examples
n <- 10
beta <- matrix(
data = c(
0.7, 0.5, -0.1,
0.0, 0.6, 0.4,
0, 0, 0.5
),
nrow = 3
)
vcov_beta_vec_l <- t(chol(0.001 * diag(9)))
SimBetaN2(n = n, beta = beta, vcov_beta_vec_l = vcov_beta_vec_l)
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 0.7220518 0.03249946 -0.01232484
#> [2,] 0.4702043 0.61665058 0.04992734
#> [3,] -0.1305185 0.38812133 0.55434223
#>
#> [[2]]
#> [,1] [,2] [,3]
#> [1,] 0.67454086 -0.01985415 0.01570994
#> [2,] 0.54074997 0.59686953 -0.02832438
#> [3,] -0.09213611 0.34792962 0.50969799
#>
#> [[3]]
#> [,1] [,2] [,3]
#> [1,] 0.69062398 0.005225181 -0.02010547
#> [2,] 0.52625414 0.595154569 -0.02030443
#> [3,] -0.09222055 0.414382456 0.47769312
#>
#> [[4]]
#> [,1] [,2] [,3]
#> [1,] 0.68802190 0.04630413 -0.00768968
#> [2,] 0.52123165 0.61984513 -0.03364059
#> [3,] -0.08394862 0.41551940 0.48020576
#>
#> [[5]]
#> [,1] [,2] [,3]
#> [1,] 0.73415159 0.02122083 -0.015559204
#> [2,] 0.55256328 0.65052020 0.004007384
#> [3,] -0.08774542 0.36608981 0.552494039
#>
#> [[6]]
#> [,1] [,2] [,3]
#> [1,] 0.73639433 -0.03453232 0.02412758
#> [2,] 0.50179583 0.61801095 0.03740576
#> [3,] -0.05347199 0.40766860 0.50818978
#>
#> [[7]]
#> [,1] [,2] [,3]
#> [1,] 0.70905180 0.02610376 -0.003110754
#> [2,] 0.41579241 0.59660088 -0.006949438
#> [3,] -0.05697283 0.41507708 0.512086060
#>
#> [[8]]
#> [,1] [,2] [,3]
#> [1,] 0.72310965 0.07649833 -0.02875536
#> [2,] 0.51979430 0.57440904 0.01673866
#> [3,] -0.04677507 0.39292892 0.50473418
#>
#> [[9]]
#> [,1] [,2] [,3]
#> [1,] 0.66243996 0.05015854 0.008272799
#> [2,] 0.55001538 0.53426108 0.011466010
#> [3,] -0.09489223 0.45338640 0.535675170
#>
#> [[10]]
#> [,1] [,2] [,3]
#> [1,] 0.75195525 -0.0343205 -0.01862077
#> [2,] 0.47508497 0.6059596 -0.01193983
#> [3,] -0.08074849 0.4401671 0.53462435
#>