View source: R/semmcci-mc-mi.R
MCMI | R Documentation |
Calculates Monte Carlo confidence intervals for free and defined parameters. Missing values are handled using multilple imputation.
MCMI(
lav,
mi,
R = 20000L,
alpha = c(0.001, 0.01, 0.05),
decomposition = "eigen",
pd = TRUE,
tol = 1e-06,
seed = NULL
)
lav |
Object of class |
mi |
Object of class |
R |
Positive integer. Number of Monte Carlo replications. |
alpha |
Numeric vector.
Significance level |
decomposition |
Character string.
Matrix decomposition of the sampling variance-covariance matrix
for the data generation.
If |
pd |
Logical.
If |
tol |
Numeric.
Tolerance used for |
seed |
Integer. Random seed for reproducibility. |
A sampling distribution of parameter estimates is generated
from the multivariate normal distribution
using the parameter estimates and the sampling variance-covariance matrix
obtained using multiple imputation.
Confidence intervals for free and defined parameters
are generated using the simulated sampling distribution.
Parameters can be defined using the :=
operator
in the lavaan
model syntax.
Returns an object of class semmcci
which is
a list with the following elements:
Function call.
List of function arguments.
Parameter estimates \hat{\theta}
.
Sampling distribution of parameter estimates
\hat{\theta}^{\ast}
.
Function used ("MCMI").
Pesigan, I. J. A., & Cheung, S. F. (2023). Monte Carlo confidence intervals for the indirect effect with missing data. Behavior Research Methods. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3758/s13428-023-02114-4")}
Rubin, D. B. (1987). Multiple imputation for nonresponse in surveys. John Wiley & Sons, Inc.
Other Monte Carlo in Structural Equation Modeling Functions:
Func()
,
MC()
,
MCFunc()
,
MCGeneric()
,
MCStd()
library(semmcci)
library(lavaan)
# Data ---------------------------------------------------------------------
data("Tal.Or", package = "psych")
df <- mice::ampute(Tal.Or)$amp
# 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 -----------------------------------------------------
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) # use default listwise deletion
## MCMI() ------------------------------------------------------------------
MCMI(
fit,
mi = mi,
R = 5L, # use a large value e.g., 20000L for actual research
alpha = 0.05
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.