View source: R/semmcci-mc-std.R
MCStd | R Documentation |
Calculates standardized Monte Carlo confidence intervals for free and defined parameters.
MCStd(mc, alpha = c(0.001, 0.01, 0.05))
mc |
Output of the |
alpha |
Numeric vector.
Significance level |
The empirical sampling distribution
of parameter estimates from the argument mc
is standardized,
that is, each randomly generated vector of parameters is standardized.
Defined parameters are computed from the standardized component parameters.
Confidence intervals are generated
using the standardized empirical sampling distribution.
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 ("MCStd").
Ivan Jacob Agaloos Pesigan
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")}
Other Monte Carlo in Structural Equation Modeling Functions:
Func()
,
MC()
,
MCFunc()
,
MCGeneric()
,
MCMI()
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
alpha = 0.05
)
## Standardized Monte Carlo ------------------------------------------------
MCStd(unstd, alpha = 0.05)
# 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
alpha = 0.05
)
## Standardized Monte Carlo ------------------------------------------------
MCStd(unstd, alpha = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.