Here is an example code for something like that. Note that is you have a CFA and use
std.lv=T, the covariance = correlation
####
library(lavaan)
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HolzingerSwineford1939,
std.lv=T)
summary(fit, fit.measures=TRUE)
myFun <- function(x){
## get all parameter estimates, including standardized
pts <- parameterestimates(x, standardized = T)
return(pts[22:24,"std.all"]) ## select the rows for the correlations, the standardized
}
l.boot <- bootstrapLavaan(fit, R=100, type="bollen.stine",
FUN=myFun)
l.boot ## is a 3 column matrix, each row is a bootstrap, and each row is a different correlation
## you can estimate the mean, sd, and quantiles with something like this
apply(l.boot, 2, FUN=function(x)c(mean=mean(x),sd=sd(x),quantile(x,probs=c(.025,.5,.975))))
bye