[R] Incorrect degrees of freedom in SEM model using lavaan

From: Andrew Miles <rstuff.miles_at_gmail.com>
Date: Thu, 17 Mar 2011 08:50:25 -0400


I have been trying to use lavaan (version 0.4-7) for a simple path model, but the program seems to be computing far less degrees of freedom for my model then it should have. I have 7 variables, which should give (7)(8)/2 = 28 covariances, and hence 28 DF. The model seems to only think I have 13 DF. The code to reproduce the problem is below. Have I done something wrong, or is this something I should take to the developer?

library(lavaan)

myCov = matrix(c(24.40, 0, 0, 0, 0, 0, 0, .03, .03, 0, 0, 0, 0, 0, 6.75, -
.08, 519.38, 0, 0, 0, 0, .36, .01, 2.74, .18, 0, 0, 0, .51, .0, -.31, .02,
.2, .0, 0, -.17, .0, -1.6, -.04, .01, .25, 0, -.1, .02, -.03, .0, -.01, .01
, .02), nrow=7, byrow=TRUE, dimnames=list(c("Internet", "Stress3", "HHincome", "Race", "Age", "Gender", "Stress1"), c("Internet", "Stress3", "HHincome", "Race", "Age", "Gender", "Stress1")))

model = '

Internet ~ HHincome + Race + Age + Gender + Stress1

Stress3 ~ Internet + HHincome + Race + Age + Gender + Stress1

'

fit=sem(model, sample.nobs=161, sample.cov=myCov, mimic.Mplus=FALSE)

#check the number of parameters being estimated

inspect(fit, what="free")

#Note the DF for the Chi-square is 0, when it should be 28-13 = 15

summary(fit)

Andrew Miles

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 17 Mar 2011 - 12:53:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Mar 2011 - 15:40:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive