## Define a function that fits a model to your data and returns the
## Std. estimates. The boot function requires the first argument to
## be the data.frame, and the second argument to be an index to
## select rows (i.e., to do bootstrap sampling)
getSTDs <- function(data, rowIndices) {
mySyntax <- ' visual =~ x1 + x2 + x3
fit <- cfa(mySyntax, data = data[rowIndices, ] )
standardizedSolution(fit)$est
out.boot <- boot(data = HolzingerSwineford1939, statistic = getSTDs, R = 2000)
## get bias-corrected CI, for one parameter (index) at a time
boot.ci(out.boot, type = "bca", index = 1) ## note the index corresponds to the actual order in which
## the parameters appear in the output:
standardizedSolution(fit)
## You can request a set of BCa CIs
lapply(1:3, function(x) boot.ci(out.boot, type = "bca", index = x))