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

From: Daniel Nordlund <res90sx5_at_verizon.net>
Date: Wed 24 Jan 2007 - 15:47:59 GMT

David,

Thanks for the help. I missed the significance of the section you quoted below from the help. That does indeed solve the problem.

Dan

Dan Nordlund
Bothell, WA USA

> -----Original Message-----
> Sent: Wednesday, January 24, 2007 3:32 AM
> To: Daniel Nordlund; r-help
> Subject: Re: [R] solving a structural equation model using sem or other package
>
> This is an extract from the sem help page, which deals with your situation:
>
> S covariance matrix among observed variables; may be input as a
> symmetric matrix, or as a lower- or upper-triangular matrix. S may
> also be a raw (i.e., ``uncorrected'') moment matrix — that is, a
> sum-of-squares-and-products matrix divided by N. This form of input is
> useful for fitting models with intercepts, in which case the moment
> matrix should include the mean square and cross-products for a unit
> variable all of whose entries are 1; of course, the raw mean square
> for the unit variable is 1. Raw-moment matrices may be computed by
> raw.moments.
>
> On 24/01/07, Daniel Nordlund <res90sx5@verizon.net> wrote:
> > 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
> >
<<<snip>>>
> > 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
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> =================================
> David Barron