simsem / semTools

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

reliability and maximalRelia doesnt work with ordered indicators #71

Closed maugavilla closed 4 years ago

maugavilla commented 4 years ago

A user share this issue and I replicate it, when the indicators are binary, the functions reliability and maximalRelia show an error Error: $ operator not defined for this S4 class

I tried to find the issue in the code, but couldnt find the solution

Here is code that shows the error

library(lavaan) library(semTools)

dat <- HolzingerSwineford1939 summary(dat) dat <- apply(HolzingerSwineford1939[,paste0("x",1:3)], 2, cut, breaks = c(2), labels = FALSE)

HS.model <- ' visual =~ x1 + x2 + x3'

fit <- cfa(HS.model, std.lv=T, data = dat, estimator="wlsmv", ordered=paste0("x",1:4)) summary(fit, fit.measures = TRUE)

reliability(fit) maximalRelia(fit)

TDJorgensen commented 4 years ago

I think this is an old issue already resolved. Does it replicate in the development version?

maugavilla commented 4 years ago

Oh, yes it worked well with the development version semTools_0.5-2.920

Just pasted the solution in the google group thread

thanks