R/confint_stdmod_lavaan.R
confint.stdmod_lavaan.Rd
Return the confidence interval of the standardized
moderation effect
in the output of stdmod_lavaan()
.
# S3 method for stdmod_lavaan
confint(object, parm, level = 0.95, ...)
The output of stdmod_lavaan()
.
Ignored. Always return the bootstrap confidence interval of the standardized moderation effect.
The level of confidence, default is .95, returning the 95% confidence interval.
Additional arguments. Ignored by the function.
A one-row matrix of the confidence intervals.
If bootstrapping is used to form the confidence interval by
stdmod_lavaan()
,
users can request the percentile confidence interval of
using the stored bootstrap estimate.
# Load a test data of 500 cases
dat <- test_mod1
library(lavaan)
mod <-
"
med ~ iv + mod + iv:mod + cov1
dv ~ med + cov2
"
fit <- sem(mod, dat)
coef(fit)
#> med~iv med~mod med~iv:mod med~cov1 dv~med dv~cov2 med~~med
#> 0.221 0.104 0.257 0.104 0.246 0.191 0.201
#> dv~~dv
#> 0.169
# Compute the standardized moderation effect and
# its confidence interval based on nonparametric bootstrapping
set.seed(8479075)
system.time(out_boot <- stdmod_lavaan(fit = fit,
x = "iv",
y = "med",
w = "mod",
x_w = "iv:mod",
boot_ci = TRUE,
R = 50))
#> user system elapsed
#> 0.869 0.031 0.877
# In real analysis, R should be at least 2000.
confint(out_boot)
#> 2.5 % 97.5 %
#> med~iv:mod 0.2957007 0.5230237