You need repeated measures for a random effect to make any sense. I modified your example as follows, and the error went away.
> mytable$RIL2 <- rep(1:4, 1:4) > cs2 <- corCompSymm(value=0.5, form=~1|RIL2) > model2<-lme(mytrait~myloc, data=mytable, random=~1|RIL2, + correlation=cs2) (I've made similar mistakes and had great difficulty finding the problem.) spencer graves J.Fu wrote: > Dear Friends, > > I am seeking for any help on an error message in lme > functions. I use mixed model to analyze a data with > compound symmetric correlation structure. But I get an > error message: "Error in corMatrix.corCompSymm(object) : > NA/NaN/Inf in foreign function call (arg 1)". If I change > the correlation structure to corAR1, then no error. I have > no clue how to solve this problem. I would highly > appreciate any help. > Thanks in advance and looking forward to any help. > > JY > > > I attached my data and codes here: > > # data: mytable > mytrait myloc RIL > A1 0.590950330 0 1 > A2 -0.315469846 -1 2 > A3 -0.265690115 0 3 > A4 0.342885046 0 4 > A5 0.007613402 1 5 > A6 0.285997884 0 6 > A7 0.333841975 0 7 > A8 -0.599817735 -1 8 > A9 0.242621036 0 9 > A10 0.518959588 1 10 > > cs<-corCompSymm(0.5, form=~1|RIL, fixed=T) > model<-lme(mytrait~myloc, data=mytable, random=~1|RIL, > na.action=na.omit, correlation=cs) > > Error in corMatrix.corCompSymm(object) : NA/NaN/Inf in > foreign function call (arg 1) > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com <http://www.pdf.com> Tel: 408-938-4420 Fax: 408-280-7915 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html