This function computes the direct effect of the independent variable \(X\) on the dependent variable \(Y\) through mediator variables \(\mathbf{m}\) over a specific time interval \(\Delta t\) using the first-order stochastic differential equation model's drift matrix \(\boldsymbol{\Phi}\).
Direct(phi, delta_t, from, to, med)Returns an object
of class ctmedeffect which is a list with the following elements:
Function call.
Function arguments.
Function used ("Direct").
The direct effect.
Numeric matrix.
The drift matrix (\(\boldsymbol{\Phi}\)).
phi should have row and column names
pertaining to the variables in the system.
Numeric. Time interval (\(\Delta t\)).
Character string.
Name of the independent variable \(X\) in phi.
Character string.
Name of the dependent variable \(Y\) in phi.
Character vector.
Name/s of the mediator variable/s in phi.
Ivan Jacob Agaloos Pesigan
The direct effect of the independent variable \(X\) on the dependent variable \(Y\) relative to some mediator variables \(\mathbf{m}\) is given by $$ \mathrm{Direct}_{{\Delta t}_{i, j}} = \exp \left( \Delta t \mathbf{D} \boldsymbol{\Phi} \mathbf{D} \right)_{i, j} $$ where \(\boldsymbol{\Phi}\) denotes the drift matrix, \(\mathbf{D}\) a diagonal matrix where the diagonal elements corresponding to mediator variables \(\mathbf{m}\) are set to zero and the rest to one, \(i\) the row index of \(Y\) in \(\boldsymbol{\Phi}\), \(j\) the column index of \(X\) in \(\boldsymbol{\Phi}\), and \(\Delta t\) the time interval.
The measurement model is given by $$ \mathbf{y}_{i, t} = \boldsymbol{\nu} + \boldsymbol{\Lambda} \boldsymbol{\eta}_{i, t} + \boldsymbol{\varepsilon}_{i, t}, \quad \mathrm{with} \quad \boldsymbol{\varepsilon}_{i, t} \sim \mathcal{N} \left( \mathbf{0}, \boldsymbol{\Theta} \right) $$ where \(\mathbf{y}_{i, t}\), \(\boldsymbol{\eta}_{i, t}\), and \(\boldsymbol{\varepsilon}_{i, t}\) are random variables and \(\boldsymbol{\nu}\), \(\boldsymbol{\Lambda}\), and \(\boldsymbol{\Theta}\) are model parameters. \(\mathbf{y}_{i, t}\) represents a vector of observed random variables, \(\boldsymbol{\eta}_{i, t}\) a vector of latent random variables, and \(\boldsymbol{\varepsilon}_{i, t}\) a vector of random measurement errors, at time \(t\) and individual \(i\). \(\boldsymbol{\nu}\) denotes a vector of intercepts, \(\boldsymbol{\Lambda}\) a matrix of factor loadings, and \(\boldsymbol{\Theta}\) the covariance matrix of \(\boldsymbol{\varepsilon}\).
An alternative representation of the measurement error is given by $$ \boldsymbol{\varepsilon}_{i, t} = \boldsymbol{\Theta}^{\frac{1}{2}} \mathbf{z}_{i, t}, \quad \mathrm{with} \quad \mathbf{z}_{i, t} \sim \mathcal{N} \left( \mathbf{0}, \mathbf{I} \right) $$ where \(\mathbf{z}_{i, t}\) is a vector of independent standard normal random variables and \( \left( \boldsymbol{\Theta}^{\frac{1}{2}} \right) \left( \boldsymbol{\Theta}^{\frac{1}{2}} \right)^{\prime} = \boldsymbol{\Theta} . \)
The dynamic structure is given by $$ \mathrm{d} \boldsymbol{\eta}_{i, t} = \left( \boldsymbol{\iota} + \boldsymbol{\Phi} \boldsymbol{\eta}_{i, t} \right) \mathrm{d}t + \boldsymbol{\Sigma}^{\frac{1}{2}} \mathrm{d} \mathbf{W}_{i, t} $$ where \(\boldsymbol{\iota}\) is a term which is unobserved and constant over time, \(\boldsymbol{\Phi}\) is the drift matrix which represents the rate of change of the solution in the absence of any random fluctuations, \(\boldsymbol{\Sigma}\) is the matrix of volatility or randomness in the process, and \(\mathrm{d}\boldsymbol{W}\) is a Wiener process or Brownian motion, which represents random fluctuations.
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. tools:::Rd_expr_doi("10.2307/271028")
Deboeck, P. R., & Preacher, K. J. (2015). No need to be discrete: A method for continuous time mediation analysis. Structural Equation Modeling: A Multidisciplinary Journal, 23 (1), 61–75. tools:::Rd_expr_doi("10.1080/10705511.2014.973960")
Ryan, O., & Hamaker, E. L. (2021). Time to intervene: A continuous-time approach to network analysis and centrality. Psychometrika, 87 (1), 214–252. tools:::Rd_expr_doi("10.1007/s11336-021-09767-0")
Other Continuous Time Mediation Functions:
BootBeta(),
BootBetaStd(),
BootMed(),
BootMedStd(),
DeltaBeta(),
DeltaBetaStd(),
DeltaIndirectCentral(),
DeltaMed(),
DeltaMedStd(),
DeltaTotalCentral(),
DirectStd(),
ExpCov(),
ExpMean(),
Indirect(),
IndirectCentral(),
IndirectStd(),
MCBeta(),
MCBetaStd(),
MCIndirectCentral(),
MCMed(),
MCMedStd(),
MCPhi(),
MCTotalCentral(),
Med(),
MedStd(),
PosteriorBeta(),
PosteriorIndirectCentral(),
PosteriorMed(),
PosteriorTotalCentral(),
Total(),
TotalCentral(),
TotalStd(),
Trajectory()
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")
delta_t <- 1
Direct(
phi = phi,
delta_t = delta_t,
from = "x",
to = "y",
med = "m"
)
phi <- matrix(
data = c(
-6, 5.5, 0, 0,
1.25, -2.5, 5.9, -7.3,
0, 0, -6, 2.5,
5, 0, 0, -6
),
nrow = 4
)
colnames(phi) <- rownames(phi) <- paste0("y", 1:4)
Direct(
phi = phi,
delta_t = delta_t,
from = "y2",
to = "y4",
med = c("y1", "y3")
)
Run the code above in your browser using DataLab