[R] lme, lmer, gls, and spatial autocorrelation

Timothy_Handley at nps.gov Timothy_Handley at nps.gov
Mon Aug 24 20:12:02 CEST 2009


Hello folks,

I have some data where spatial autocorrelation seems to be a serious
problem, and I'm unclear on how to deal with it in R. I've tried to do my
homework - read through 'The R Book,' use the online help in R, search the
internet, etc. - and I still have some unanswered questions. I'd greatly
appreciate any help you could offer. The super-super short explanation is
that I'd like to draw a straight line through my data, accounting for
spatial autocorrelation and using Poisson errors (I have count data).
There's a longer explanation at the end of this e-mail, I just didn't want
to overdo it at the start.

There are three R functions that do at least some of what I would like, but
I'm unclear on some of their specifics.

1. lme - Maybe models spatial autocorrelation, but doesn't allow for
Poisson errors. I get mixed messages from The R Book. On p. 647, there's an
example that uses lme with temporal autocorrelation, so it seems that you
can specify a correlation structure. On the other hand, on p.778, The R
Book says, "the great advantage of the gls function is that the errors are
allowed to be correlated". This suggests that only gls (not lme or lmer)
allows specification of a corStruct class. Though it may also suggest that
I have an incomplete understanding of these functions.

2. lmer - Allows specification of a Poisson error structure. However, it
seems that lmer does not yet handle correlated errors.

3. gls - Surely works with spatial autocorrelation, but doesn't allow for
Poisson errors. Does allow the spatial autocorrelation to be assessed
independently for different groups (I have two groups, one at each of two
different spatial scales).

Since gls is what The R Book uses in the example of spatial
autocorrelation, this seems like the best option. I'd rather have Poisson
errors, but Gaussian would be OK. However, I'm still somewhat confused by
these three functions. In particular, I'm unclear on the difference between
lme and gls. I'd feel more confident in my results if I had a better
understanding of these choices. I'd greatly appreciate advice on the matter


More detailed explanation of the data/problem is below:

The data:
[1] A count of the number of plant species present on each of 96 plots that
are 1m^2 in area.
[2] A count of the number of plant species present on each of 24 plots that
are 100m^2 in area.
[3] X,Y coordinates for the centroid of all plots (both sizes).

Goal:
1. A best fit straight-line relating log10(area) to #species.
2. The slope of that line, and the standard error of that slope. (I want to
compare the slope of this line with the slope of another line)

The problem:
Spatial autocorrelation. Across our range of plot-separation-distances,
Moran's I ranges from -.5 to +.25. Depending on the size of the
distance-bins, about 1 out of 10 of these I values are statistically
significant. Thus, there seems to be a significant degree of spatial
autocorrelation. if I want 'good' values for my line parameters, I need to
account for this somehow.


Tim Handley
Fire Effects Monitor
Santa Monica Mountains National Recreation Area
401 W. Hillcrest Dr.
Thousand Oaks, CA 91360
805-370-2347




More information about the R-help mailing list