Skip to contents

Print Method for Object of Class semmcci

Usage

# S3 method for class 'semmcci'
print(x, alpha = NULL, digits = 4, ...)

Arguments

x

an object of class semmcci.

alpha

Numeric vector. Significance level \(\alpha\). If alpha = NULL, use the argument alpha used in x.

digits

Integer indicating the number of decimal places to display.

...

further arguments.

Value

Prints a matrix of estimates, standard errors, number of Monte Carlo replications, and confidence intervals.

Author

Ivan Jacob Agaloos Pesigan

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)
print(unstd)
#> Monte Carlo Confidence Intervals
#>                       est     se R   0.05%    0.5%    2.5%  97.5%  99.5% 99.95%
#> cp                 0.2643 0.2646 5 -0.2829 -0.2777 -0.2547 0.4166 0.4398 0.4450
#> b                  0.5458 0.0674 5  0.5008  0.5008  0.5011 0.6426 0.6453 0.6459
#> a                  0.4206 0.2513 5  0.0697  0.0704  0.0735 0.6149 0.6202 0.6214
#> cond~~cond         0.2471 0.0336 5  0.1787  0.1792  0.1813 0.2582 0.2586 0.2587
#> reaction~~reaction 1.8502 0.2348 5  1.6943  1.6959  1.7031 2.2717 2.2997 2.3060
#> pmi~~pmi           1.6964 0.1276 5  1.5665  1.5686  1.5782 1.8779 1.8829 1.8840
#> reaction~1         0.3254 0.4592 5 -0.0541 -0.0532 -0.0493 0.8715 0.8743 0.8749
#> pmi~1              5.4071 0.1391 5  5.2776  5.2787  5.2835 5.6046 5.6136 5.6157
#> cond~1             0.4478 0.0523 5  0.3865  0.3877  0.3931 0.5175 0.5185 0.5187
#> indirect           0.2296 0.1439 5  0.0450  0.0451  0.0459 0.3691 0.3773 0.3791
#> direct             0.2643 0.2646 5 -0.2829 -0.2777 -0.2547 0.4166 0.4398 0.4450
#> total              0.4938 0.2891 5 -0.0057 -0.0047 -0.0003 0.6268 0.6350 0.6368
print(std)
#> Standardized Monte Carlo Confidence Intervals
#>                       est     se R   0.05%    0.5%    2.5%  97.5%  99.5% 99.95%
#> cp                 0.0845 0.0832 5 -0.0924 -0.0907 -0.0832 0.1283 0.1359 0.1376
#> b                  0.4632 0.0496 5  0.4084  0.4095  0.4144 0.5310 0.5316 0.5318
#> a                  0.1585 0.0795 5  0.0243  0.0246  0.0259 0.1926 0.1930 0.1931
#> cond~~cond         1.0000 0.0000 5  1.0000  1.0000  1.0000 1.0000 1.0000 1.0000
#> reaction~~reaction 0.7659 0.0496 5  0.7162  0.7162  0.7163 0.8258 0.8292 0.8300
#> pmi~~pmi           0.9749 0.0177 5  0.9627  0.9627  0.9629 0.9993 0.9994 0.9994
#> indirect           0.2093 0.0401 5  0.0129  0.0130  0.0133 0.0977 0.0983 0.0984
#> direct             4.0990 0.0832 5 -0.0924 -0.0907 -0.0832 0.1283 0.1359 0.1376
#> total              0.9009 0.0846 5 -0.0019 -0.0016 -0.0003 0.1912 0.1959 0.1969

# 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)
print(unstd)
#> Monte Carlo Confidence Intervals (Multiple Imputation Estimates)
#>                       est     se R   0.05%    0.5%    2.5%  97.5%  99.5% 99.95%
#> cp                 0.2706 0.2655 5  0.0096  0.0133  0.0296 0.6207 0.6217 0.6220
#> b                  0.5224 0.0836 5  0.3956  0.3971  0.4035 0.6054 0.6087 0.6095
#> a                  0.4154 0.2309 5 -0.0809 -0.0744 -0.0457 0.4843 0.4848 0.4849
#> cond~~cond         0.2471 0.0211 5  0.2068  0.2070  0.2082 0.2567 0.2574 0.2576
#> reaction~~reaction 1.9278 0.2548 5  1.4165  1.4214  1.4433 2.0870 2.1063 2.1106
#> pmi~~pmi           1.6481 0.3208 5  1.1216  1.1281  1.1570 1.9128 1.9247 1.9274
#> indirect           0.2176 0.1185 5 -0.0319 -0.0286 -0.0142 0.2681 0.2714 0.2722
#> direct             0.2706 0.2655 5  0.0096  0.0133  0.0296 0.6207 0.6217 0.6220
#> total              0.4882 0.2215 5  0.2402  0.2433  0.2572 0.7662 0.7695 0.7702
print(std)
#> Standardized Monte Carlo Confidence Intervals
#>                       est     se R   0.05%    0.5%    2.5%  97.5%  99.5% 99.95%
#> cp                 0.0609 0.0876 5  0.0027  0.0039  0.0092 0.2072 0.2089 0.2093
#> b                  0.4932 0.0621 5  0.3578  0.3589  0.3637 0.5207 0.5273 0.5288
#> a                  0.1505 0.0920 5 -0.0307 -0.0283 -0.0173 0.2122 0.2171 0.2182
#> cond~~cond         1.0000 0.0000 5  1.0000  1.0000  1.0000 1.0000 1.0000 1.0000
#> reaction~~reaction 0.7440 0.0538 5  0.7066  0.7073  0.7102 0.8321 0.8327 0.8328
#> pmi~~pmi           0.9773 0.0177 5  0.9524  0.9528  0.9546 0.9980 0.9988 0.9990
#> indirect           0.0742 0.0401 5 -0.0110 -0.0100 -0.0055 0.0942 0.0968 0.0973
#> direct             0.0609 0.0876 5  0.0027  0.0039  0.0092 0.2072 0.2089 0.2093
#> total              0.1351 0.0780 5  0.0683  0.0695  0.0747 0.2581 0.2603 0.2609