Simulate Random Drift Matrices from the Multivariate Normal Distribution
Source:R/RcppExports.R
SimPhiN.Rd
This function simulates random drift matrices
from the multivariate normal distribution.
The function ensures that the generated drift matrices are stable
using TestPhi()
.
Usage
SimPhiN(
n,
phi,
vcov_phi_vec_l,
margin = 0,
auto_ubound = 0,
phi_lbound = NULL,
phi_ubound = NULL,
bound = FALSE,
max_iter = 100000L
)
Arguments
- n
Positive integer. Number of replications.
- phi
Numeric matrix. The drift matrix (\(\boldsymbol{\Phi}\)).
- vcov_phi_vec_l
Numeric matrix. Cholesky factorization (
t(chol(vcov_phi_vec))
) of the sampling variance-covariance matrix of \(\mathrm{vec} \left( \boldsymbol{\Phi} \right)\).- margin
Numeric scalar specifying the stability threshold for the real part of the eigenvalues. The default
0.0
corresponds to the imaginary axis; values less than0.0
enforce a stricter stability margin.- auto_ubound
Numeric scalar specifying the upper bound for the diagonal elements of \(\boldsymbol{\Phi}\). Default is
0.0
, requiring all diagonal values to be \(\leq 0\).- phi_lbound
Optional numeric matrix of same dim as
phi
. Use NA for no lower bound.- phi_ubound
Optional numeric matrix of same dim as
phi
. Use NA for no upper bound.- bound
Logical; if TRUE, resample until all elements respect bounds (NA bounds ignored).
- max_iter
Safety cap on resampling attempts per draw.
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()
,
SimCovN()
,
SimIotaN()
,
SimNuN()
,
SimPhiN2()
,
SimSSMFixed()
,
SimSSMIVary()
,
SimSSMLinGrowth()
,
SimSSMLinGrowthIVary()
,
SimSSMLinSDEFixed()
,
SimSSMLinSDEIVary()
,
SimSSMOUFixed()
,
SimSSMOUIVary()
,
SimSSMVARFixed()
,
SimSSMVARIVary()
,
SpectralRadius()
,
TestPhi()
,
TestPhiHurwitz()
,
TestStability()
,
TestStationarity()
Examples
n <- 10
phi <- matrix(
data = c(
-0.357, 0.771, -0.450,
0.0, -0.511, 0.729,
0, 0, -0.693
),
nrow = 3
)
vcov_phi_vec_l <- t(chol(0.001 * diag(9)))
SimPhiN(n = n, phi = phi, vcov_phi_vec_l = vcov_phi_vec_l)
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] -0.4056717 0.00963608 -0.006411421
#> [2,] 0.7971398 -0.46306918 0.002284498
#> [3,] -0.4782114 0.75434600 -0.628667123
#>
#> [[2]]
#> [,1] [,2] [,3]
#> [1,] -0.3509021 0.0111359 -0.03622121
#> [2,] 0.8350892 -0.5727986 -0.00499300
#> [3,] -0.4316544 0.6866473 -0.68880435
#>
#> [[3]]
#> [,1] [,2] [,3]
#> [1,] -0.3049919 -0.02994697 0.005058385
#> [2,] 0.7815638 -0.49288978 -0.048432858
#> [3,] -0.4389116 0.73536118 -0.667207990
#>
#> [[4]]
#> [,1] [,2] [,3]
#> [1,] -0.3396465 0.02095482 0.029038781
#> [2,] 0.7341466 -0.49825419 0.007515091
#> [3,] -0.4353150 0.73993565 -0.697008343
#>
#> [[5]]
#> [,1] [,2] [,3]
#> [1,] -0.2932721 0.007198799 -0.034511046
#> [2,] 0.7356893 -0.544914896 0.001020017
#> [3,] -0.4393681 0.732523242 -0.684496518
#>
#> [[6]]
#> [,1] [,2] [,3]
#> [1,] -0.4377973 -0.04706767 -0.01838142
#> [2,] 0.7838599 -0.53293760 0.01181034
#> [3,] -0.4574239 0.72213995 -0.68302987
#>
#> [[7]]
#> [,1] [,2] [,3]
#> [1,] -0.4185958 0.03544033 0.01125124
#> [2,] 0.8447213 -0.51480860 -0.01432882
#> [3,] -0.4965570 0.76014586 -0.72571647
#>
#> [[8]]
#> [,1] [,2] [,3]
#> [1,] -0.3764119 -0.01272371 0.022433221
#> [2,] 0.8306660 -0.48574320 -0.003152393
#> [3,] -0.4440828 0.72916276 -0.761300011
#>
#> [[9]]
#> [,1] [,2] [,3]
#> [1,] -0.3706247 0.01669406 0.03715096
#> [2,] 0.7944109 -0.53390375 -0.01833935
#> [3,] -0.4665633 0.68689191 -0.77726100
#>
#> [[10]]
#> [,1] [,2] [,3]
#> [1,] -0.3589059 0.04866833 -0.039311008
#> [2,] 0.7840827 -0.55322285 -0.006545449
#> [3,] -0.4364258 0.74984666 -0.697789062
#>