SEM in R Flashcards
latent variable
=~
regression
~
(residual) variance
~~
intercept
~ 1
Fix all variances of latent variables to unity
fit <- cfa(HS.model,
data = HolzingerSwineford1939,
std.lv = TRUE)
constraining parameter…
worsens model fit
freeing parameter…
improves model fit
fix loading multiple group
c(0.6, 0.8)*x3
fix parameter in some, not all
c(a, b, NA, c)*x3
weak invariance
group.equal = c(“loadings”))
strong invariance
group.equal = c(“loadings”, “intercepts))
strict invariance
group.equal = c(“loadings”, “intercepts”, “residuals”, “residual.covariances”))
LGC manual
model2 <- ‘
int =~ 1bmi1 + 1bmi2 + 1bmi3 + 1bmi4 + 1bmi5
slp =~ 0bmi1 + 1bmi2 + 2bmi3 + 3bmi4 + 4bmi5 + 5bmi6
# Latent variances and covariances:
int ~~ int
slp ~~ slp
int ~~ slp
bmi1 ~~ bmi1
bmi2 ~~ bmi2
bmi3 ~~ bmi3
bmi4 ~~ bmi4
bmi5 ~~ bmi5
bmi6 ~~ bmi6
int ~ 1
slp ~ 1
bmi1 ~ 01
bmi2 ~ 01
bmi3 ~ 01
bmi4 ~ 01
bmi5 ~ 01
bmi6 ~ 01
‘
orthogonal variance
x ~~ 0*y
Fix variance
x ~~ 1*x
fix loading
LV =~ ax1 + bx2
unfix (marker approach)
LV =~ NA*x1
constrain intercept
x ~ 0.5*1
mean structure = TRUE
weak invariance manual
dem60 =~ l1y1 + l2y2 + l3y3 + l4y4
dem65 =~ l1y5 + l2y6 + l3y7 + l4y8
‘
strong invariance manual
y1 ~ i11
y2 ~ i21
y3 ~ i31
y4 ~ i41
y5 ~ i11
y6 ~ i21
y7 ~ i31
y8 ~ i41
‘
strict invariance manual
y1 ~~ res1y1
y2 ~~ res2y2
y3 ~~ res3y3
y4 ~~ res4y4
y5 ~~ res1y5
y6 ~~ res2y6
y7 ~~ res3y7
y8 ~~ res4y8
equal latent variable variance, means latent variable
means, lv.variances,