[R] Error in structural equation model - "The model has negativedegrees of freedom"

Sunil W sunnyw at hotmail.com
Sun Dec 4 17:02:48 CET 2005

Hi John
Thanks a lot for the reply.

Could you suggest how I can correct this problem? I tried using a 
correlation matrix instead of raw moments, but still got the same error. I 
also fixed parameters v1,v2,v3,a1 at 1; then it gave me the error that the 
system is exatly singular.

To answer the points that you raised:

1. x1-x6 are not causes; they are just indicatiors. Does that change my 

2. Is the size of the dataset going to be a real limitation? How can I take 
care of that?

Would appreciate your reply,


Dear Sunil,

There are 7*8/2 = 28 raw moments among the 7 observed variables. Of these, 
6*7/2 = 21 are used for the moments among the 6 fixed-exogenous variables, 
leaving 28 - 21 = 7 df. You model has 11 free parameters. So df for the 
model = 11 - 7 = -4.

Some additional comments:

If you're using raw moments, why isn't there a constant variable in the 

Do you really intend x1 -- x6 to be causes, rather than indicators, of m1 
and m2?

Why are there no normalizing constraints on the latent variables?

Do you really want to fit a model like this to so small a data set?

I hope this helps,

John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4

>-----Original Message-----
>From: r-help-bounces at stat.math.ethz.ch
>[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Sunil W
>Sent: Wednesday, November 30, 2005 10:08 PM
>To: r-help at stat.math.ethz.ch
>Subject: [R] Error in structural equation model - "The model
>has negativedegrees of freedom"
>I am running a structural equation model with R using the sem
>command; am getting the following error:
>"Error in sem.default : The model has negative degrees of
>freedom = -4"
>My model is as follows:
>s_model = specify.model()
>x1->m1, b1,NA
>x2->m1, b2,NA
>x3->m2, b3,NA
>x4->m2, b4,NA
>x5->m2, b5,NA
>x6->m2, b6,NA
>m1->y, a1,NA
>m2->y, a2,NA
>m1<->m1, v1,NA
>m2<->m2, v2,NA
>y<->y, v3,NA
>x1-x6 are observed independent variables, m1 and m2 are the
>latent variables and y is the observed dependent variable. I
>use the raw.moments command for calculating the covariance
>matrix, based on a data with 147 observations.
>The command that I use is as follows:
>s = sem(s_model,S=R,obs.variables=colnames(R),
>fixed.x=c('x1','x2','x3','x4','x5','x6'), raw=TRUE)
>I would appreciate any help on this; I am new to structural
>equation models
>and realize that I may be making a silly error.
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide!

More information about the R-help mailing list