Title: | Continuous Time Mediation |
---|---|
Description: | Calculates standard errors and confidence intervals for effects in continuous-time mediation models. This package extends the work of Deboeck and Preacher (2015) <doi:10.1080/10705511.2014.973960> and Ryan and Hamaker (2021) <doi:10.1007/s11336-021-09767-0> by providing methods to generate standard errors and confidence intervals for the total, direct, and indirect effects in these models. |
Authors: | Ivan Jacob Agaloos Pesigan [aut, cre, cph] |
Maintainer: | Ivan Jacob Agaloos Pesigan <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.1.9000 |
Built: | 2024-11-21 05:52:03 UTC |
Source: | https://github.com/jeksterslab/cTMed |
Delta Method Confidence Intervals
## S3 method for class 'ctmeddelta' confint(object, parm = NULL, level = 0.95, ...)
## S3 method for class 'ctmeddelta' confint(object, parm = NULL, level = 0.95, ...)
object |
Object of class |
parm |
a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered. |
level |
the confidence level required. |
... |
additional arguments. |
Returns a data frame of confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) confint(delta, level = 0.95) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) confint(delta, level = 0.95)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) confint(delta, level = 0.95) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) confint(delta, level = 0.95)
Monte Carlo Method Confidence Intervals
## S3 method for class 'ctmedmc' confint(object, parm = NULL, level = 0.95, ...)
## S3 method for class 'ctmedmc' confint(object, parm = NULL, level = 0.95, ...)
object |
Object of class |
parm |
a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered. |
level |
the confidence level required. |
... |
additional arguments. |
Returns a data frame of confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) confint(mc, level = 0.95) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) confint(mc, level = 0.95)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) confint(mc, level = 0.95) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) confint(mc, level = 0.95)
This function computes the delta method
sampling variance-covariance matrix
for the elements of the matrix of lagged coefficients
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model's
drift matrix
.
DeltaBeta(phi, vcov_phi_vec, delta_t, ncores = NULL)
DeltaBeta(phi, vcov_phi_vec, delta_t, ncores = NULL)
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Vector of positive numbers.
Time interval
( |
ncores |
Positive integer.
Number of cores to use.
If |
See Total()
.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
By the multivariate central limit theory,
the function
using
as input
can be expressed as:
where is the matrix of first-order derivatives
of the function
with respect to the elements of
and
is the asymptotic variance-covariance matrix of
.
From the former,
we can derive the distribution of
as follows:
The uncertainty associated with the estimator
is, therefore, given by
.
When
is unknown,
by substitution,
we can use
the estimated sampling variance-covariance matrix of
,
that is,
for
.
Therefore,
the sampling variance-covariance matrix of
is given by
Returns an object
of class ctmeddelta
which is a list with the following elements:
Function call.
Function arguments.
Function used ("DeltaBeta").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
Time interval.
Jacobian matrix.
Estimated elements of the matrix of lagged coefficients.
Sampling variance-covariance matrix of estimated elements of the matrix of lagged coefficients.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1 ) # Range of time intervals --------------------------------------------------- delta <- DeltaBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5 ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaBeta has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1 ) # Range of time intervals --------------------------------------------------- delta <- DeltaBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5 ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaBeta has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
This function computes the delta method
sampling variance-covariance matrix
for the indirect effect centrality
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model's
drift matrix
.
DeltaIndirectCentral(phi, vcov_phi_vec, delta_t, ncores = NULL)
DeltaIndirectCentral(phi, vcov_phi_vec, delta_t, ncores = NULL)
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Vector of positive numbers.
Time interval
( |
ncores |
Positive integer.
Number of cores to use.
If |
See IndirectCentral()
more details.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
By the multivariate central limit theory,
the function
using
as input
can be expressed as:
where is the matrix of first-order derivatives
of the function
with respect to the elements of
and
is the asymptotic variance-covariance matrix of
.
From the former,
we can derive the distribution of
as follows:
The uncertainty associated with the estimator
is, therefore, given by
.
When
is unknown,
by substitution,
we can use
the estimated sampling variance-covariance matrix of
,
that is,
for
.
Therefore,
the sampling variance-covariance matrix of
is given by
Returns an object
of class ctmeddelta
which is a list with the following elements:
Function call.
Function arguments.
Function used ("DeltaIndirectCentral").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
Time interval.
Jacobian matrix.
Estimated indirect effect centrality.
Sampling variance-covariance matrix of estimated indirect effect centrality.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1 ) # Range of time intervals --------------------------------------------------- delta <- DeltaIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5 ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaIndirectCentral has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1 ) # Range of time intervals --------------------------------------------------- delta <- DeltaIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5 ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaIndirectCentral has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
This function computes the delta method
sampling variance-covariance matrix
for the total, direct, and indirect effects
of the independent variable
on the dependent variable
through mediator variables
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model's
drift matrix
.
DeltaMed(phi, vcov_phi_vec, delta_t, from, to, med, ncores = NULL)
DeltaMed(phi, vcov_phi_vec, delta_t, from, to, med, ncores = NULL)
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Vector of positive numbers.
Time interval
( |
from |
Character string.
Name of the independent variable |
to |
Character string.
Name of the dependent variable |
med |
Character vector.
Name/s of the mediator variable/s in |
ncores |
Positive integer.
Number of cores to use.
If |
See Total()
,
Direct()
, and
Indirect()
for more details.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
By the multivariate central limit theory,
the function
using
as input
can be expressed as:
where is the matrix of first-order derivatives
of the function
with respect to the elements of
and
is the asymptotic variance-covariance matrix of
.
From the former,
we can derive the distribution of
as follows:
The uncertainty associated with the estimator
is, therefore, given by
.
When
is unknown,
by substitution,
we can use
the estimated sampling variance-covariance matrix of
,
that is,
for
.
Therefore,
the sampling variance-covariance matrix of
is given by
Returns an object
of class ctmeddelta
which is a list with the following elements:
Function call.
Function arguments.
Function used ("DeltaMed").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
Time interval.
Jacobian matrix.
Estimated total, direct, and indirect effects.
Sampling variance-covariance matrix of the estimated total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaMed has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaMed has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
This function computes the delta method
sampling variance-covariance matrix
for the total effect centrality
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model's
drift matrix
.
DeltaTotalCentral(phi, vcov_phi_vec, delta_t, ncores = NULL)
DeltaTotalCentral(phi, vcov_phi_vec, delta_t, ncores = NULL)
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Vector of positive numbers.
Time interval
( |
ncores |
Positive integer.
Number of cores to use.
If |
See TotalCentral()
more details.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
By the multivariate central limit theory,
the function
using
as input
can be expressed as:
where is the matrix of first-order derivatives
of the function
with respect to the elements of
and
is the asymptotic variance-covariance matrix of
.
From the former,
we can derive the distribution of
as follows:
The uncertainty associated with the estimator
is, therefore, given by
.
When
is unknown,
by substitution,
we can use
the estimated sampling variance-covariance matrix of
,
that is,
for
.
Therefore,
the sampling variance-covariance matrix of
is given by
Returns an object
of class ctmeddelta
which is a list with the following elements:
Function call.
Function arguments.
Function used ("DeltaTotalCentral").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
Time interval.
Jacobian matrix.
Estimated total effect centrality.
Sampling variance-covariance matrix of estimated total effect centrality.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1 ) # Range of time intervals --------------------------------------------------- delta <- DeltaTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5 ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaTotalCentral has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- DeltaTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1 ) # Range of time intervals --------------------------------------------------- delta <- DeltaTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5 ) plot(delta) # Methods ------------------------------------------------------------------- # DeltaTotalCentral has a number of methods including # print, summary, confint, and plot print(delta) summary(delta) confint(delta, level = 0.95) plot(delta)
This function computes the direct effect
of the independent variable
on the dependent variable
through mediator variables
over a specific time interval
using the first-order stochastic differential equation model's
drift matrix
.
Direct(phi, delta_t, from, to, med)
Direct(phi, delta_t, from, to, med)
phi |
Numeric matrix.
The drift matrix ( |
delta_t |
Numeric.
Time interval
( |
from |
Character string.
Name of the independent variable |
to |
Character string.
Name of the dependent variable |
med |
Character vector.
Name/s of the mediator variable/s in |
The direct effect
of the independent variable
on the dependent variable
relative to some mediator variables
is given by
where
denotes the drift matrix,
a diagonal matrix
where the diagonal elements corresponding
to mediator variables
are set to zero and the rest to one,
the row index of
in
,
the column index of
in
, and
the time interval.
The measurement model is given by
where
,
,
and
are random variables
and
,
,
and
are model parameters.
represents a vector of observed random variables,
a vector of latent random variables,
and
a vector of random measurement errors,
at time
and individual
.
denotes a vector of intercepts,
a matrix of factor loadings,
and
the covariance matrix of
.
An alternative representation of the measurement error is given by
where
is a vector of
independent standard normal random variables and
The dynamic structure is given by
where
is a term which is unobserved and constant over time,
is the drift matrix
which represents the rate of change of the solution
in the absence of any random fluctuations,
is the matrix of volatility
or randomness in the process, and
is a Wiener process or Brownian motion,
which represents random fluctuations.
Returns an object
of class ctmedeffect
which is a list with the following elements:
Function call.
Function arguments.
Function used ("Direct").
The direct effect.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") )
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") )
This function computes the indirect effect
of the independent variable
on the dependent variable
through mediator variables
over a specific time interval
using the first-order stochastic differential equation model's
drift matrix
.
Indirect(phi, delta_t, from, to, med)
Indirect(phi, delta_t, from, to, med)
phi |
Numeric matrix.
The drift matrix ( |
delta_t |
Numeric.
Time interval
( |
from |
Character string.
Name of the independent variable |
to |
Character string.
Name of the dependent variable |
med |
Character vector.
Name/s of the mediator variable/s in |
The indirect effect
of the independent variable
on the dependent variable
relative to some mediator variables
over a specific time interval
is given by
where
denotes the drift matrix,
a matrix
where the off diagonal elements are zeros
and the diagonal elements are zero
for the index/indices of mediator variables
and one otherwise,
the row index of
in
,
the column index of
in
, and
the time interval.
The measurement model is given by
where
,
,
and
are random variables
and
,
,
and
are model parameters.
represents a vector of observed random variables,
a vector of latent random variables,
and
a vector of random measurement errors,
at time
and individual
.
denotes a vector of intercepts,
a matrix of factor loadings,
and
the covariance matrix of
.
An alternative representation of the measurement error is given by
where
is a vector of
independent standard normal random variables and
The dynamic structure is given by
where
is a term which is unobserved and constant over time,
is the drift matrix
which represents the rate of change of the solution
in the absence of any random fluctuations,
is the matrix of volatility
or randomness in the process, and
is a Wiener process or Brownian motion,
which represents random fluctuations.
Returns an object
of class ctmedeffect
which is a list with the following elements:
Function call.
Function arguments.
Function used ("Indirect").
The indirect effect.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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 Indirect( 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) Indirect( phi = phi, delta_t = delta_t, from = "y2", to = "y4", med = c("y1", "y3") )
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 Indirect( 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) Indirect( phi = phi, delta_t = delta_t, from = "y2", to = "y4", med = c("y1", "y3") )
Indirect Effect Centrality
IndirectCentral(phi, delta_t)
IndirectCentral(phi, delta_t)
phi |
Numeric matrix.
The drift matrix ( |
delta_t |
Vector of positive numbers.
Time interval
( |
Indirect effect centrality is the sum of all possible indirect effects between different pairs of variables in which a specific variable serves as the only mediator.
Returns an object
of class ctmedmed
which is a list with the following elements:
Function call.
Function arguments.
Function used ("IndirectCentral").
A matrix of indirect effect centrality.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") # Specific time interval ---------------------------------------------------- IndirectCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- indirect_central <- IndirectCentral( phi = phi, delta_t = 1:30 ) plot(indirect_central) # Methods ------------------------------------------------------------------- # IndirectCentral has a number of methods including # print, summary, and plot indirect_central <- IndirectCentral( phi = phi, delta_t = 1:5 ) print(indirect_central) summary(indirect_central) plot(indirect_central)
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") # Specific time interval ---------------------------------------------------- IndirectCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- indirect_central <- IndirectCentral( phi = phi, delta_t = 1:30 ) plot(indirect_central) # Methods ------------------------------------------------------------------- # IndirectCentral has a number of methods including # print, summary, and plot indirect_central <- IndirectCentral( phi = phi, delta_t = 1:5 ) print(indirect_central) summary(indirect_central) plot(indirect_central)
This function generates a Monte Carlo method
sampling distribution
for the elements of the matrix of lagged coefficients
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model
drift matrix
.
MCBeta( phi, vcov_phi_vec, delta_t, R, test_phi = TRUE, ncores = NULL, seed = NULL )
MCBeta( phi, vcov_phi_vec, delta_t, R, test_phi = TRUE, ncores = NULL, seed = NULL )
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Numeric.
Time interval
( |
R |
Positive integer. Number of replications. |
test_phi |
Logical.
If |
ncores |
Positive integer.
Number of cores to use.
If |
seed |
Random seed. |
See Total()
.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
Based on the asymptotic properties of maximum likelihood estimators,
we can assume that estimators are normally distributed
around the population parameters.
Using this distributional assumption,
a sampling distribution of
which we refer to as
can be generated by replacing the population parameters
with sample estimates,
that is,
Let
be a parameter that is a function of the estimated parameters.
A sampling distribution of
,
which we refer to as
,
can be generated by using the simulated estimates
to calculate
.
The standard deviations of the simulated estimates
are the standard errors.
Percentiles corresponding to
are the confidence intervals.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("MCBeta").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
A vector of total, direct, and indirect effects.
A matrix of Monte Carlo total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCBeta has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95) plot(mc)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCBeta( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCBeta has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95) plot(mc)
This function generates a Monte Carlo method
sampling distribution
of the indirect effect centrality
at a particular time interval
using the first-order stochastic differential equation model
drift matrix
.
MCIndirectCentral( phi, vcov_phi_vec, delta_t, R, test_phi = TRUE, ncores = NULL, seed = NULL )
MCIndirectCentral( phi, vcov_phi_vec, delta_t, R, test_phi = TRUE, ncores = NULL, seed = NULL )
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Numeric.
Time interval
( |
R |
Positive integer. Number of replications. |
test_phi |
Logical.
If |
ncores |
Positive integer.
Number of cores to use.
If |
seed |
Random seed. |
See IndirectCentral()
for more details.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
Based on the asymptotic properties of maximum likelihood estimators,
we can assume that estimators are normally distributed
around the population parameters.
Using this distributional assumption,
a sampling distribution of
which we refer to as
can be generated by replacing the population parameters
with sample estimates,
that is,
Let
be a parameter that is a function of the estimated parameters.
A sampling distribution of
,
which we refer to as
,
can be generated by using the simulated estimates
to calculate
.
The standard deviations of the simulated estimates
are the standard errors.
Percentiles corresponding to
are the confidence intervals.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("MCIndirectCentral").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
A vector of indirect effect centrality.
A matrix of Monte Carlo indirect effect centrality.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCIndirectCentral has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95) plot(mc)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCIndirectCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCIndirectCentral has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95) plot(mc)
This function generates a Monte Carlo method
sampling distribution
of the total, direct and indirect effects
of the independent variable
on the dependent variable
through mediator variables
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model
drift matrix
.
MCMed( phi, vcov_phi_vec, delta_t, from, to, med, R, test_phi = TRUE, ncores = NULL, seed = NULL )
MCMed( phi, vcov_phi_vec, delta_t, from, to, med, R, test_phi = TRUE, ncores = NULL, seed = NULL )
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Numeric.
Time interval
( |
from |
Character string.
Name of the independent variable |
to |
Character string.
Name of the dependent variable |
med |
Character vector.
Name/s of the mediator variable/s in |
R |
Positive integer. Number of replications. |
test_phi |
Logical.
If |
ncores |
Positive integer.
Number of cores to use.
If |
seed |
Random seed. |
See Total()
,
Direct()
, and
Indirect()
for more details.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
Based on the asymptotic properties of maximum likelihood estimators,
we can assume that estimators are normally distributed
around the population parameters.
Using this distributional assumption,
a sampling distribution of
which we refer to as
can be generated by replacing the population parameters
with sample estimates,
that is,
Let
be a parameter that is a function of the estimated parameters.
A sampling distribution of
,
which we refer to as
,
can be generated by using the simulated estimates
to calculate
.
The standard deviations of the simulated estimates
are the standard errors.
Percentiles corresponding to
are the confidence intervals.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("MCMed").
A list with length of length(delta_t)
.
Each element in the output
list has the following elements:
A vector of total, direct, and indirect effects.
A matrix of Monte Carlo total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCMed has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCMed has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95)
This function generates random
drift matrices
using the Monte Carlo method.
MCPhi(phi, vcov_phi_vec, R, test_phi = TRUE, ncores = NULL, seed = NULL)
MCPhi(phi, vcov_phi_vec, R, test_phi = TRUE, ncores = NULL, seed = NULL)
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
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 be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
Based on the asymptotic properties of maximum likelihood estimators,
we can assume that estimators are normally distributed
around the population parameters.
Using this distributional assumption,
a sampling distribution of
which we refer to as
can be generated by replacing the population parameters
with sample estimates,
that is,
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("MCPhi").
A list simulated drift matrices.
Ivan Jacob Agaloos Pesigan
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") MCPhi( phi = phi, vcov_phi_vec = 0.1 * diag(9), R = 100L # use a large value for R in actual research ) 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) MCPhi( phi = phi, vcov_phi_vec = 0.1 * diag(16), R = 100L, # use a large value for R in actual research test_phi = FALSE )
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") MCPhi( phi = phi, vcov_phi_vec = 0.1 * diag(9), R = 100L # use a large value for R in actual research ) 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) MCPhi( phi = phi, vcov_phi_vec = 0.1 * diag(16), R = 100L, # use a large value for R in actual research test_phi = FALSE )
This function generates a Monte Carlo method
sampling distribution
of the total effect centrality
at a particular time interval
using the first-order stochastic differential equation model
drift matrix
.
MCTotalCentral( phi, vcov_phi_vec, delta_t, R, test_phi = TRUE, ncores = NULL, seed = NULL )
MCTotalCentral( phi, vcov_phi_vec, delta_t, R, test_phi = TRUE, ncores = NULL, seed = NULL )
phi |
Numeric matrix.
The drift matrix ( |
vcov_phi_vec |
Numeric matrix.
The sampling variance-covariance matrix of
|
delta_t |
Numeric.
Time interval
( |
R |
Positive integer. Number of replications. |
test_phi |
Logical.
If |
ncores |
Positive integer.
Number of cores to use.
If |
seed |
Random seed. |
See TotalCentral()
for more details.
Let be
,
that is,
the elements of the
matrix
in vector form sorted column-wise.
Let
be
.
Based on the asymptotic properties of maximum likelihood estimators,
we can assume that estimators are normally distributed
around the population parameters.
Using this distributional assumption,
a sampling distribution of
which we refer to as
can be generated by replacing the population parameters
with sample estimates,
that is,
Let
be a parameter that is a function of the estimated parameters.
A sampling distribution of
,
which we refer to as
,
can be generated by using the simulated estimates
to calculate
.
The standard deviations of the simulated estimates
are the standard errors.
Percentiles corresponding to
are the confidence intervals.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("MCTotalCentral").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
A vector of total effect centrality.
A matrix of Monte Carlo total effect centrality.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCTotalCentral has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95) plot(mc)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- MCTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, R = 100L # use a large value for R in actual research ) # Range of time intervals --------------------------------------------------- mc <- MCTotalCentral( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, R = 100L # use a large value for R in actual research ) plot(mc) # Methods ------------------------------------------------------------------- # MCTotalCentral has a number of methods including # print, summary, confint, and plot print(mc) summary(mc) confint(mc, level = 0.95) plot(mc)
This function computes the total, direct, and indirect effects
of the independent variable
on the dependent variable
through mediator variables
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model's
drift matrix
.
Med(phi, delta_t, from, to, med)
Med(phi, delta_t, from, to, med)
phi |
Numeric matrix.
The drift matrix ( |
delta_t |
Vector of positive numbers.
Time interval
( |
from |
Character string.
Name of the independent variable |
to |
Character string.
Name of the dependent variable |
med |
Character vector.
Name/s of the mediator variable/s in |
See Total()
,
Direct()
, and
Indirect()
for more details.
The measurement model is given by
where
,
,
and
are random variables
and
,
,
and
are model parameters.
represents a vector of observed random variables,
a vector of latent random variables,
and
a vector of random measurement errors,
at time
and individual
.
denotes a vector of intercepts,
a matrix of factor loadings,
and
the covariance matrix of
.
An alternative representation of the measurement error is given by
where
is a vector of
independent standard normal random variables and
The dynamic structure is given by
where
is a term which is unobserved and constant over time,
is the drift matrix
which represents the rate of change of the solution
in the absence of any random fluctuations,
is the matrix of volatility
or randomness in the process, and
is a Wiener process or Brownian motion,
which represents random fluctuations.
Returns an object
of class ctmedmed
which is a list with the following elements:
Function call.
Function arguments.
Function used ("Med").
A matrix of total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") # Specific time interval ---------------------------------------------------- Med( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:30, from = "x", to = "y", med = "m" ) plot(med) # Methods ------------------------------------------------------------------- # Med has a number of methods including # print, summary, and plot med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) print(med) summary(med) plot(med)
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") # Specific time interval ---------------------------------------------------- Med( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:30, from = "x", to = "y", med = "m" ) plot(med) # Methods ------------------------------------------------------------------- # Med has a number of methods including # print, summary, and plot med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) print(med) summary(med) plot(med)
ctmeddelta
Plot Method for an Object of Class ctmeddelta
## S3 method for class 'ctmeddelta' plot(x, alpha = 0.05, col = NULL, ...)
## S3 method for class 'ctmeddelta' plot(x, alpha = 0.05, col = NULL, ...)
x |
Object of class |
alpha |
Numeric. Significance level |
col |
Character vector. Optional argument. Character vector of colors. |
... |
Additional arguments. |
Displays plots of point estimates and confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) plot(delta)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) plot(delta)
ctmedmc
Plot Method for an Object of Class ctmedmc
## S3 method for class 'ctmedmc' plot(x, alpha = 0.05, col = NULL, ...)
## S3 method for class 'ctmedmc' plot(x, alpha = 0.05, col = NULL, ...)
x |
Object of class |
alpha |
Numeric. Significance level |
col |
Character vector. Optional argument. Character vector of colors. |
... |
Additional arguments. |
Displays plots of point estimates and confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) plot(mc)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) plot(mc)
ctmedmed
Plot Method for an Object of Class ctmedmed
## S3 method for class 'ctmedmed' plot(x, col = NULL, legend_pos = "topright", ...)
## S3 method for class 'ctmedmed' plot(x, col = NULL, legend_pos = "topright", ...)
x |
Object of class |
col |
Character vector. Optional argument. Character vector of colors. |
legend_pos |
Character vector. Optional argument. Legend position. |
... |
Additional arguments. |
Displays plots of point estimates and confidence intervals.
Ivan Jacob Agaloos Pesigan
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") # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) plot(med)
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") # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) plot(med)
ctmedtraj
Plot Method for an Object of Class ctmedtraj
## S3 method for class 'ctmedtraj' plot(x, legend_pos = "topright", total = TRUE, ...)
## S3 method for class 'ctmedtraj' plot(x, legend_pos = "topright", total = TRUE, ...)
x |
Object of class |
legend_pos |
Character vector. Optional argument. Legend position. |
total |
Logical.
If |
... |
Additional arguments. |
Displays trajectory plots of the effects.
Ivan Jacob Agaloos Pesigan
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)
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)
This function generates a posterior
sampling distribution
for the elements of the matrix of lagged coefficients
over a specific time interval
or a range of time intervals
using the first-order stochastic differential equation model
drift matrix
.
PosteriorBeta(phi, delta_t, ncores = NULL)
PosteriorBeta(phi, delta_t, ncores = NULL)
phi |
Numeric matrix.
The drift matrix ( |
delta_t |
Numeric.
Time interval
( |
ncores |
Positive integer.
Number of cores to use.
If |
See Total()
.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("PosteriorBeta").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
A vector of total, direct, and indirect effects.
A matrix of Monte Carlo total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorBeta( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorBeta( phi = phi, delta_t = 1:5 ) plot(posterior) # Methods ------------------------------------------------------------------- # PosteriorBeta has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorBeta( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorBeta( phi = phi, delta_t = 1:5 ) plot(posterior) # Methods ------------------------------------------------------------------- # PosteriorBeta has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
This function generates a posterior
distribution
of the indirect effect centrality
over a specific time interval
or a range of time intervals
using the posterior distribution
of the first-order stochastic differential equation model
drift matrix
.
PosteriorIndirectCentral(phi, delta_t, ncores = NULL)
PosteriorIndirectCentral(phi, delta_t, ncores = NULL)
phi |
List of numeric matrices.
Each element of the list is a sample
from the posterior distribution
of the drift matrix ( |
delta_t |
Numeric.
Time interval
( |
ncores |
Positive integer.
Number of cores to use.
If |
See TotalCentral()
for more details.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("PosteriorIndirectCentral").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
Mean of the posterior distribution of the total, direct, and indirect effects.
Posterior distribution of the total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorIndirectCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorIndirectCentral( phi = phi, delta_t = 1:5 ) # Methods ------------------------------------------------------------------- # PosteriorIndirectCentral has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorIndirectCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorIndirectCentral( phi = phi, delta_t = 1:5 ) # Methods ------------------------------------------------------------------- # PosteriorIndirectCentral has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
This function generates a posterior
distribution
of the total, direct and indirect effects
of the independent variable
on the dependent variable
through mediator variables
over a specific time interval
or a range of time intervals
using the posterior distribution
of the first-order stochastic differential equation model
drift matrix
.
PosteriorMed(phi, delta_t, from, to, med, ncores = NULL)
PosteriorMed(phi, delta_t, from, to, med, ncores = NULL)
phi |
List of numeric matrices.
Each element of the list is a sample
from the posterior distribution
of the drift matrix ( |
delta_t |
Numeric.
Time interval
( |
from |
Character string.
Name of the independent variable |
to |
Character string.
Name of the dependent variable |
med |
Character vector.
Name/s of the mediator variable/s in |
ncores |
Positive integer.
Number of cores to use.
If |
See Total()
,
Direct()
, and
Indirect()
for more details.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("PosteriorMed").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
Mean of the posterior distribution of the total, direct, and indirect effects.
Posterior distribution of the total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorMed( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorMed( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) # Methods ------------------------------------------------------------------- # PosteriorMed has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorMed( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorMed( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) # Methods ------------------------------------------------------------------- # PosteriorMed has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
The function extracts the posterior samples
of the drift matrix from a fitted model
from the ctsem::ctStanFit()
function.
PosteriorPhi(object)
PosteriorPhi(object)
object |
Object of class |
Returns an object
of class ctmedposteriorphi
which is a list drift matrices
sampled from the posterior distribution.
Ivan Jacob Agaloos Pesigan
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorTotalCentral()
,
Total()
,
TotalCentral()
,
Trajectory()
This function generates a posterior
distribution
of the total effect centrality
over a specific time interval
or a range of time intervals
using the posterior distribution
of the first-order stochastic differential equation model
drift matrix
.
PosteriorTotalCentral(phi, delta_t, ncores = NULL)
PosteriorTotalCentral(phi, delta_t, ncores = NULL)
phi |
List of numeric matrices.
Each element of the list is a sample
from the posterior distribution
of the drift matrix ( |
delta_t |
Numeric.
Time interval
( |
ncores |
Positive integer.
Number of cores to use.
If |
See TotalCentral()
for more details.
Returns an object
of class ctmedmc
which is a list with the following elements:
Function call.
Function arguments.
Function used ("PosteriorTotalCentral").
A list the length of which is equal to
the length of delta_t
.
Each element in the output
list has the following elements:
Mean of the posterior distribution of the total, direct, and indirect effects.
Posterior distribution of the total, direct, and indirect effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
Total()
,
TotalCentral()
,
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorTotalCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorTotalCentral( phi = phi, delta_t = 1:5 ) # Methods ------------------------------------------------------------------- # PosteriorTotalCentral has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) phi <- MCPhi( phi = phi, vcov_phi_vec = vcov_phi_vec, R = 1000L )$output # Specific time interval ---------------------------------------------------- PosteriorTotalCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- posterior <- PosteriorTotalCentral( phi = phi, delta_t = 1:5 ) # Methods ------------------------------------------------------------------- # PosteriorTotalCentral has a number of methods including # print, summary, confint, and plot print(posterior) summary(posterior) confint(posterior, level = 0.95) plot(posterior)
ctmeddelta
Print Method for Object of Class ctmeddelta
## S3 method for class 'ctmeddelta' print(x, alpha = 0.05, digits = 4, ...)
## S3 method for class 'ctmeddelta' print(x, alpha = 0.05, digits = 4, ...)
x |
an object of class |
alpha |
Numeric vector.
Significance level |
digits |
Integer indicating the number of decimal places to display. |
... |
further arguments. |
Prints a list of matrices of time intervals, estimates, standard errors, test statistics, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) print(delta) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) print(delta)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) print(delta) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) print(delta)
ctmedeffect
Print Method for Object of Class ctmedeffect
## S3 method for class 'ctmedeffect' print(x, digits = 4, ...)
## S3 method for class 'ctmedeffect' print(x, digits = 4, ...)
x |
an object of class |
digits |
Integer indicating the number of decimal places to display. |
... |
further arguments. |
Prints the effects.
Ivan Jacob Agaloos Pesigan
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 # Time Interval of One ----------------------------------------------------- ## Total Effect ------------------------------------------------------------ total_dt <- Total( phi = phi, delta_t = delta_t ) print(total_dt) ## Direct Effect ----------------------------------------------------------- direct_dt <- Direct( phi = phi, delta_t = delta_t, from = "x", to = "y", med = "m" ) print(direct_dt) ## Indirect Effect --------------------------------------------------------- indirect_dt <- Indirect( phi = phi, delta_t = delta_t, from = "x", to = "y", med = "m" ) print(indirect_dt)
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 # Time Interval of One ----------------------------------------------------- ## Total Effect ------------------------------------------------------------ total_dt <- Total( phi = phi, delta_t = delta_t ) print(total_dt) ## Direct Effect ----------------------------------------------------------- direct_dt <- Direct( phi = phi, delta_t = delta_t, from = "x", to = "y", med = "m" ) print(direct_dt) ## Indirect Effect --------------------------------------------------------- indirect_dt <- Indirect( phi = phi, delta_t = delta_t, from = "x", to = "y", med = "m" ) print(indirect_dt)
ctmedmc
Print Method for Object of Class ctmedmc
## S3 method for class 'ctmedmc' print(x, alpha = 0.05, digits = 4, ...)
## S3 method for class 'ctmedmc' print(x, alpha = 0.05, digits = 4, ...)
x |
an object of class |
alpha |
Numeric vector.
Significance level |
digits |
Integer indicating the number of decimal places to display. |
... |
further arguments. |
Prints a list of matrices of time intervals, estimates, standard errors, number of Monte Carlo replications, and confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) print(mc) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) print(mc)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) print(mc) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) print(mc)
ctmedmcphi
Print Method for Object of Class ctmedmcphi
## S3 method for class 'ctmedmcphi' print(x, digits = 4, ...)
## S3 method for class 'ctmedmcphi' print(x, digits = 4, ...)
x |
an object of class |
digits |
Integer indicating the number of decimal places to display. |
... |
further arguments. |
Prints a list of drift matrices.
Ivan Jacob Agaloos Pesigan
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") mc <- MCPhi( phi = phi, vcov_phi_vec = 0.1 * diag(9), R = 100L # use a large value for R in actual research ) print(mc)
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") mc <- MCPhi( phi = phi, vcov_phi_vec = 0.1 * diag(9), R = 100L # use a large value for R in actual research ) print(mc)
ctmedmed
Print Method for Object of Class ctmedmed
## S3 method for class 'ctmedmed' print(x, digits = 4, ...)
## S3 method for class 'ctmedmed' print(x, digits = 4, ...)
x |
an object of class |
digits |
Integer indicating the number of decimal places to display. |
... |
further arguments. |
Prints a matrix of effects.
Ivan Jacob Agaloos Pesigan
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") # Specific time interval ---------------------------------------------------- med <- Med( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) print(med) # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) print(med)
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") # Specific time interval ---------------------------------------------------- med <- Med( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) print(med) # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) print(med)
ctmedtraj
Print Method for Object of Class ctmedtraj
## S3 method for class 'ctmedtraj' print(x, ...)
## S3 method for class 'ctmedtraj' print(x, ...)
x |
an object of class |
... |
further arguments. |
Prints a data frame of simulated data.
Ivan Jacob Agaloos Pesigan
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" ) print(traj)
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" ) print(traj)
ctmeddelta
Summary Method for an Object of Class ctmeddelta
## S3 method for class 'ctmeddelta' summary(object, alpha = 0.05, ...)
## S3 method for class 'ctmeddelta' summary(object, alpha = 0.05, ...)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
... |
additional arguments. |
Returns a data frame of effects, time intervals, estimates, standard errors, test statistics, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) summary(delta) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) summary(delta)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m" ) summary(delta) # Range of time intervals --------------------------------------------------- delta <- DeltaMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m" ) summary(delta)
ctmedmc
Summary Method for an Object of Class ctmedmc
## S3 method for class 'ctmedmc' summary(object, alpha = 0.05, ...)
## S3 method for class 'ctmedmc' summary(object, alpha = 0.05, ...)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
... |
additional arguments. |
Returns a data frame of effects, time intervals, estimates, standard errors, number of Monte Carlo replications, and confidence intervals.
Ivan Jacob Agaloos Pesigan
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) summary(mc) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) summary(mc)
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") vcov_phi_vec <- matrix( data = c( 0.002704274, -0.001475275, 0.000949122, -0.001619422, 0.000885122, -0.000569404, 0.00085493, -0.000465824, 0.000297815, -0.001475275, 0.004428442, -0.002642303, 0.000980573, -0.00271817, 0.001618805, -0.000586921, 0.001478421, -0.000871547, 0.000949122, -0.002642303, 0.006402668, -0.000697798, 0.001813471, -0.004043138, 0.000463086, -0.001120949, 0.002271711, -0.001619422, 0.000980573, -0.000697798, 0.002079286, -0.001152501, 0.000753, -0.001528701, 0.000820587, -0.000517524, 0.000885122, -0.00271817, 0.001813471, -0.001152501, 0.00342605, -0.002075005, 0.000899165, -0.002532849, 0.001475579, -0.000569404, 0.001618805, -0.004043138, 0.000753, -0.002075005, 0.004984032, -0.000622255, 0.001634917, -0.003705661, 0.00085493, -0.000586921, 0.000463086, -0.001528701, 0.000899165, -0.000622255, 0.002060076, -0.001096684, 0.000686386, -0.000465824, 0.001478421, -0.001120949, 0.000820587, -0.002532849, 0.001634917, -0.001096684, 0.003328692, -0.001926088, 0.000297815, -0.000871547, 0.002271711, -0.000517524, 0.001475579, -0.003705661, 0.000686386, -0.001926088, 0.004726235 ), nrow = 9 ) # Specific time interval ---------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) summary(mc) # Range of time intervals --------------------------------------------------- mc <- MCMed( phi = phi, vcov_phi_vec = vcov_phi_vec, delta_t = 1:5, from = "x", to = "y", med = "m", R = 100L # use a large value for R in actual research ) summary(mc)
ctmedmed
Summary Method for an Object of Class ctmedmed
## S3 method for class 'ctmedmed' summary(object, digits = 4, ...)
## S3 method for class 'ctmedmed' summary(object, digits = 4, ...)
object |
an object of class |
digits |
Integer indicating the number of decimal places to display. |
... |
further arguments. |
Returns a matrix of effects.
Ivan Jacob Agaloos Pesigan
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") # Specific time interval ---------------------------------------------------- med <- Med( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) summary(med) # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) summary(med)
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") # Specific time interval ---------------------------------------------------- med <- Med( phi = phi, delta_t = 1, from = "x", to = "y", med = "m" ) summary(med) # Range of time intervals --------------------------------------------------- med <- Med( phi = phi, delta_t = 1:5, from = "x", to = "y", med = "m" ) summary(med)
ctmedposteriorphi
Summary Method for Object of Class ctmedposteriorphi
## S3 method for class 'ctmedposteriorphi' summary(object, ...)
## S3 method for class 'ctmedposteriorphi' summary(object, ...)
object |
an object of class |
... |
further arguments. |
Returns a list of the posterior means (in matrix form) and covariance matrix.
Ivan Jacob Agaloos Pesigan
ctmedtraj
Summary Method for an Object of Class ctmedtraj
## S3 method for class 'ctmedtraj' summary(object, ...)
## S3 method for class 'ctmedtraj' summary(object, ...)
object |
an object of class |
... |
further arguments. |
Returns a data frame of simulated data.
Ivan Jacob Agaloos Pesigan
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" ) summary(traj)
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" ) summary(traj)
This function computes the total effects matrix
over a specific time interval
using the first-order stochastic differential equation model's
drift matrix
.
Total(phi, delta_t)
Total(phi, delta_t)
phi |
Numeric matrix.
The drift matrix ( |
delta_t |
Numeric.
Time interval
( |
The total effect matrix
over a specific time interval
is given by
where
denotes the drift matrix, and
the time interval.
The measurement model is given by
where
,
,
and
are random variables
and
,
,
and
are model parameters.
represents a vector of observed random variables,
a vector of latent random variables,
and
a vector of random measurement errors,
at time
and individual
.
denotes a vector of intercepts,
a matrix of factor loadings,
and
the covariance matrix of
.
An alternative representation of the measurement error is given by
where
is a vector of
independent standard normal random variables and
The dynamic structure is given by
where
is a term which is unobserved and constant over time,
is the drift matrix
which represents the rate of change of the solution
in the absence of any random fluctuations,
is the matrix of volatility
or randomness in the process, and
is a Wiener process or Brownian motion,
which represents random fluctuations.
Returns an object
of class ctmedeffect
which is a list with the following elements:
Function call.
Function arguments.
Function used ("Total").
The matrix of total effects.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
TotalCentral()
,
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 Total( phi = phi, delta_t = delta_t ) 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) Total( phi = phi, delta_t = delta_t )
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 Total( phi = phi, delta_t = delta_t ) 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) Total( phi = phi, delta_t = delta_t )
Total Effect Centrality
TotalCentral(phi, delta_t)
TotalCentral(phi, delta_t)
phi |
Numeric matrix.
The drift matrix ( |
delta_t |
Vector of positive numbers.
Time interval
( |
The total effect centrality of a variable is the sum of the total effects of a variable on all other variables at a particular time interval.
Returns an object
of class ctmedmed
which is a list with the following elements:
Function call.
Function arguments.
Function used ("TotalCentral").
A matrix of total effect centrality.
Ivan Jacob Agaloos Pesigan
Bollen, K. A. (1987). Total, direct, and indirect effects in structural equation models. Sociological Methodology, 17, 37. 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. 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. doi:10.1007/s11336-021-09767-0
Other Continuous Time Mediation Functions:
DeltaBeta()
,
DeltaIndirectCentral()
,
DeltaMed()
,
DeltaTotalCentral()
,
Direct()
,
Indirect()
,
IndirectCentral()
,
MCBeta()
,
MCIndirectCentral()
,
MCMed()
,
MCPhi()
,
MCTotalCentral()
,
Med()
,
PosteriorBeta()
,
PosteriorIndirectCentral()
,
PosteriorMed()
,
PosteriorPhi()
,
PosteriorTotalCentral()
,
Total()
,
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") # Specific time interval ---------------------------------------------------- TotalCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- total_central <- TotalCentral( phi = phi, delta_t = 1:30 ) plot(total_central) # Methods ------------------------------------------------------------------- # TotalCentral has a number of methods including # print, summary, and plot total_central <- TotalCentral( phi = phi, delta_t = 1:5 ) print(total_central) summary(total_central) plot(total_central)
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") # Specific time interval ---------------------------------------------------- TotalCentral( phi = phi, delta_t = 1 ) # Range of time intervals --------------------------------------------------- total_central <- TotalCentral( phi = phi, delta_t = 1:30 ) plot(total_central) # Methods ------------------------------------------------------------------- # TotalCentral has a number of methods including # print, summary, and plot total_central <- TotalCentral( phi = phi, delta_t = 1:5 ) print(total_central) summary(total_central) plot(total_central)
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)
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)
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)