Skip to content

Specifying neighbourhood structure for Spatial Eigenvector Mapping (SEVM) using ME() in spdep

3 messages · Xochitl CORMON, Roger Bivand

#
Dear list,

I found a message asking same kind of things I am wondering. 
Unfortunately I dont find proper answers and thus would like to update 
the topic. Maybe Xingli could you share what your learn from the authors 
with us to the questions below?

Regarding the weights, is it imperative for me to use (1-((x/4t)^2)? Can 
we just do an inverse weighting system like (1/x)? Can I also use 
weighted (C or W) instead of binary (B) weighting? Lastly, can I specify 
  the threshold distance instead of using a spanning tree algorithm?

Regards,

Xo

###### Original message
(SEVM) using ME() in spdep
Xingli Giam    Xingli Giam
Jan 27, 2009 at 9:38 am
Dear people of the R-sig-Geo list,

I am very interested in the Spatial Eigenvector Mapping (SEVM) method in
analysing my spatial data as described in your papers (Griffith and 
Peres-Neto
2006, Dormann et al. 2007).

However I am rather new to spatial analysis and therefore have some 
questions
regarding the script provided in the appendix of Dormann et al. 2007.

Code
nb1.0 <- dnearneigh(coordinates(snouter_sp), 0, 1.0)

nb1.0_dists <- nbdists(nb1.0, coordinates(snouter_sp))

nb1.0_sims <- lapply(nb1.0_dists, function(x) (1-((x/4)^2)) )

ME.listw <- nb2listw(nb1.0, glist=nb1.0_sims, style="B")

sevm1 <- ME(snouter1.1 ~ rain + djungle, data=snouter.df, family=gaussian,

listw=ME.listw)

# modify the arguments "family" according to your error distribution

I hope someone who has experience in suing SEVM can give me a hand with 
some of
the questions I have.

Regarding the weights, is it imperative for me to use (1-((x/4t)^2)? Can we
just do an inverse weighting system like (1/x)? Can I also use weighted 
(C or
W) instead of binary (B) weighting in this line -ME.listw <- nb2listw(nb1.0,
glist=nb1.0_sims, style="B")? Lastly, can I specify t, the threshold 
distance
instead of using a spanning tree algorithm?

Some background information about my data - it is in long-lat 
coordinates, and
I have calculated great circle distances.

And the code I was trying to use:

nb <- dnearneigh(as.matrix(dat$x_long, dat$y_lat), 0, 4000, longlat=T)
nb_dists <- nbdists(nb, as.matrix(dat$x_long, dat$y_lat))
nb_sims <- lapply(nb_dists, function(x) (1/x))
ME.listw <- nb2listw(nb, glist=nb_sims, style="W", zero.policy=T)

sevm1 <- ME(lg.sp1 ~ lg.area, data=dat, family=gaussian, listw=ME.listw)
lmlag1 <- lm(lg.sp1 ~ lg.area + fitted(sevm1), data=dat)
moran<- moran.test(residuals(lmlag1), listw=ME.listw, na.action=na.omit,
zero.policy=T)
moran


Thank you in advance for your help! Hope to hear from you soon!

Many thanks,
Xingli
######
#
You asked the same question yesterday (but simply added it to the original 
thread from 2009). Do read the instructions for posting and the posting 
guide. This is not a question concerned with the use of software, indeed, 
had you used the software, you could have examined the questions you ask 
empirically. Usually, no response to a posting results from a question 
with little relevance, so repeating it is not a good idea at all.

You do not indicate having read anything, the original thread mentioned 
Dormann et al. (2007) - are you aware of subsequent publications on using 
PCNM/Moran eigenvectors/Spatial filtering, and if not, why not? There are 
of course no theoretical reasons for not using different weighting 
schemes; the schemes used are user choices, as you would realise if you 
had taken time to study the literature. Have you read Borcard et al. 
(2011):

http://www.springer.com/statistics/life+sciences,+medicine+%26+health/book/978-1-4419-7975-9

Section 7.4?

With regard to your questions, of course you can, but it is your judgement 
as a researcher that should guide your choices, never advice from list 
members - it is your responsibility entirely.

Roger
On Fri, 13 Sep 2013, Xochitl CORMON wrote:

            

  
    
#
Dear Roger Bivand,

thank you for your answer. Indeed yesterday I tried to post the question 
however I received a warning telling me that I was not allowed to post 
(I did not register yet to the mailing list), so I assumed the post did 
not go through. I apologize for the double post.

I am actually working with Dormann et al, 2007 review and their appendix 
with the R script. In addition I am also using the Borcard et al., 2011, 
mainly pages 275 - 277. I just do not understand the differences between 
the two scripts and of course I am aware this come mainly from a lack of 
theoretic knowledge in GIS. However Xingli said in the precedent thread 
that he go info directly from the author.. Unfortunately he do not share 
them (quite frustrating I would say), I tried to send an email to Xingli 
directly but the address he used for the post is not working anymore 
that's why I asked the same questions.

To go further with my analysis I tried the script of Dormann et al 2007 
and the ME function from spdep package you developed. After running the 
code below I plotted a new autocorrelogram but the first 6 lags where 
still significant on Moran test on residuals error with values really 
similar to first model (modelQ1). I do not understand why (I could see a 
really strong effect using the autocovariate method (Moran Index dropped 
from 0.20 to 0.006). I am not sure if there is some theoretic concept I 
do not get or if I do something wrong in the code.

Finally, Borcard and al. advise to consult the documentation of 
spacemakeR package. Unfortunately I could not find it online.

Thank you again for your answer and sorry if I am out of the range of 
this mailing list but I cannot really disentangle what comes from my 
lack of knowledge in GIS and what comes from my lack of knowledge in R.

Xochitl C.

##### R code #####

modelQ1 <- glm(data = datafit, family = binomial, formula = OverlapSH ~ 
Presence.HG.Juv + Presence.HG.Adu + Presence.C.Adu + TempMean + 
DepthMean + DepthMean2 + Latitude + Longitude3)

coords <- as.matrix(cbind(dataframe$LongitudeCor, dataframe$LatitudeCor))

#Dormann et al., 2007 Appendix
data_sp <- SpatialPixelsDataFrame(as.matrix(datafit[,5:4]), datafit)
nb1.0 <- dnearneigh(coordinates(data_sp), 0, nbtresh)
nb1.0_dists <- nbdists(nb1.0, coordinates(data_sp))
nb1.0_sims <- lapply(nb1.0_dists, function(x) (1-((x/4)^2)) )
ME.listw <- nb2listw(nb1.0, glist=nb1.0_sims, style="B", zero.policy = TRUE)

Q1sevm <- ME(data = datafit, family = binomial, formula = OverlapSH ~ 
Presence.HG.Juv + Presence.HG.Adu + Presence.C.Adu + TempMean + 
DepthMean + DepthMean2 + Latitude + Longitude3, listw=ME.listw, alpha = 
0.05)

modelQ1sevm <- update(modelQ1, .~. + fitted(Q1sevm))
summary(modelQ1sevm)
anova(modelQ1sevm, test = "Chi")

modeltest <- modelQ1sevm
modeltestN <- "modelQ1sevm"

nb1 <- dnearneigh( as.matrix( cbind(datafit$LongitudeCor, 
datafit$LatitudeCor)), 0, nbtresh)
corelog <- sp.correlogram( nb1, rstandard(modeltest), order=10, 
method="I", zero.policy=TRUE)
plot(corelog, main = paste("Spatial auto correlation", modeltestN, sep= 
" "))

###############

<>< <>< <>< <><

Xochitl CORMON
+33 (0)3 21 99 56 84

Doctorante en sciences halieutiques
PhD student in fishery sciences

<>< <>< <>< <><

IFREMER
Centre Manche Mer du Nord
150 quai Gambetta
62200 Boulogne-sur-Mer

<>< <>< <>< <><



Le 13/09/2013 14:25, Roger Bivand a ?crit :