for me when i load psych package along with other one the problem appear.
with psych
library(foreign)
#require(faoutlier)
#library(haven)
#library(lavaan)
library(semTools)
require(semPlot)
library(EGAnet)
library(psych)
data(HolzingerSwineford1939)
HS9 <- HolzingerSwineford1939[ , c("x7","x8","x9")]
HSbinary <- as.data.frame( lapply(HS9, cut, 2, labels=FALSE) )
names(HSbinary) <- c("y7","y8","y9")
HS <- cbind(HolzingerSwineford1939, HSbinary)
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ y7 + y8 + y9 '
fit <- cfa(HS.model, data = HS, ordered = c("y7","y8","y9"),
std.lv = TRUE)
reliability(fit)
Error in keys[[scales]] : this S4 class is not subsettable
no psych
library(foreign)
#require(faoutlier)
#library(haven)
#library(lavaan)
library(semTools)
require(semPlot)
library(EGAnet)
#library(psych)
data(HolzingerSwineford1939)
HS9 <- HolzingerSwineford1939[ , c("x7","x8","x9")]
HSbinary <- as.data.frame( lapply(HS9, cut, 2, labels=FALSE) )
names(HSbinary) <- c("y7","y8","y9")
HS <- cbind(HolzingerSwineford1939, HSbinary)
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ y7 + y8 + y9 '
fit <- cfa(HS.model, data = HS, ordered = c("y7","y8","y9"),
std.lv = TRUE)
reliability(fit)
For constructs with categorical indicators, Zumbo et al.`s (2007) "ordinal alpha" is calculated in addition to the standard alpha, which treats ordinal variables as numeric. See Chalmers (2018) for a critique of "alpha.ord" and the response by Zumbo & Kroc (2019). Likewise, average variance extracted is calculated from polychoric (polyserial) not Pearson correlations.
visual textual speed
alpha 0.6261171 0.8827069 0.4460672
alpha.ord NA NA 0.6672581
omega 0.6367040 0.8795086 0.4674903
omega2 0.6367040 0.8795086 0.4674903
omega3 0.6247881 0.8741398 0.4559127
avevar 0.3880813 0.7089975 0.4200451