simsem / semTools

Useful tools for structural equation modeling
75 stars 36 forks source link

auxiliary and runMI functions don't retrieve chi-squared #12

Closed TDJorgensen closed 8 years ago

TDJorgensen commented 8 years ago

I'm guessing this has something to do with the changes since lavaan 0.5-18, but I have only tried running this function since lavaan 0.5-20. Try running the examples on the ?auxiliary or ?runMI help pages to see what happens:

HS.model <- ' visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9 '

dat <- data.frame(HolzingerSwineford1939, z=rnorm(nrow(HolzingerSwineford1939), 0, 1))

fit <- cfa(HS.model, data=dat, meanstructure=TRUE) fitaux <- auxiliary(HS.model, aux="z", data=dat, fun="cfa") # Use lavaan script fitaux <- cfa.auxiliary(fit, aux="z", data=dat) # Use lavaan output parameterEstimates(fitaux) summary(fitaux)

TDJorgensen commented 8 years ago

Using runMI(), you also don't get SEs, CIs, or tests for any of the parameter estimates:

HS <- cbind(HolzingerSwineford1939[ , paste("x", 1:9, sep = "")], z = rnorm(nrow(HolzingerSwineford1939))) MAR <- rbinom(n = nrow(HS), size = 1, prob = pnorm(HS$z) / 2) HS$x1[MAR == 1L] <- NA HS.model <- ' visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9 ' out <- runMI(HS.model, data = HS, fun = "cfa", m = 5, chi = "all") parameterEstimates(out) summary(out)