## These run longer than 5 seconds
require(lavaan)
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
output1 <- cfa(HS.model, data = HolzingerSwineford1939, std.lv = TRUE)
cfaTable(output1, fit = "rmsea",
standardized = TRUE, params = c("loadings", "latentvariances"),
type = "latex")
## Example with file output
## cfaTable(output1, file = "exampleTable.tex", fit = "rmsea",
## standardized = TRUE, params = c("loadings", "latentvariances"),
## type = "latex")
model <- "factor =~ .7*y1 + .7*y2 + .7*y3 + .7*y4
y1 | -1*t1 + 1*t2
y2 | -.5*t1 + 1*t2
y3 | -.2*t1 + 1*t2
y4 | -1*t1 + 1*t2
"
dat <- simulateData(model, sample.nobs = 300)
testmodel <- "ExampleFactor =~ y1 + y2 + y3 + y4"
output2 <- cfa(testmodel, data = dat, ordered = colnames(dat),
std.lv = FALSE)
cfaTable(output2,
params = c("loadings", "thresholds", "residuals"),
fit = c("tli", "chi-square"),
names_fit = c("TLI", "chi-square"), type = "latex")
## Example with file output
## cfaTable(output, file = "catTable.tex",
## params = c("loadings", "thresholds", "residuals"),
## fit = c("tli", "chi-square"),
## names_fit = c("TLI", "chi-square"), type = "latex")
Run the code above in your browser using DataLab