# data[].attributes.attachment_link.readable_text
library('lavaan')

data(HolzingerSwineford1939)


?HolzingerSwineford1939

HS<-HolzingerSwineford1939
?HolzingerSwineford1939
summary(HolzingerSwineford1939)

summary(HS)
HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '
fit0 <- cfa(HS.model, data = HolzingerSwineford1939)

modindices(fit0, sort = TRUE, maximum.number = 5)
---
  #
  
  HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '

# configural invariance
fit1 <- cfa(HS.model, data = HolzingerSwineford1939, group = "school")

# weak invariance
fit2 <- cfa(HS.model, data = HolzingerSwineford1939, group = "school",
            group.equal = "loadings")

# strong invariance
fit3 <- cfa(HS.model, data = HolzingerSwineford1939, group = "school",
            group.equal = c("intercepts", "loadings"))

# model comparison tests
lavTestLRT(fit1, fit2, fit3)

