View source: R/cTMed-mc-phi-sigma.R
| MCPhiSigma | R Documentation |
This function generates random
drift matrices \boldsymbol{\Phi}
and process noise covariabces matrices \boldsymbol{\Sigma}
using the Monte Carlo method.
MCPhiSigma(
phi,
sigma,
vcov_theta,
R,
test_phi = TRUE,
ncores = NULL,
seed = NULL
)
phi |
Numeric matrix.
The drift matrix ( |
sigma |
Numeric matrix.
The process noise covariance matrix ( |
vcov_theta |
Numeric matrix.
The sampling variance-covariance matrix of
|
R |
Positive integer. Number of replications. |
test_phi |
Logical.
If |
ncores |
Positive integer.
Number of cores to use.
If |
seed |
Random seed. |
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) .
Returns an object
of class ctmedmc which is a list with the following elements:
Function call.
Function arguments.
Function used ("MCPhiSigma").
A list simulated drift matrices.
Ivan Jacob Agaloos Pesigan
Other Continuous-Time Mediation Functions:
BootBeta(),
BootBetaStd(),
BootIndirectCentral(),
BootMed(),
BootMedStd(),
BootTotalCentral(),
DeltaBeta(),
DeltaBetaStd(),
DeltaIndirectCentral(),
DeltaMed(),
DeltaMedStd(),
DeltaTotalCentral(),
Direct(),
DirectStd(),
Indirect(),
IndirectCentral(),
IndirectStd(),
MCBeta(),
MCBetaStd(),
MCIndirectCentral(),
MCMed(),
MCMedStd(),
MCPhi(),
MCTotalCentral(),
Med(),
MedStd(),
PosteriorBeta(),
PosteriorIndirectCentral(),
PosteriorMed(),
PosteriorTotalCentral(),
Total(),
TotalCentral(),
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.