[R] computationally singular and lack of variance parameters in SEM

Elizabeth Pringle epringle at stanford.edu
Sat May 2 00:59:18 CEST 2009


Hi all,

I am trying to set up a simple path analysis in the SEM package, but I am
having some trouble.  I keep getting the following error message or
something similar with my model, and I'm not sure what I'm doing wrong:
Error in solve.default(C) :
  system is computationally singular: reciprocal condition number =
2.2449e-20
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):
Ants, Herbivory
The model is almost surely misspecified; check also for missing covariances.

I have tried my data set with both a correlation (cor) and a variance (var)
matrix, but both produce the same error, and I'm not sure which one is
correct.  The error message about the variables that have no variance or
error-variance parameters are for my exogenous variables (or those that I am
not listing as "fixed.x=" in the model).  I have tried both single and
double arrows between ants and coccoids, but neither works.  I am not sure
that I know what it means for the system to be computationally singular
(sometimes it says it is exactly singular).  I am setting N=80 because I
have four observed variables with 20 observations each, I hope this is
correct.  I have attached the path diagram for my model as a jpeg.

My R code is the following:

data<-read.table("ChamelaColonySize.csv",header=TRUE,sep=",")

attach(data)

cor(data,method="spearman")

CorMatrix<-matrix(c(

+ 1, 0, 0, 0,

+ -0.4974, 1, 0, 0,

+ -0.4403, 0.7965, 1, 0,

+ 0.1250, 0.2602, 0.1825, 1),ncol=4,byrow=T)

rownames(CorMatrix)<-colnames(CorMatrix)<-c('Herbivory','Ants','Coccoids',
'Space')

ramcor<-specify.model()

Coccoids<->Ants, gam12, NA

Space->Ants, gam12, NA

Ants->Herbivory,bet21, NA

?read.table

sem<-sem(ram=ramcor,S=CorMatrix,N=80,fixed.x=c('Coccoids','Space'))


var(data)

VarMatrix<-matrix(c(

+ 0.73, 0, 0, 0,

+ -86.11, 35877.52, 0, 0,

+ -23.46, 11569.9, 5620.26, 0,

+ 0.82, 346.83, 138.21, 34.81),ncol=4,byrow=T)

semVar<-sem(ram=ramcor,S=VarMatrix,N=80,fixed.x=c('Coccoids','Space'))


Many thanks for any help.

Beth





-- 
****************************************************
Elizabeth G. Pringle
Department of Biology
Stanford University
Stanford, CA 94305
(Tel): 650-725-6791
(Fax): 650-462-5968
****************************************************


More information about the R-help mailing list