[R-sig-Geo] Why PCNM (MEM) approach cannot remove spatial autocorrelation in the residuals?

niv de malach nivdemalach at gmail.com
Wed Nov 15 12:01:41 CET 2017


Attaching the code and the dataset:


# code
library(spdep)
library(adespatial)
mydata=read.csv("example_data.csv",header=TRUE)
attach(mydata)


# creating neighbors map from the coordinates
xy=SpatialPoints(as.matrix(mydata[,c(5,6)]))
myneighbors=dnearneigh(as.matrix(mydata[,c(5,6)]), 0, 1000, row.names =
NULL, longlat = TRUE)# 1000 kilometer distance
myweight=nb2listw(myneighbors,style="W") # style W
# creating PCNM
spatial_eigenvectors=dbmem(as.matrix(mydata[,c(5,6)]),MEM.autocor="positive")

# simple regression model
alpha_lm=lm(alpha~evenness+I_A+gamma+herb_cover+woody_cover) #
summary(alpha_lm)
moran.test(alpha_lm$residuals,myweight) # significant spatial autocorelation


# regression model with all positive eigenvectors
PCNM_lm=lm(alpha~evenness+I_A+gamma+herb_cover+woody_cover+

 spatial_eigenvectors[,1]+spatial_eigenvectors[,2]+spatial_eigenvectors[,3]+

 spatial_eigenvectors[,4]+spatial_eigenvectors[,5]+spatial_eigenvectors[,6]+

 spatial_eigenvectors[,7]+spatial_eigenvectors[,8]+spatial_eigenvectors[,9]+

 spatial_eigenvectors[,10]+spatial_eigenvectors[,11]+spatial_eigenvectors[,12])

summary(PCNM_lm)
moran.test(PCNM_lm$residuals,myweight) # significant spatial autocorelation


# SAR error regression model
sar_alpha=errorsarlm(alpha~evenness+I_A+gamma+herb_cover+woody_cover,data=mydata,myweight)
summary(sar_alpha)
moran.test(sar_alpha$residuals,myweight) # no spatial autocorelation






On Wed, Nov 15, 2017 at 12:24 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:

> On Wed, 15 Nov 2017, niv de malach wrote:
>
> Hi,
>> I am trying to include spatial eigenvectors ( in my regression using
>> *dbmem
>> *command from *adespatial* package) in order to account for spatial
>> correlation. The problem is that even after including all the positive
>> eigenvectors there is still a positive significant spatial autocorrelation
>> in the residuals (based on Moran's I test). The magnitude of this problem
>> is affected by the styles I use for the spatial weight (using the styles
>> "U","W" "B" "C" of the function *nb2list* from *spdep*) but in all styles
>> Moran's I is still significantly positive.
>>
>
> Maybe there is negative residual autocorrelation, and only choosing
> eigenvectors matching positive eigenvalues is enhancing pattern jumble
> (oversmoothing the model leaving jumble in the residuals)? Do you have an
> example you could share (link to offline downloadable code+data if need be)?
>
> Roger
>
>
>> Interestingly this problem doesn't occur when I use a SAR models (
>> *errorsarlm* command from *spdep* package).
>>
>> So, does it make sense to use PCNM approach when it removes only a portion
>> the spatial autocorrelation?
>>
>> Thanks
>> Niv
>>
>>>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> --
> Roger Bivand
> Department of Economics, No
> <https://maps.google.com/?q=Economics,+No&entry=gmail&source=g>rwegian
> School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: Roger.Bivand at nhh.no
> Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
> http://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20171115/7150e96d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_data.csv
Type: text/csv
Size: 22231 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20171115/7150e96d/attachment.csv>


More information about the R-sig-Geo mailing list