[R] structural equation modeling in sem, error, The model has negative degrees of freedom = -3, and The model is almost surely misspecified...

John Fox jfox at mcmaster.ca
Mon Oct 25 16:45:36 CEST 2010


Dear Alex,

Your problem doesn't have much to do with the sem package. The model that
you're trying to estimate is grossly underidentified. The model has 9
parameters to estimate and there are only 3*4/2 = 6 covariances among the 3
observed variables, hence the -3 df. There are also no exogenous variables
in the model, since you specified that dec is correlated with the structural
disturbances for density and ALL-Jack1.

Regards,
 John

--------------------------------
John Fox
Senator William McMaster 
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Alex Anderson
> Sent: October-25-10 2:19 AM
> To: r-help at r-project.org
> Subject: [R] structural equation modeling in sem, error, The model has
> negative degrees of freedom = -3, and The model is almost surely
> misspecified...
> 
> Hi all,
> I am attempting to learn my way through the sem package by constructing
> a simple structural model for some of my data on bird diversity,
> abundance, and primary productivity.
> 
> I have constructed a covariance matrix between these variables as per
> the following:
> 
>  >S_matrix = matrix(c(
>  >+ 0.003083259, 0,             0,
>  >+ 0.143870284, 89.7648490,      0,
>  >+ 0.276950919, 81.3484101, 215.3570157
>  > ), ncol = 3, byrow = T)
>  >rownames(S_matrix) = colnames(S_matrix) = c("dec_mean_EVI", "density",
> "ALL_Jack1")
> 
> I then construct a model using a symbolic ram specification as follows
> 
>  >tmodel <- specify.model()
>  >dec_mean_EVI     -> density, gam1,  NA
>  >density          -> ALL_Jack1, gam2,  NA
>  >dec_mean_EVI  -> ALL_Jack1, gam3,  NA
>  >dec_mean_EVI <-> dec_mean_EVI, ps1,   NA
>  >density <-> density, ps2,   NA
>  >ALL_Jack1 <-> ALL_Jack1, theta1,   NA
>  >dec_mean_EVI <-> density, theta2, NA
>  >dec_mean_EVI <-> ALL_Jack1, theta2, NA
>  >density <-> ALL_Jack1,  theta3, NA
> 
> I then try to run the sem analysis using the matrix and model.
> 
>  >sem_1 <- sem(ram = tmodel, S = S_matrix, N = 88, fixed.x =
> c("dec_mean_EVI"))
>  >summary(sem_1)
> 
> However, I only get the following error message:
> 
> "Error in sem.default(ram = ram, S = S, N = N, param.names = pars,
> var.names = vars,  :
>    The model has negative degrees of freedom = -3
> In addition: Warning message:
> In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names =
> vars,  :
>    The following variables have no variance or error-variance parameter
> (double-headed arrow):
>   density, ALL_Jack1, dec_mean_EVI    , density    , density        ,
> ALL_Jack1
> The model is almost surely misspecified; check also for missing
> covariances."
> 
> It must be obvious to those experienced with sem, but I can't yet see
> where I have gone wrong in constructing my matrix or model, any thoughts
> would be much appreciated.
> thanks in advance,
> Alex
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list