[R-sig-ME] spatial autocorrelation as random effect with, count data

Highland Statistics Ltd highstat at highstat.com
Wed Jan 10 23:35:55 CET 2018

Try R-INLA.....much easier.



Message: 4
Date: Wed, 10 Jan 2018 16:59:02 -0400
From: Sima Usvyatsov <ghiaco at gmail.com>
To: R-sig-mixed-models at r-project.org
Subject: [R-sig-ME] spatial autocorrelation as random effect with
	count data
	<CAFGTTqT8cDbDeKg2cikgdBkjAGz0spXakoEne7EmA28D3vVjgg at mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"


I am working on a spatially autocorrelated dataset with a negative binomial
(count) response variable. I have been using the glmmPQL approach (MASS),
but I seem to have a hard time fitting the fixed effects. I came across the
mention that one could build the spatial autocorrelation into a random
effect (https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q1/015364.html).

I've done some searching but could not find a straightforward example of
this practice. I have 20 sampling locations (sampled repeatedly to a 4,000
point dataset) and I know that there is spatial autocorrelation between
them (by looking at autocorrelation plots of a naive model). The 20 grid
points are clustered into 4 strata, and I am interested in the strata
effects (so would like to keep the strata as fixed).

How would I go about expressing the spatial autocorrelation in this setup?
In the future I'd like to explore GAMs for this application, but for now
I'm stuck with a GLM approach... I would love to be able to use glmer()
with a random effect that expresses spatial autocorrelation.

Here's a fake dataset.


df <- data.frame(Loc = as.factor(rep(1:20, each = 5)), Lat = rep(rnorm(20,
30, 0.1), each = 5), Lon = rep(rnorm(20, -75, 1), each = 5), x =
rnegbin(100, 1, 1), Stratum = rep(1:5, each = 20))

Thank you so much!

	[[alternative HTML version deleted]]


Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: highstat at highstat.com
URL:   www.highstat.com

NIOZ Royal Netherlands Institute for Sea Research,
Department of Coastal Systems, and Utrecht University,
P.O. Box 59, 1790 AB Den Burg,
Texel, The Netherlands

Author of:
1. Beginner's Guide to Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA. (2017).
2. Beginner's Guide to Zero-Inflated Models with R (2016).
3. Beginner's Guide to Data Exploration and Visualisation with R (2015).
4. Beginner's Guide to GAMM with R (2014).
5. Beginner's Guide to GLM and GLMM with R (2013).
6. Beginner's Guide to GAM with R (2012).
7. Zero Inflated Models and GLMM with R (2012).
8. A Beginner's Guide to R (2009).
9. Mixed effects models and extensions in ecology with R (2009).
10. Analysing Ecological Data (2007).

More information about the R-sig-mixed-models mailing list