Your model is saturated. I think lavaan calculates the number of degrees of freedom this way:
DF = n*(n + 1)/2 - t - n.fix*(n.fix + 1)/2 n = number of variables t = number of free parameters n.fix = number of fixed exogenous variables So, if you fix the exogenous variables, as in mimic = "Mplus": DF = 28 - 13 - 15 = 0 If you don't, as in mimic = "EQS": DF = 28 - 28 - 0 = 0 You are probably not considering the variances and covariances of the exogenous variables to arrive at 15 degrees of freedom: model = ' Internet + Stress3 ~ HHincome + Race + Age + Gender + Stress1 Stress3 ~ Internet HHincome ~~ 0*Race + 0*Age + 0*Gender + 0*Stress1 Race ~~ 0*Age + 0*Gender + 0*Stress1 Age ~~ 0*Gender + 0*Stress1 Gender ~~ 0*Stress1 HHincome ~~ 1*HHincome Race ~~ 1*Race Age ~~ 1*Age Gender ~~ 1*Gender Stress1 ~~ 1*Stress1 ' fit = lavaan(model, sample.nobs=161, sample.cov=myCov, int.ov.free = T, int.lv.free = F, auto.fix.first = T, auto.fix.single = T, auto.resid.var = T, auto.cov.lv.x = T, auto.cov.y = T, mimic = "EQS") summary(fit) Cheers, Gustavo. On Thu, Mar 17, 2011 at 9:50 AM, Andrew Miles <rstuff.mi...@gmail.com> wrote: > 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@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. > ______________________________________________ R-help@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.