[R] SEM - singularity error

Chuck Cleland ccleland at optonline.net
Thu Sep 20 18:40:06 CEST 2007


nicolette.cagle at duke.edu wrote:
> Good morning,
> 
> I am trying to develop a structural equation model of snake abundance using
> habitat variables. In attempting to estimate the model using the "sem" package
> in R version 2.4.0, I receive the following error message:
> 
> "Error in solve.default(C) : system is computationally singular: reciprocal
> condition number = 1.75349e-16"
> 
> MAIN PROBLEM: I am hoping to discover why I am receiving the aforementioned
> error message and how to successfully estimate the model.
> 
> OTHER INFORMATION:
> 1. I believe the model is over-identified rather than under-identified (based on
> my understanding of the t-rule). I have observed data for 10 variables (9
> exogenous, 1 endogenous).
> 
> 2. I am not certain that I have used the proper tool to estimate the covariance
> matrix. In this case, I used the "VAR" function.
> 
> 3. I am most concerned that I have improperly coded the RAM file. For example,
> in a case where I have three exogenous indicators of one exogenous latent
> variable, I specify a start value of 1 for one of the exogenous indicators. I
> am not sure if this is proper or necessary.
> 
> 4. I am new to SEM; this is the first model I have ever tried to estimate.
> 
> R CODE: Below is the r-code I have used to estimate the structural equation
> model --
> 
> # LOADING R PACKAGES
> library(sem)
> 
> # READING IN THE CSV FILES
> thsi.2006<-read.csv("thsi_ab_env_space_sem.csv")
> thsi<-thsi.2006
> 
> # MAKING "RAM" FILE 2
> model2.nlc <-specify.model()
> Moist->slope, NA, 1
> Moist->sand, lamda21, NA
> Moist->clay, lamda31, NA
> Hab->isol, NA, 1
> Hab->edgedist_a, lamda52, NA
> Hab->ag10, lamda62, NA
> Hab->urb10, lamda72, NA
> Hab->rd10, lamda82, NA
> Hab->y, lamda92, NA
> Moist->this, gamma11, NA
> Hab->this, gamma12, NA
> slope<->slope, theta11, NA
> sand<->sand, theta22, NA
> clay<->clay, theta33, NA
> isol<->isol, theta44, NA
> edgedist_a<->edgedist_a, theta55, NA
> ag10<->ag10, theta66, NA
> urb10<->urb10, theta77, NA
> rd10<->rd10, theta88, NA
> y<->y, the99, NA
> Moist<->Moist, phi11, NA
> Hab<->Hab, phi22, NA
> this<->this, theps11, NA
> 
> model2.nlc
> end
> 
> # MAKING S (COVARIANCE MATRIX)
> thsi.var <- var(thsi)
> 
> # MAKING UNSCALED SEM MODEL
> sem2<-sem(ram=model2.nlc, S=thsi.var, N=22)
> 
> I am also attaching a jpeg diagram of the model I am trying to estimate. Please
> let me know if there is any additional information that I should add to this
> posting.
> 
> Thank you so much for your time.
> Nicolette Cagle

  Your specification of the model seems OK and it is over-identified (21
free parameters and 34 df).  I suspect the problem is that one or more
of your 10 variables is a linear function of the remaining variables.
If that is the case, then the following should give the same singularity
error:

factanal(thsi, factors=1)

  You may be able to drop one or more of the 10 variables from
consideration and successfully estimate a conceptually similar model.

hope this helps,

Chuck Cleland

> ------------------------------------------------------------------------
> 
> ______________________________________________
> 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.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list