This function generates random drift matrices \(\boldsymbol{\Phi}\) and process noise covariance matrices \(\boldsymbol{\Sigma}\) using the Monte Carlo method.
MCPhiSigma(
phi,
sigma,
vcov_theta,
R,
test_phi = TRUE,
sigma_diag = FALSE,
ncores = NULL,
seed = NULL
)Returns an object
of class ctmedmcphi which is a list with the following elements:
Function call.
Function arguments.
Function used ("MCPhiSigma").
A list of simulated draws. Each element contains a drift matrix and a process noise covariance matrix.
Numeric matrix.
The drift matrix (\(\boldsymbol{\Phi}\)).
phi should have row and column names
pertaining to the variables in the system.
Numeric matrix. The process noise covariance matrix (\(\boldsymbol{\Sigma}\)).
Numeric matrix. The sampling variance-covariance matrix of \(\mathrm{vec} \left( \boldsymbol{\Phi} \right)\) and \(\mathrm{vech} \left( \boldsymbol{\Sigma} \right)\)
Positive integer. Number of replications.
Logical.
If test_phi = TRUE,
the function tests the stability
of the generated drift matrix \(\boldsymbol{\Phi}\).
If the test returns FALSE,
the function generates a new drift matrix \(\boldsymbol{\Phi}\)
and runs the test recursively
until the test returns TRUE.
Logical.
If sigma_diag = TRUE,
treat \(\boldsymbol{\Sigma}\) as a diagonal matrix.
Positive integer.
Number of cores to use.
If ncores = NULL,
use a single core.
Consider using multiple cores
when number of replications R
is a large value.
Random seed.
Ivan Jacob Agaloos Pesigan
Let \(\boldsymbol{\theta}\) be a vector that combines \(\mathrm{vec} \left( \boldsymbol{\Phi} \right)\), that is, the elements of the \(\boldsymbol{\Phi}\) matrix in vector form sorted column-wise and \(\mathrm{vech} \left( \boldsymbol{\Sigma} \right)\), that is, the unique elements of the \(\boldsymbol{\Sigma}\) matrix in vector form sorted column-wise. Let \(\hat{\boldsymbol{\theta}}\) be a vector that combines \(\mathrm{vec} \left( \hat{\boldsymbol{\Phi}} \right)\) and \(\mathrm{vech} \left( \hat{\boldsymbol{\Sigma}} \right)\). Based on the asymptotic properties of maximum likelihood estimators, we can assume that estimators are normally distributed around the population parameters. $$ \hat{\boldsymbol{\theta}} \sim \mathcal{N} \left( \boldsymbol{\theta}, \mathbb{V} \left( \hat{\boldsymbol{\theta}} \right) \right) $$ Using this distributional assumption, a sampling distribution of \(\hat{\boldsymbol{\theta}}\) which we refer to as \(\hat{\boldsymbol{\theta}}^{\ast}\) can be generated by replacing the population parameters with sample estimates, that is, $$ \hat{\boldsymbol{\theta}}^{\ast} \sim \mathcal{N} \left( \hat{\boldsymbol{\theta}}, \hat{\mathbb{V}} \left( \hat{\boldsymbol{\theta}} \right) \right) . $$
Other Continuous-Time Mediation Functions:
BootBeta(),
BootBetaStd(),
BootDirectCentral(),
BootDirectCentralStd(),
BootIndirectCentral(),
BootIndirectCentralStd(),
BootMed(),
BootMedStd(),
BootTotalCentral(),
BootTotalCentralStd(),
DeltaBeta(),
DeltaBetaStd(),
DeltaDirectCentral(),
DeltaDirectCentralStd(),
DeltaIndirectCentral(),
DeltaMed(),
DeltaMedStd(),
DeltaTotalCentral(),
DeltaTotalCentralStd(),
Direct(),
DirectCentral(),
DirectCentralStd(),
DirectStd(),
Indirect(),
IndirectCentral(),
IndirectCentralStd(),
IndirectStd(),
MCBeta(),
MCBetaStd(),
MCDirectCentral(),
MCDirectCentralStd(),
MCIndirectCentral(),
MCIndirectCentralStd(),
MCMed(),
MCMedStd(),
MCPhi(),
MCTotalCentral(),
MCTotalCentralStd(),
Med(),
MedStd(),
PosteriorBeta(),
PosteriorBetaStd(),
PosteriorDirectCentral(),
PosteriorDirectCentralStd(),
PosteriorIndirectCentral(),
PosteriorIndirectCentralStd(),
PosteriorMed(),
PosteriorMedStd(),
PosteriorTotalCentral(),
PosteriorTotalCentralStd(),
Total(),
TotalCentral(),
TotalCentralStd(),
TotalStd(),
Trajectory()
set.seed(42)
phi <- matrix(
data = c(
-0.357, 0.771, -0.450,
0.0, -0.511, 0.729,
0, 0, -0.693
),
nrow = 3
)
colnames(phi) <- rownames(phi) <- c("x", "m", "y")
sigma <- matrix(
data = c(
0.24455556, 0.02201587, -0.05004762,
0.02201587, 0.07067800, 0.01539456,
-0.05004762, 0.01539456, 0.07553061
),
nrow = 3
)
MCPhiSigma(
phi = phi,
sigma = sigma,
vcov_theta = 0.1 * diag(15),
R = 100L # use a large value for R in actual research
)
Run the code above in your browser using DataLab