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.125135262 0.013061418 -0.0065597624 -0.0041953422
#> b 0.013061418 0.006585548 0.0026543860 -0.0015173795
#> a -0.006559762 0.002654386 0.0055801794 0.0003611214
#> cond~~cond -0.004195342 -0.001517380 0.0003611214 0.0006702984
#> reaction~~reaction 0.053257525 -0.002417496 -0.0239255156 -0.0030806386
#> pmi~~pmi -0.041884590 -0.011531893 0.0096994127 0.0077945921
#> reaction~1 -0.171811285 -0.045924137 -0.0087045930 0.0108513141
#> pmi~1 0.002473798 -0.003016505 -0.0063146018 0.0002148146
#> cond~1 0.003819982 -0.001703650 -0.0008498995 0.0004304245
#> indirect 0.003120249 0.004146997 0.0034758321 -0.0005766639
#> direct 0.125135262 0.013061418 -0.0065597624 -0.0041953422
#> total 0.128255512 0.017208415 -0.0030839303 -0.0047720061
#> reaction~~reaction pmi~~pmi reaction~1 pmi~1
#> cp 0.0532575254 -0.041884590 -0.171811285 2.473798e-03
#> b -0.0024174963 -0.011531893 -0.045924137 -3.016505e-03
#> a -0.0239255156 0.009699413 -0.008704593 -6.314602e-03
#> cond~~cond -0.0030806386 0.007794592 0.010851314 2.148146e-04
#> reaction~~reaction 0.1396823031 -0.042279748 -0.043395042 3.882915e-02
#> pmi~~pmi -0.0422797478 0.104310776 0.081724666 2.067293e-03
#> reaction~1 -0.0433950421 0.081724666 0.392570185 7.519096e-03
#> pmi~1 0.0388291544 0.002067293 0.007519096 1.365747e-02
#> cond~1 0.0002367733 0.003064736 0.006620248 -5.705291e-05
#> indirect -0.0107376215 -0.001680137 -0.024669376 -3.936370e-03
#> direct 0.0532575254 -0.041884590 -0.171811285 2.473798e-03
#> total 0.0425199038 -0.043564727 -0.196480661 -1.462572e-03
#> cond~1 indirect direct total
#> cp 3.819982e-03 0.0031202495 0.125135262 0.128255512
#> b -1.703650e-03 0.0041469970 0.013061418 0.017208415
#> a -8.498995e-04 0.0034758321 -0.006559762 -0.003083930
#> cond~~cond 4.304245e-04 -0.0005766639 -0.004195342 -0.004772006
#> reaction~~reaction 2.367733e-04 -0.0107376215 0.053257525 0.042519904
#> pmi~~pmi 3.064736e-03 -0.0016801369 -0.041884590 -0.043564727
#> reaction~1 6.620248e-03 -0.0246693764 -0.171811285 -0.196480661
#> pmi~1 -5.705291e-05 -0.0039363704 0.002473798 -0.001462572
#> cond~1 1.164976e-03 -0.0011731708 0.003819982 0.002646811
#> indirect -1.173171e-03 0.0033353806 0.003120249 0.006455630
#> direct 3.819982e-03 0.0031202495 0.125135262 0.128255512
#> total 2.646811e-03 0.0064556301 0.128255512 0.134711142
vcov(std)
#> cp b a cond~~cond
#> cp 1.235279e-02 -1.972837e-03 -5.388231e-04 1.968405e-18
#> b -1.972837e-03 4.813292e-03 1.518648e-03 9.838873e-19
#> a -5.388231e-04 1.518648e-03 5.616189e-04 -7.451041e-19
#> cond~~cond 1.968405e-18 9.838873e-19 -7.451041e-19 1.540744e-32
#> reaction~~reaction -2.407313e-03 -3.532272e-03 -1.155553e-03 -1.358322e-18
#> pmi~~pmi 2.220038e-04 -4.975985e-04 -1.850682e-04 2.724001e-19
#> indirect -6.824198e-04 1.368899e-03 4.641667e-04 -1.805322e-19
#> direct 1.235279e-02 -1.972837e-03 -5.388231e-04 1.968405e-18
#> total 1.167037e-02 -6.039382e-04 -7.465640e-05 1.787873e-18
#> reaction~~reaction pmi~~pmi indirect direct
#> cp -2.407313e-03 2.220038e-04 -6.824198e-04 1.235279e-02
#> b -3.532272e-03 -4.975985e-04 1.368899e-03 -1.972837e-03
#> a -1.155553e-03 -1.850682e-04 4.641667e-04 -5.388231e-04
#> cond~~cond -1.358322e-18 2.724001e-19 -1.805322e-19 1.968405e-18
#> reaction~~reaction 3.887688e-03 3.633575e-04 -9.689746e-04 -2.407313e-03
#> pmi~~pmi 3.633575e-04 6.120123e-05 -1.531451e-04 2.220038e-04
#> indirect -9.689746e-04 -1.531451e-04 4.040353e-04 -6.824198e-04
#> direct -2.407313e-03 2.220038e-04 -6.824198e-04 1.235279e-02
#> total -3.376287e-03 6.885878e-05 -2.783845e-04 1.167037e-02
#> total
#> cp 1.167037e-02
#> b -6.039382e-04
#> a -7.465640e-05
#> cond~~cond 1.787873e-18
#> reaction~~reaction -3.376287e-03
#> pmi~~pmi 6.885878e-05
#> indirect -2.783845e-04
#> direct 1.167037e-02
#> total 1.139198e-02
# 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.128153657 -0.0164549194 0.0769192875 -0.0039600394
#> b -0.016454919 0.0069630083 -0.0078475127 -0.0010820080
#> a 0.076919288 -0.0078475127 0.0678911916 -0.0006641964
#> cond~~cond -0.003960039 -0.0010820080 -0.0006641964 0.0011114405
#> reaction~~reaction -0.060772283 0.0085113276 -0.0321506311 0.0018176797
#> pmi~~pmi 0.004596774 0.0033715106 -0.0161468004 -0.0028179488
#> indirect 0.029558704 -0.0003221215 0.0279461369 -0.0012012187
#> direct 0.128153657 -0.0164549194 0.0769192875 -0.0039600394
#> total 0.157712362 -0.0167770409 0.1048654244 -0.0051612581
#> reaction~~reaction pmi~~pmi indirect direct
#> cp -0.060772283 0.0045967741 0.0295587042 0.128153657
#> b 0.008511328 0.0033715106 -0.0003221215 -0.016454919
#> a -0.032150631 -0.0161468004 0.0279461369 0.076919288
#> cond~~cond 0.001817680 -0.0028179488 -0.0012012187 -0.003960039
#> reaction~~reaction 0.030119203 -0.0069802787 -0.0116077840 -0.060772283
#> pmi~~pmi -0.006980279 0.0284001899 -0.0054403777 0.004596774
#> indirect -0.011607784 -0.0054403777 0.0130823217 0.029558704
#> direct -0.060772283 0.0045967741 0.0295587042 0.128153657
#> total -0.072380067 -0.0008436036 0.0426410259 0.157712362
#> total
#> cp 0.1577123616
#> b -0.0167770409
#> a 0.1048654244
#> cond~~cond -0.0051612581
#> reaction~~reaction -0.0723800668
#> pmi~~pmi -0.0008436036
#> indirect 0.0426410259
#> direct 0.1577123616
#> total 0.2003533875
vcov(std)
#> cp b a cond~~cond
#> cp 1.521690e-02 -2.118069e-03 1.042759e-02 -8.363144e-18
#> b -2.118069e-03 3.592506e-03 -2.081952e-03 2.270838e-18
#> a 1.042759e-02 -2.081952e-03 1.125981e-02 -3.667848e-18
#> cond~~cond -8.363144e-18 2.270838e-18 -3.667848e-18 2.465190e-32
#> reaction~~reaction -2.623307e-04 -2.026326e-03 -4.513940e-04 -8.638834e-19
#> pmi~~pmi -3.805508e-03 1.041762e-03 -4.493807e-03 1.678058e-18
#> indirect 3.707067e-03 -2.366491e-04 3.998682e-03 -7.348684e-19
#> direct 1.521690e-02 -2.118069e-03 1.042759e-02 -8.363144e-18
#> total 1.892396e-02 -2.354718e-03 1.442628e-02 -9.098012e-18
#> reaction~~reaction pmi~~pmi indirect direct
#> cp -2.623307e-04 -3.805508e-03 3.707067e-03 1.521690e-02
#> b -2.026326e-03 1.041762e-03 -2.366491e-04 -2.118069e-03
#> a -4.513940e-04 -4.493807e-03 3.998682e-03 1.042759e-02
#> cond~~cond -8.638834e-19 1.678058e-18 -7.348684e-19 -8.363144e-18
#> reaction~~reaction 1.406469e-03 4.673654e-05 -4.881840e-04 -2.623307e-04
#> pmi~~pmi 4.673654e-05 1.853845e-03 -1.542932e-03 -3.805508e-03
#> indirect -4.881840e-04 -1.542932e-03 1.513215e-03 3.707067e-03
#> direct -2.623307e-04 -3.805508e-03 3.707067e-03 1.521690e-02
#> total -7.505147e-04 -5.348441e-03 5.220282e-03 1.892396e-02
#> total
#> cp 1.892396e-02
#> b -2.354718e-03
#> a 1.442628e-02
#> cond~~cond -9.098012e-18
#> reaction~~reaction -7.505147e-04
#> pmi~~pmi -5.348441e-03
#> indirect 5.220282e-03
#> direct 1.892396e-02
#> total 2.414425e-02