[R-sig-ME] nlme: spatial autocorrelation on a sphere
bbolker at gmail.com
Wed Oct 3 01:40:24 CEST 2012
Dan Bebber <dbebber at ...> writes:
> I would like to write a spatial correlation structure function for
> nlme, that replicates the ability of such functions in the 'ramps'
> package to calculate great circle distances, e.g. corRSpher(form = ~
> lat + lon, metric = "haversine").
> The authors of the ramps package, Smith et al. (2008) write "The
> spatial correlation structures in nlme are not directly used because
> they do not allow great circle distance, which is very commonly
> needed for spatial data" so there may be a case for adding this
> functionality to nlme.
> Unfortunately, I have been unable to locate the code to do this
> within nlme. My question is: is this code accessible, and if so,
> how do I access it to modify it and then use it in functions like
[snip snip snip]
In my opinion, corRSpher *ought* to work -- this is exactly the
sort of situation that user-defined (or other-package-defined)
corStructs are supposed to be designed for. I confirmed, however,
that it doesn't work for gls() [I was feeling a little bit lazy
making up my example data, so I used gls() instead of [n]lme()].
I know that other 'pseudo-spatial' corStructs such as corBrownian etc.
(in the ape package) *do* work, so I'm not sure exactly why
corRSpher doesn't -- a quick look suggests that the problem *might*
be that it inherits from 'corSpatial', and there's some hard-coded
stuff in there.
If I get a chance I will look further, but I don't think you're
missing something obvious (unfortunately).
More information about the R-sig-mixed-models