Re: [R] Correlation structures in gls with repeated measurements

From: ONKELINX, Thierry <Thierry.ONKELINX_at_inbo.be>
Date: Wed, 02 Jul 2008 14:40:43 +0200

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
Thierry.Onkelinx_at_inbo.be
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: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] Namens t03eh7_at_abdn.ac.uk
Verzonden: woensdag 2 juli 2008 12:29
Aan: r-help_at_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_at_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_at_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. Received on Wed 02 Jul 2008 - 12:42:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 14:31:04 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive