dat1 <- HolzingerSwineford1939
dat1$x5 <- ifelse(dat1$x1 <= quantile(dat1$x1, .3), NA, dat1$x5)
dat1$x9 <- ifelse(is.na(dat1$x5), NA, dat1$x9)
targetModel <- "visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
"
targetFit <- sem(targetModel, dat1, meanstructure = TRUE, std.lv = TRUE,
missing = "fiml", group = "school")
summary(targetFit, fit = TRUE, standardized = TRUE)
# The number of bootstrap samples should be much higher.
temp <- bsBootMiss(targetFit, transformation = 1, nBoot = 10, seed = 31415)
temp
summary(temp)
hist(temp)
## user can specify confidence level (default = 0.95), the location of
## the legend ("none", "right", or "left"), and pass other arguments to hist()
hist(temp, conf = .90, legend = "none", xlab = "something else", breaks = 25)
Run the code above in your browser using DataLab