Hi, You did a really good job providing a reproducible example, except that you didn't mention which package sem() comes from. (sem, I'm assuming).
I don't know how you came up with your covariance matrix, but it *isn't* symmetric: > isSymmetric(S.Seed.BB) [1] FALSE > S.Seed.BB[6, 2] [1] 37.758 > S.Seed.BB[2, 6] [1] 37.759 Sarah On Fri, May 4, 2012 at 10:36 AM, Vero Chillo <vchi...@gmail.com> wrote: > Hello, I tried to do a 'sem' analysis for data of how blueberry consumption > by birds is influenced by a pollution gradient, using distance and > vegetation structural and composition variables, but I got the following > error message: > > Error in sem.default(ram = ram, S = S, N = N, param.names = pars, var.names > = vars, : > S must be a square triangular or symmetric matrix > > This may be very obvious for R specialist, but I cant find the problem! > > #Symbolic ram model > mod.BB.1 <- specify.model() > BB.Cob -> B.B, lamb1, NA > Under.Cob -> B.B, lamb2, NA > BA -> B.B, lamb3, NA > Over.Comp -> B.B, lamb4, NA > Under.Comp -> B.B, lamb5, NA > Site -> B.B, lamb6, NA > Site -> BB.Cob, lamb7, NA > Site -> BA, lamb8, NA > Site -> Under.Cob, lamb9, NA > Site -> Under.Comp, lamb10, NA > Site -> Under.Comp, lamb11, NA > Under.Comp <-> Over.Comp, beta1, NA > Under.Cob <-> BA, beta2, NA > BB.Cob <-> BB.Cob, beta3, NA > Under.Cob <-> Under.Cob, beta4, NA > BA <-> BA, beta5, NA > Under.Comp <-> Under.Comp, beta6, NA > Over.Comp <-> Over.Comp, beta7, NA > B.B <-> B.B, beta8, NA > Site <-> Site, NA, 1 > > #S matrix > S.Seed.BB <- matrix(c( > 2.243, 3.055, 1.657, -2.166, 12.424, 27.105, 2.205, > 3.055, 41.942, 2.079, -2.392, 15.390, 37.759, 0.565, > 1.657, 2.079, 1.396, -1.655, 9.960, 15.360, -1.238, > -2.166, -2.392, -1.655, 2.164, -12.328, -25.099, -1.791, > 12.424, 15.390, 9.960, -12.328, 72.492, 129.491, -0.004, > 27.105, 37.758, 15.360, -25.099, 129.491, 456.913, 108.861, > 2.205, 0.565, -1.238, -1.791, -0.004, 108.861, 56.239),7,7,byrow=TRUE) > rownames(S.Seed.BB) <- colnames(S.Seed.BB) <- > c('Site','B.B','Over.Comp','Under.Comp','BA','Under.Cob', 'BB.Cob') > > #sem function > sem.BB.1 <- sem(mod.BB.1, S.Seed.BB, N=40) > > Thanks a lot for any suggestions! > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ 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.