MCStd {semmcci} | R Documentation |
Standardized Monte Carlo Confidence Intervals
Description
Calculates standardized Monte Carlo confidence intervals for free and defined parameters.
Usage
MCStd(mc, alpha = c(0.001, 0.01, 0.05))
Arguments
mc |
|
alpha |
Numeric vector.
Significance level |
Details
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.
Value
Returns an object of class semmcci
which is
a list with the following elements:
- call
Function call.
- args
List of function arguments.
- thetahat
Parameter estimates
.
- thetahatstar
Sampling distribution of parameter estimates
.
- fun
Function used ("MCStd").
Author(s)
Ivan Jacob Agaloos Pesigan
References
Pesigan, I. J. A., & Cheung, S. F. (2023). Monte Carlo confidence intervals for the indirect effect with missing data. Behavior Research Methods. doi:10.3758/s13428-023-02114-4
See Also
Other Monte Carlo in Structural Equation Modeling Functions:
Func()
,
MC()
,
MCFunc()
,
MCGeneric()
,
MCMI()
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
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)