[R] lavaan: how to analyse residuals of a latent variable
Hans Ekbrand
hans at sociologi.cjb.net
Tue Aug 9 13:35:05 CEST 2011
Hi r-help,
I use lavaan:sem() for structural equation modelling with latent
variables. Below is a reproducible example (the code requires a
working installation of lavaan) where the latent variable criminality
is in focus. Besides criminality in general, I am specifically
interested one of the manifest variables that make up the latent
variable criminality, namely fire.setting.
My question is: how can I analyse the part of the variation in
fire.setting that is not included in the latent variable criminality?
Ideally I would want a new variable that captures just this. Then I
could model regressions with this variable as the dependent variable.
As far as I understand the output of the summary() - of which I have
reproduced a few lines - about half (0.499) of the variation in
fire.setting is included in the latent variable criminality.
Estimate Std.err Z-value P(>|z|) Std.lv Std.all
Latent variables:
criminality =~
fire.setting 0.324 0.007 48.223 0.000 0.189 0.499
I would like to analyse the "other half" of fire.setting, so to speak.
my.model <- "
## Measurement model (definitions of the latent variables)
priviledged.parents =~ nr.parents.employed + parental.housing
school.adaption =~ enjoying.school + good.teachers +
good.grades.important
school.grades =~ grade.language + grade.english + grade.craft +
grade.math + grade.chemistry + grade.arts +
grade.sports
criminality =~ vandalism + illegal.grafitti + shop.lifting +
theft.from.automat + theft.from.school +
theft.of.bicycle + theft.of.moped + theft.of.car +
theft.from.car + theft.pick.pocket + burglary +
buying.stolen.goods + selling.stolen.goods +
wearing.knife + robbery + fire.setting +
abuse.unknown.persons + abuse.family.members +
used.knife + drugs.cannabis + drugs.other +
drugs.thinner + drugs.steroids + selling.drugs.cannabis
+ selling.drugs.other
## Regressions
priviledged.parents ~ parental.migration + parental.class
school.adaption ~ parental.migration + parental.class + sex.girl +
priviledged.parents
school.grades ~ parental.migration + parental.class + sex.girl +
priviledged.parents
criminality ~ parental.migration + parental.class + sex.girl +
priviledged.parents + school.adaption + school.grades "
library(lavaan)
con <- url("http://code.cjb.net/temp/lavaan.temp.RData")
print(load(con))
close(con)
my.fit <- sem(my.model, data = my.crim.set)
summary(my.fit, fit.measures = T, standardized = T)
--
Hans Ekbrand
Department of Sociology
University of Gothenburg
Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110809/3d71eb78/attachment.bin>
More information about the R-help
mailing list