Skip to content
Prev 327276 / 398502 Next

Error with sem function df = -6

Dear Immanuel,

In the absence of more information, your question is unanswerable, since there's no way of knowing which variables in your model are observed and which are latent. It was my guess that Y1, Z1, and Z2 (along with UNIT) are observed and CF is latent, but this is clearly wrong given the df calculation.

Here, as the posting guide suggests, is a reproducible example, using your model and call to sem(), but clearly defined data:

---- snip ---
Error in sem.default(ram, S = S, N = N, raw = raw, data = data, pattern.number = pattern.number,  : 
  The model has negative degrees of freedom = -2

---- snip ---

This model is underidentified, but at least it's possible to figure out why: There are 4*5/2 = 10 unique observed moments; your model has 11 parameters and also has to account for the second moment of the fixed exogenous UNIT. Thus 10 - (11 + 1) = -2, and the model is underidentified.

Some additional comments:

(1) Aside from UNIT there are no exogenous variables in this model.

(2) It's usually easier to use specifyEquations() than specifyModel() to define the model.

(3) If CF is really meant to be a latent variable, then there's a missing normalizing constraint, underidentifying the model apart from the gross comparison of moments and parameters.

(4) If, as here, you have the data, you don't have to compute the raw-moment matrix in a separate step, but could call sem() with the data argument.

Best,
 John

On Mon, 22 Jul 2013 18:55:31 -0400
Immanuel Williams <jamesijw23 at gmail.com> wrote:
------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/