[R] Correlation structures in gls with repeated measurements

From: <t03eh7_at_abdn.ac.uk>
Date: Wed, 02 Jul 2008 11:28:45 +0100 (BST)


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)


> 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. Received on Wed 02 Jul 2008 - 12:26:40 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 - 13:31:53 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