Sampling Covariance Matrix of the Parameter Estimates
Usage
# S3 method for class 'semmcci'
vcov(object, ...)
Examples
library(semmcci)
library(lavaan)
# Data ---------------------------------------------------------------------
data("Tal.Or", package = "psych")
df <- mice::ampute(Tal.Or)$amp
# Monte Carlo --------------------------------------------------------------
## Fit Model in lavaan -----------------------------------------------------
model <- "
reaction ~ cp * cond + b * pmi
pmi ~ a * cond
cond ~~ cond
indirect := a * b
direct := cp
total := cp + (a * b)
"
fit <- sem(data = df, model = model, missing = "fiml")
## MC() --------------------------------------------------------------------
unstd <- MC(
fit,
R = 5L # use a large value e.g., 20000L for actual research
)
## Standardized Monte Carlo ------------------------------------------------
std <- MCStd(unstd)
vcov(unstd)
#> cp b a cond~~cond
#> cp 0.039066492 0.011698379 0.032755477 -0.0017620634
#> b 0.011698379 0.007359478 0.012554745 -0.0017313998
#> a 0.032755477 0.012554745 0.095823511 -0.0036958106
#> cond~~cond -0.001762063 -0.001731400 -0.003695811 0.0006816860
#> reaction~~reaction -0.016327532 0.002206287 0.074637300 -0.0029311596
#> pmi~~pmi -0.009875306 -0.013608940 -0.035057700 0.0077099882
#> reaction~1 -0.098351989 -0.051901820 -0.125542595 0.0110416113
#> pmi~1 -0.025565788 -0.007581380 -0.041565735 0.0023157837
#> cond~1 0.001287613 -0.001532645 0.002768928 0.0004349964
#> indirect 0.019990765 0.009414656 0.046710595 -0.0024531684
#> direct 0.039066492 0.011698379 0.032755477 -0.0017620634
#> total 0.059057256 0.021113035 0.079466072 -0.0042152318
#> reaction~~reaction pmi~~pmi reaction~1 pmi~1
#> cp -0.016327532 -0.009875306 -0.09835199 -0.025565788
#> b 0.002206287 -0.013608940 -0.05190182 -0.007581380
#> a 0.074637300 -0.035057700 -0.12554259 -0.041565735
#> cond~~cond -0.002931160 0.007709988 0.01104161 0.002315784
#> reaction~~reaction 0.124635693 -0.034999087 -0.03540257 -0.013500247
#> pmi~~pmi -0.034999087 0.100799559 0.07760014 0.025880432
#> reaction~1 -0.035402571 0.077600144 0.39397526 0.068441764
#> pmi~1 -0.013500247 0.025880432 0.06844176 0.025868832
#> cond~1 -0.000291130 0.003320815 0.00688657 -0.001975610
#> indirect 0.032555222 -0.020999304 -0.08190777 -0.021056066
#> direct -0.016327532 -0.009875306 -0.09835199 -0.025565788
#> total 0.016227690 -0.030874610 -0.18025976 -0.046621854
#> cond~1 indirect direct total
#> cp 0.0012876130 0.0199907648 0.039066492 0.059057256
#> b -0.0015326450 0.0094146561 0.011698379 0.021113035
#> a 0.0027689279 0.0467105950 0.032755477 0.079466072
#> cond~~cond 0.0004349964 -0.0024531684 -0.001762063 -0.004215232
#> reaction~~reaction -0.0002911300 0.0325552218 -0.016327532 0.016227690
#> pmi~~pmi 0.0033208155 -0.0209993043 -0.009875306 -0.030874610
#> reaction~1 0.0068865701 -0.0819077662 -0.098351989 -0.180259755
#> pmi~1 -0.0019756100 -0.0210560659 -0.025565788 -0.046621854
#> cond~1 0.0011464897 0.0002012974 0.001287613 0.001488910
#> indirect 0.0002012974 0.0247069130 0.019990765 0.044697678
#> direct 0.0012876130 0.0199907648 0.039066492 0.059057256
#> total 0.0014889104 0.0446976778 0.059057256 0.103754934
vcov(std)
#> cp b a cond~~cond
#> cp 3.460117e-03 2.036484e-03 2.045780e-03 5.773842e-18
#> b 2.036484e-03 3.301461e-03 -1.084031e-03 3.668813e-18
#> a 2.045780e-03 -1.084031e-03 1.218633e-02 4.382161e-18
#> cond~~cond 5.773842e-18 3.668813e-18 4.382161e-18 3.081488e-32
#> reaction~~reaction -3.202985e-03 -3.208808e-03 -1.592471e-03 -5.698818e-18
#> pmi~~pmi -4.916690e-04 -6.041327e-05 -2.236996e-03 -1.179362e-18
#> indirect 1.237260e-03 1.359394e-04 5.071720e-03 2.555414e-18
#> direct 3.460117e-03 2.036484e-03 2.045780e-03 5.773842e-18
#> total 4.697378e-03 2.172423e-03 7.117500e-03 8.329256e-18
#> reaction~~reaction pmi~~pmi indirect direct
#> cp -3.202985e-03 -4.916690e-04 1.237260e-03 3.460117e-03
#> b -3.208808e-03 -6.041327e-05 1.359394e-04 2.036484e-03
#> a -1.592471e-03 -2.236996e-03 5.071720e-03 2.045780e-03
#> cond~~cond -5.698818e-18 -1.179362e-18 2.555414e-18 5.773842e-18
#> reaction~~reaction 3.951007e-03 5.388739e-04 -1.268497e-03 -3.202985e-03
#> pmi~~pmi 5.388739e-04 4.351741e-04 -9.794623e-04 -4.916690e-04
#> indirect -1.268497e-03 -9.794623e-04 2.218579e-03 1.237260e-03
#> direct -3.202985e-03 -4.916690e-04 1.237260e-03 3.460117e-03
#> total -4.471482e-03 -1.471131e-03 3.455840e-03 4.697378e-03
#> total
#> cp 4.697378e-03
#> b 2.172423e-03
#> a 7.117500e-03
#> cond~~cond 8.329256e-18
#> reaction~~reaction -4.471482e-03
#> pmi~~pmi -1.471131e-03
#> indirect 3.455840e-03
#> direct 4.697378e-03
#> total 8.153217e-03
# Monte Carlo (Multiple Imputation) ----------------------------------------
## Multiple Imputation -----------------------------------------------------
mi <- mice::mice(
data = df,
print = FALSE,
m = 5L, # use a large value e.g., 100L for actual research,
seed = 42
)
## Fit Model in lavaan -----------------------------------------------------
fit <- sem(data = df, model = model) # use default listwise deletion
## MCMI() ------------------------------------------------------------------
unstd <- MCMI(
fit,
mi = mi,
R = 5L # use a large value e.g., 20000L for actual research
)
## Standardized Monte Carlo ------------------------------------------------
std <- MCStd(unstd)
vcov(unstd)
#> cp b a cond~~cond
#> cp 0.128087046 -0.0161556549 0.0756512619 -0.0041343946
#> b -0.016155655 0.0068229557 -0.0081532762 -0.0010351199
#> a 0.075651262 -0.0081532762 0.0736680253 -0.0003130791
#> cond~~cond -0.004134395 -0.0010351199 -0.0003130791 0.0011053446
#> reaction~~reaction -0.061111597 0.0076534803 -0.0267373109 0.0023861218
#> pmi~~pmi 0.005690506 -0.0049090291 0.0214524821 0.0021034157
#> indirect 0.029143382 -0.0005202855 0.0304357228 -0.0010323438
#> direct 0.128087046 -0.0161556549 0.0756512619 -0.0041343946
#> total 0.157230428 -0.0166759404 0.1060869847 -0.0051667384
#> reaction~~reaction pmi~~pmi indirect direct
#> cp -0.061111597 0.005690506 0.0291433820 0.128087046
#> b 0.007653480 -0.004909029 -0.0005202855 -0.016155655
#> a -0.026737311 0.021452482 0.0304357228 0.075651262
#> cond~~cond 0.002386122 0.002103416 -0.0010323438 -0.004134395
#> reaction~~reaction 0.033102670 0.005250205 -0.0095637948 -0.061111597
#> pmi~~pmi 0.005250205 0.019852649 0.0074651507 0.005690506
#> indirect -0.009563795 0.007465151 0.0141445333 0.029143382
#> direct -0.061111597 0.005690506 0.0291433820 0.128087046
#> total -0.070675391 0.013155657 0.0432879153 0.157230428
#> total
#> cp 0.157230428
#> b -0.016675940
#> a 0.106086985
#> cond~~cond -0.005166738
#> reaction~~reaction -0.070675391
#> pmi~~pmi 0.013155657
#> indirect 0.043287915
#> direct 0.157230428
#> total 0.200518343
vcov(std)
#> cp b a cond~~cond
#> cp 1.452216e-02 -2.047259e-03 8.970993e-03 -9.793753e-18
#> b -2.047259e-03 2.300095e-03 -5.723018e-04 -2.175806e-18
#> a 8.970993e-03 -5.723018e-04 8.996417e-03 -5.161647e-18
#> cond~~cond -9.793753e-18 -2.175806e-18 -5.161647e-18 1.540744e-32
#> reaction~~reaction -1.242452e-04 -1.417564e-03 -1.264103e-03 2.105270e-18
#> pmi~~pmi -3.061503e-03 3.081631e-04 -3.346540e-03 1.431808e-18
#> indirect 3.469278e-03 1.433120e-04 3.653172e-03 -2.574363e-18
#> direct 1.452216e-02 -2.047259e-03 8.970993e-03 -9.793753e-18
#> total 1.799144e-02 -1.903947e-03 1.262417e-02 -1.236812e-17
#> reaction~~reaction pmi~~pmi indirect direct
#> cp -1.242452e-04 -3.061503e-03 3.469278e-03 1.452216e-02
#> b -1.417564e-03 3.081631e-04 1.433120e-04 -2.047259e-03
#> a -1.264103e-03 -3.346540e-03 3.653172e-03 8.970993e-03
#> cond~~cond 2.105270e-18 1.431808e-18 -2.574363e-18 -9.793753e-18
#> reaction~~reaction 1.181544e-03 4.097304e-04 -7.635608e-04 -1.242452e-04
#> pmi~~pmi 4.097304e-04 1.285181e-03 -1.332674e-03 -3.061503e-03
#> indirect -7.635608e-04 -1.332674e-03 1.549249e-03 3.469278e-03
#> direct -1.242452e-04 -3.061503e-03 3.469278e-03 1.452216e-02
#> total -8.878061e-04 -4.394177e-03 5.018526e-03 1.799144e-02
#> total
#> cp 1.799144e-02
#> b -1.903947e-03
#> a 1.262417e-02
#> cond~~cond -1.236812e-17
#> reaction~~reaction -8.878061e-04
#> pmi~~pmi -4.394177e-03
#> indirect 5.018526e-03
#> direct 1.799144e-02
#> total 2.300996e-02