Skip to contents

This function generates a bootstrap method sampling distribution for the indirect effect centrality over a specific time interval \(\Delta t\) or a range of time intervals using the first-order stochastic differential equation model drift matrix \(\boldsymbol{\Phi}\).

Usage

BootIndirectCentral(phi, phi_hat, delta_t, ncores = NULL, tol = 0.01)

Arguments

phi

List of numeric matrices. Each element of the list is a bootstrap estimate of the drift matrix (\(\boldsymbol{\Phi}\)).

phi_hat

Numeric matrix. The estimated drift matrix (\(\hat{\boldsymbol{\Phi}}\)) from the original data set. phi_hat should have row and column names pertaining to the variables in the system.

delta_t

Numeric. Time interval (\(\Delta t\)).

ncores

Positive integer. Number of cores to use. If ncores = NULL, use a single core. Consider using multiple cores when number of replications R is a large value.

tol

Numeric. Smallest possible time interval to allow.

Value

Returns an object of class ctmedboot which is a list with the following elements:

call

Function call.

args

Function arguments.

fun

Function used ("BootIndirectCentral").

output

A list with length of length(delta_t).

Each element in the output list has the following elements:

est

A vector of indirect effect centrality.

thetahatstar

A matrix of bootstrap indirect effect centrality.

Details

See IndirectCentral() more details.

References

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

Author

Ivan Jacob Agaloos Pesigan

Examples

# \donttest{
library(bootStateSpace)
# prepare parameters
## number of individuals
n <- 50
## time points
time <- 100
delta_t <- 0.10
## dynamic structure
p <- 3
mu0 <- rep(x = 0, times = p)
sigma0 <- matrix(
  data = c(
    1.0,
    0.2,
    0.2,
    0.2,
    1.0,
    0.2,
    0.2,
    0.2,
    1.0
  ),
  nrow = p
)
sigma0_l <- t(chol(sigma0))
mu <- rep(x = 0, times = p)
phi <- matrix(
  data = c(
    -0.357,
    0.771,
    -0.450,
    0.0,
    -0.511,
    0.729,
    0,
    0,
    -0.693
  ),
  nrow = p
)
sigma <- matrix(
  data = c(
    0.24455556,
    0.02201587,
    -0.05004762,
    0.02201587,
    0.07067800,
    0.01539456,
    -0.05004762,
    0.01539456,
    0.07553061
  ),
  nrow = p
)
sigma_l <- t(chol(sigma))
## measurement model
k <- 3
nu <- rep(x = 0, times = k)
lambda <- diag(k)
theta <- 0.2 * diag(k)
theta_l <- t(chol(theta))

boot <- PBSSMOUFixed(
  R = 10L, # use at least 1000 in actual research
  path = getwd(),
  prefix = "ou",
  n = n,
  time = time,
  delta_t = delta_t,
  mu0 = mu0,
  sigma0_l = sigma0_l,
  mu = mu,
  phi = phi,
  sigma_l = sigma_l,
  nu = nu,
  lambda = lambda,
  theta_l = theta_l,
  ncores = NULL, # consider using multiple cores
  seed = 42
)
phi_hat <- phi
colnames(phi_hat) <- rownames(phi_hat) <- c("x", "m", "y")
phi <- extract(object = boot, what = "phi")

# Specific time interval ----------------------------------------------------
BootIndirectCentral(
  phi = phi,
  phi_hat = phi_hat,
  delta_t = 1
)
#> 
#> Indirect Effect Centrality
#> type = pc
#> $`1`
#>   interval    est     se  R    2.5%  97.5%
#> x        1 0.0000 0.0199 10 -0.0369 0.0226
#> m        1 0.1674 0.0140 10  0.1435 0.1824
#> y        1 0.0000 0.0128 10 -0.0216 0.0183
#> 

# Range of time intervals ---------------------------------------------------
boot <- BootIndirectCentral(
  phi = phi,
  phi_hat = phi_hat,
  delta_t = 1:5
)
plot(boot)



plot(boot, type = "bc") # bias-corrected




# Methods -------------------------------------------------------------------
# BootIndirectCentral has a number of methods including
# print, summary, confint, and plot
print(boot)
#> 
#> Indirect Effect Centrality
#> type = pc
#> $`1`
#>   interval    est     se  R    2.5%  97.5%
#> x        1 0.0000 0.0199 10 -0.0369 0.0226
#> m        1 0.1674 0.0140 10  0.1435 0.1824
#> y        1 0.0000 0.0128 10 -0.0216 0.0183
#> 
#> $`2`
#>   interval    est     se  R    2.5%  97.5%
#> x        2 0.0000 0.0367 10 -0.0675 0.0439
#> m        2 0.4008 0.0366 10  0.3386 0.4386
#> y        2 0.0000 0.0302 10 -0.0525 0.0405
#> 
#> $`3`
#>   interval    est     se  R    2.5%  97.5%
#> x        3 0.0000 0.0399 10 -0.0712 0.0515
#> m        3 0.5423 0.0563 10  0.4484 0.6037
#> y        3 0.0000 0.0459 10 -0.0823 0.0539
#> 
#> $`4`
#>   interval    est     se  R    2.5%  97.5%
#> x        4 0.0000 0.0379 10 -0.0666 0.0505
#> m        4 0.5823 0.0687 10  0.4716 0.6655
#> y        4 0.0000 0.0616 10 -0.1127 0.0649
#> 
#> $`5`
#>   interval    est     se  R    2.5%  97.5%
#> x        5 0.0000 0.0362 10 -0.0607 0.0469
#> m        5 0.5521 0.0739 10  0.4323 0.6466
#> y        5 0.0000 0.0766 10 -0.1430 0.0738
#> 
summary(boot)
#>    variable interval           est         se  R        2.5%      97.5%
#> 1         x        1  0.000000e+00 0.01985940 10 -0.03685723 0.02255445
#> 2         m        1  1.674155e-01 0.01404908 10  0.14353163 0.18235696
#> 3         y        1  0.000000e+00 0.01279882 10 -0.02161436 0.01829366
#> 4         x        2  0.000000e+00 0.03667352 10 -0.06749959 0.04393447
#> 5         m        2  4.008043e-01 0.03658546 10  0.33856442 0.43863339
#> 6         y        2  0.000000e+00 0.03015230 10 -0.05245187 0.04049064
#> 7         x        3  0.000000e+00 0.03992476 10 -0.07116880 0.05146955
#> 8         m        3  5.422564e-01 0.05629083 10  0.44836139 0.60367832
#> 9         y        3 -3.330669e-16 0.04593961 10 -0.08234621 0.05392738
#> 10        x        4  0.000000e+00 0.03791042 10 -0.06661947 0.05051417
#> 11        m        4  5.823179e-01 0.06869160 10  0.47156366 0.66550030
#> 12        y        4  0.000000e+00 0.06156756 10 -0.11273763 0.06492942
#> 13        x        5  0.000000e+00 0.03616999 10 -0.06069927 0.04685244
#> 14        m        5  5.520985e-01 0.07392980 10  0.43230658 0.64658607
#> 15        y        5  0.000000e+00 0.07657344 10 -0.14303981 0.07380935
confint(boot, level = 0.95)
#>    variable interval       2.5 %     97.5 %
#> 1         x        1 -0.03685723 0.02255445
#> 2         m        1  0.14353163 0.18235696
#> 3         y        1 -0.02161436 0.01829366
#> 4         x        2 -0.06749959 0.04393447
#> 5         m        2  0.33856442 0.43863339
#> 6         y        2 -0.05245187 0.04049064
#> 7         x        3 -0.07116880 0.05146955
#> 8         m        3  0.44836139 0.60367832
#> 9         y        3 -0.08234621 0.05392738
#> 10        x        4 -0.06661947 0.05051417
#> 11        m        4  0.47156366 0.66550030
#> 12        y        4 -0.11273763 0.06492942
#> 13        x        5 -0.06069927 0.04685244
#> 14        m        5  0.43230658 0.64658607
#> 15        y        5 -0.14303981 0.07380935
print(boot, type = "bc") # bias-corrected
#> 
#> Indirect Effect Centrality
#> type = bc
#> $`1`
#>   interval    est     se  R    2.5%  97.5%
#> x        1 0.0000 0.0199 10 -0.0369 0.0226
#> m        1 0.1674 0.0140 10  0.1445 0.1832
#> y        1 0.0000 0.0128 10 -0.0216 0.0183
#> 
#> $`2`
#>   interval    est     se  R    2.5%  97.5%
#> x        2 0.0000 0.0367 10 -0.0675 0.0439
#> m        2 0.4008 0.0366 10  0.3392 0.4391
#> y        2 0.0000 0.0302 10 -0.0525 0.0405
#> 
#> $`3`
#>   interval    est     se  R    2.5%  97.5%
#> x        3 0.0000 0.0399 10 -0.0712 0.0515
#> m        3 0.5423 0.0563 10  0.4432 0.5936
#> y        3 0.0000 0.0459 10 -0.0823 0.0539
#> 
#> $`4`
#>   interval    est     se  R    2.5%  97.5%
#> x        4 0.0000 0.0379 10 -0.0585 0.0542
#> m        4 0.5823 0.0687 10  0.4586 0.6409
#> y        4 0.0000 0.0616 10 -0.1127 0.0649
#> 
#> $`5`
#>   interval    est     se  R    2.5%  97.5%
#> x        5 0.0000 0.0362 10 -0.0607 0.0469
#> m        5 0.5521 0.0739 10  0.4167 0.6273
#> y        5 0.0000 0.0766 10 -0.1430 0.0738
#> 
summary(boot, type = "bc")
#>    variable interval           est         se  R        2.5%      97.5%
#> 1         x        1  0.000000e+00 0.01985940 10 -0.03685723 0.02255445
#> 2         m        1  1.674155e-01 0.01404908 10  0.14445643 0.18324920
#> 3         y        1  0.000000e+00 0.01279882 10 -0.02161436 0.01829366
#> 4         x        2  0.000000e+00 0.03667352 10 -0.06749959 0.04393447
#> 5         m        2  4.008043e-01 0.03658546 10  0.33921616 0.43914357
#> 6         y        2  0.000000e+00 0.03015230 10 -0.05245187 0.04049064
#> 7         x        3  0.000000e+00 0.03992476 10 -0.07116880 0.05146955
#> 8         m        3  5.422564e-01 0.05629083 10  0.44315433 0.59361883
#> 9         y        3 -3.330669e-16 0.04593961 10 -0.08234621 0.05392738
#> 10        x        4  0.000000e+00 0.03791042 10 -0.05845978 0.05418397
#> 11        m        4  5.823179e-01 0.06869160 10  0.45858979 0.64093404
#> 12        y        4  0.000000e+00 0.06156756 10 -0.11273763 0.06492942
#> 13        x        5  0.000000e+00 0.03616999 10 -0.06069927 0.04685244
#> 14        m        5  5.520985e-01 0.07392980 10  0.41668699 0.62734953
#> 15        y        5  0.000000e+00 0.07657344 10 -0.14303981 0.07380935
confint(boot, level = 0.95, type = "bc")
#>    variable interval       2.5 %     97.5 %
#> 1         x        1 -0.03685723 0.02255445
#> 2         m        1  0.14445643 0.18324920
#> 3         y        1 -0.02161436 0.01829366
#> 4         x        2 -0.06749959 0.04393447
#> 5         m        2  0.33921616 0.43914357
#> 6         y        2 -0.05245187 0.04049064
#> 7         x        3 -0.07116880 0.05146955
#> 8         m        3  0.44315433 0.59361883
#> 9         y        3 -0.08234621 0.05392738
#> 10        x        4 -0.05845978 0.05418397
#> 11        m        4  0.45858979 0.64093404
#> 12        y        4 -0.11273763 0.06492942
#> 13        x        5 -0.06069927 0.04685244
#> 14        m        5  0.41668699 0.62734953
#> 15        y        5 -0.14303981 0.07380935
# }