[R] Spatial autocorrelation
Thibaut Jombart
jombart at biomserv.univ-lyon1.fr
Mon Oct 22 15:43:41 CEST 2007
Geertje Van der Heijden wrote:
>Hi,
>
>I have collected data on trees from 5 forest plots located within the
>same landscape. Data within the plots are spatially autocorrelated
>(calculated using Moran's I). I would like to do a ANCOVA type of
>analysis combining these five plots, but the assumption that there is no
>autocorrelation in the residuals is obviously violated. Does anyone have
>any ideas how to incorporate these spatial effects in my analysis? I
>have been reading up on autoregressive techniques, but I am not sure if
>it works with more than one plot.
>
>All help is greatly appreciated!
>
>Many thanks,
>Geertje van der Heijden
>
>
>
Hi,
one way to remove spatial autocorrelation is to use Moran's Eigenvectors
as predictors in multiple regression. But as there are always n-1
vectors for n points, you will have to choose the predictors to be
retained (using standard model selection procedures).
Here is an example of how to get the eigenvectors using the ade4 and
spdep packages.
library(ade4)
library(spdep)
library(adegenet)
xy = matrix(rnorm(100),ncol=2)
plot(xy)
# get a connection network (here, Delaunay triangulation)
cn = chooseCN(xy,ask=FALSE,res="listw")$cn
# get Moran's Eigenvectors
U = orthobasis.listw(cn)
# visualize the first 9 vectors
par(mfrow=c(3,3))
for(i in 1:9) s.value(xy,U[,i],addaxes=FALSE, include.ori=FALSE)
And then you can use the columns of U as spatial predictors in your
model. A few vectors should be able to remove the autocorrelation among
residuals.
Regards,
Thibaut.
--
######################################
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
jombart at biomserv.univ-lyon1.fr
http://lbbe.univ-lyon1.fr/-Jombart-Thibault-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/
More information about the R-help
mailing list