| bootstrapLavaan {lavaan} | R Documentation |
Bootstrap functions to get bootstrap standard errors and bootstrap test statistics
bootstrapLavaan(object, R = 1000L, type = "ordinary", verbose = FALSE,
FUN = "coef", warn = -1L, return.boot = FALSE,
parallel = c("no", "multicore", "snow"),
ncpus = 1L, cl = NULL, ...)
bootstrapLRT(h0 = NULL, h1 = NULL, R = 1000L, type="bollen.stine",
verbose=FALSE, return.LRT = FALSE,
calibrate = FALSE, calibrate.R = 1000L, calibrate.alpha = 0.05,
warn = -1L, parallel = c("no", "multicore", "snow"),
ncpus = 1L, cl = NULL)
object |
An object of class |
h0 |
An object of class |
h1 |
An object of class |
R |
Integer. The number of bootstrap draws. |
type |
If |
FUN |
A function which when applied to the |
... |
Other named arguments for |
verbose |
If |
warn |
Sets the handling of warning messages. See |
return.boot |
Not used for now. |
return.LRT |
If |
parallel |
The type of parallel operation to be used (if any). If missing, the
default is |
ncpus |
integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs. |
cl |
An optional parallel or snow cluster for use if
|
calibrate |
If |
calibrate.R |
Integer. The number of bootstrap draws to be use for the double bootstrap. |
calibrate.alpha |
The significance level to compute the adjusted alpha based on the plugin p-values. |
# fit the Holzinger and Swineford (1939) example
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HolzingerSwineford1939)
# get the test statistic for the original sample
T.orig <- fitMeasures(fit, "chisq")
# bootstrap to get bootstrap test statistics
# we only generate 10 bootstrap sample in this example; in practice
# you may wish to use a much higher number
T.boot <- bootstrapLavaan(fit, R=10, type="bollen.stine",
FUN=fitMeasures, fit.measures="chisq")
# compute a bootstrap based p-value
pvalue.boot <- length(which(T.boot > T.orig))/length(T.boot)