I am trying to work my way through the book "Singer, JD and Willett, JB, Applied Longitudinal Data Analysis. Oxford University Press, 2003" using R. I have the SAS code and S-Plus code from the UCLA site (doesn't include chapter 8 or later problems). In chapter 8, there is a structural equation/path model which can be specified for the sem package as follows
S <- cov(al2) #al2 contains the variables alc1, alc2, alc3, and cons N <- 1122 modelA.ram <- specify.model() f1 -> alc1, NA, 1 f1 -> alc2, NA, 1 f1 -> alc3, NA, 1 f2 -> alc1, NA, 0 f2 -> alc2, NA, .75 f2 -> alc3, NA, 1.75 cons -> f1, p0, 1 cons -> f2, p1, 1 alc1 <-> alc1, u1, 1 alc2 <-> alc2, u2, 1 alc3 <-> alc3, u3, 1 cons <-> cons, u4, 1 f1 <-> f1, s1, 1 f2 <-> f2, s2, 1 f1 <-> f2, s3, 1 modelA <- sem(modelA.ram, S, N, analytic.gradient=FALSE) An equivalent specification in SAS produces the solution presented in the book. The variable cons is a constant vector of 1's. The problem with the sem package is that the covariance matrix which includes the variable cons is singular and sem says so and will not continue. Is there an alternative way to specify this problem for sem to obtain a solution? If not, is there another package that would produce a solution? Thanks, Dan Nordlund Bothell, WA ______________________________________________ R-help@stat.math.ethz.ch 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.