Structural Equation Modeling with lavaan in R
Erin Buchanan
Professor
#updated model with correlated error from exercise
wais.model2 <- 'verbalcomp =~ vocab + simil + inform + compreh
workingmemory =~ arith + digspan + lnseq
perceptorg =~ piccomp + block + matrixreason + digsym + symbolsearch
simil ~~ inform'
#updated model with hierarchy added
wais.model3 <- 'verbalcomp =~ vocab + simil + inform + compreh
workingmemory =~ arith + digspan + lnseq
perceptorg =~ piccomp + block + matrixreason + digsym + symbolsearch
simil ~~ inform
general =~ verbalcomp + workingmemory + perceptorg'
#regular model
fitmeasures(wais.fit2, c("cfi", "tli"))
cfi tli
0.833 0.780
#hierarchical model
fitmeasures(wais.fit3, c("cfi", "tli"))
cfi tli
0.833 0.780
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
verbalcomp ~~
workingmemory 6.278 1.181 5.315 0.000 0.416 0.416
perceptorg 5.654 0.859 6.583 0.000 0.634 0.634
workingmemory ~~
perceptorg 2.237 0.363 6.172 0.000 0.576 0.576
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
general =~
verbalcomp 1.000 0.676 0.676
workingmemory 0.396 0.060 6.635 0.000 0.615 0.615
perceptorg 0.356 0.062 5.713 0.000 0.937 0.937
Structural Equation Modeling with lavaan in R