View source: R/cTMed-trajectory.R
Trajectory | R Documentation |
This function simulates trajectories of variables
without measurement error or process noise.
Total
corresponds to the total effect
and Direct
corresponds to the portion of the total effect
where the indirect effect is removed.
Trajectory(mu0, time, phi, med)
mu0 |
Numeric vector. Initial values of the variables. |
time |
Positive integer. Number of time points. |
phi |
Numeric matrix.
The drift matrix ( |
med |
Character vector.
Name/s of the mediator variable/s in |
Returns an object
of class ctmedtraj
which is a list with the following elements:
Function call.
Function arguments.
Function used ("Trajectory").
A data frame of simulated data.
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
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")
traj <- Trajectory(
mu0 = c(3, 3, -3),
time = 150,
phi = phi,
med = "m"
)
plot(traj)
# Methods -------------------------------------------------------------------
# Trajectory has a number of methods including
# print, summary, and plot
traj <- Trajectory(
mu0 = c(3, 3, -3),
time = 25,
phi = phi,
med = "m"
)
print(traj)
summary(traj)
plot(traj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.