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

Reply via email to