Skip to content

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

4 messages · Xingli Giam, Roger Bivand

#
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
#
Hi everyone,

I hope someone can point me to the right direction in printing the eigenvalues
of selected eigenvectors using ME() of spdep. I've communicated with Dr. Pedro
Peres-Neto and he has been really helpful in answering some of my questions
about SEVM. He warned that some combinations of threshold values and weighting
schemes may generate negative eigenvalues that may not be desirable. That is
why I'm asking this question.

Thanks in advance!

Best,
Xingli
#
On Wed, 28 Jan 2009, Xingli Giam wrote:

            
The eigenvalues are not (at present) available. If you need them now, do:

debug(ME)

run your ME(...) command, and step through until you see the line:

 	eV <- eigen(Cent %*% Wmat %*% Cent, EISPACK=TRUE)$vectors

Enter:
my_eigenvalues <<- eigen(Cent %*% Wmat %*% Cent, EISPACK=TRUE)$values

then use "c" to "continue" through the debugging. This should assign the 
eigenvalues of the same matrix to my_eigenvalues in your global 
environment. Remember to say undebug(ME) afterwards.

If you (or others) would find it useful, I can add an argument to return 
the eigenvalues as an attribute of the output object when requested.

Hope this helps,

Roger

  
    
1 day later
#
Hello List,

I have been bothered by this problem for the entire day, hope someone can give
me a hand here. Thanks in advance for reading! It could be really simple and
basic so hope you guys bear with it.

We often plot Moran's I spatial correlograms that contrast glm residuals and
spatial model residuals (after incorporating spatial autocorrelation (SAC) via
SEVM, autocov reg, etc) over lag distance classes.

After deciding the most appropriate neighbourhood distance (1600 km - mine's a
global dataset), I created a list of weights via nb2listw that is an inverse
function of distance (1/distance). I then performed SEVM using the list of
weights, using the brute force ME() algorithm to extract eigenvectors that
reduce SAC.

I plan to report the Moran's I value given from moran.test() on both my (non-
spatial) GLM and Spatial GLM to prove that the spatial model has reduced
autocorrelation.

In addition to that, I plan to show the correlograms of the model residuals
both non-spatial and spatial GLMs.

I would like to ask which function is a better choice for showing the
correlograms. Should I use correlog{ncf} or sp.correlogram{spdep}. From what I
know, calculating Moran's I require definition of a neighbourhood and a
specific weighting scheme. Does anyone know what is the default neighbourhood
and weighting scheme of correlog()? Is it - if I specify an increment of 100km,
then, all points within 0-100, and then 100-200, etc, are considered neighbours
with a binary weighting scheme for each distance class?

For sp.correlogram, can I specify the nb object defined by min:0km, max:100km,
and use a lag order of, for example 50, to plot the correlogram of my spatial
model (which has a neighbourhood distance of 1600 km)?

For both functions, it seems that there is no way to incorporate my inverse-
distance weighting scheme that I used in my spatial models. Is this of
practical concern if I intend to plot my correlograms?

Lastly I have a side question regarding correlograms. When we see distances of,
e.g., 100, 200, 300, etc (the increment or lag distance is 100), on the X-axis
of a spatial correlogram, does the point at 200 refer to correlations between
neighbours of distance 100-200km apart? Or does it include the first 100km as
well (i.e., correlations between neighbours of distance 0-200km apart)?

Sorry for the long post. Many thanks for reading, I really appreciate it. I
know some are really basic questions but I can't find any answers to my
questions on google or searching through the list.

Many thanks,
Xingli