Thank you, it looks like that was the problem Emma
> Emma, > > It looks like there is at least one location that has been sampled at > least twice in some year. A co-worker of me got similar errors. After > checking his data carefully he found a duplicate row. Removing the > duplicate row solved his problem. > > HTH, > > Thierry > > > ------------------------------------------------------------------------ > ---- > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzoek / Research Institute for Nature > and Forest > Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, > methodology and quality assurance > Gaverstraat 4 > 9500 Geraardsbergen > Belgium > tel. + 32 54/436 185 > [EMAIL PROTECTED] > www.inbo.be > > To call in the statistician after the experiment is done may be no more > than asking him to perform a post-mortem examination: he may be able to > say what the experiment died of. > ~ Sir Ronald Aylmer Fisher > > The plural of anecdote is not data. > ~ Roger Brinner > > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of > data. > ~ John Tukey > > -----Oorspronkelijk bericht----- > Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Namens [EMAIL PROTECTED] > Verzonden: woensdag 2 juli 2008 12:29 > Aan: r-help@r-project.org > Onderwerp: [R] Correlation structures in gls with repeated measurements > > Hi, > > I am trying include a spatial correlation structure into a gls model but > keep getting the following error: > >> ocean<-read.table("C:\\oceanography2.txt",header=TRUE) >> library(nlme) > >> YEAR<-as.factor(ocean$YEAR) > >>group<-groupedData(san_dens~temp_grad*pyc_grad*start_thermo|YEAR,data=o > cean) > >> model1<-gls(san_dens~temp_grad*pyc_grad*start_thermo,data=group) > >> model2<-update(model1,corr=corSpher(form=~MIDLONGDEC+MIDLATDEC|YEAR)) > Error in getCovariate.corSpatial(object, data = data) : > Cannot have zero distances in "corSpatial" > > > The measurements have been repeated over 10 years so the coordinates are > repeated which I assume is the reason for this error. I thought grouping > by YEAR should remove this but it doesnt seem to work, or I am making a > mistake when I am trying to group it? I have noticed a couple of other > posts with the same problem but I have still not managed to solve this. > > I would be really grateful if anyone has any ideas or has had this > problem > before. > > > Thanks in advance, > Emma Hazard > > ______________________________________________ > 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. > ______________________________________________ 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.