Trajectory {cTMed} | R Documentation |
Simulate Trajectories of Variables
Description
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.
Usage
Trajectory(mu0, time, phi, med)
Arguments
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 |
Value
Returns an object
of class ctmedtraj
which is a list with the following elements:
- call
Function call.
- args
Function arguments.
- fun
Function used ("Trajectory").
- output
A data frame of simulated data.
See Also
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()
Examples
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)