[R] solving a structural equation model using sem or other package

From: Daniel Nordlund <res90sx5_at_verizon.net>
Date: Wed 24 Jan 2007 - 06:49:08 GMT

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?


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. Received on Wed Jan 24 17:55:53 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 24 Jan 2007 - 12:30:32 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.