Skip to content

How to build a spatial weights list for pooled data

2 messages · Angela Parenti, Roger Bivand

#
Hello Roger and everybody else.

I have another question about Weight Matrices. For one of my models I 
estimate a pooled regression. Then, in order run the Moran test on the 
pooled regression residuals I need to construct a spatial weights list 
of the same dimension.
I already found the way for the spatial matrix built on the inverse 
distance between neighbours. Here the code for inverse distance matrix:

#####################
# Moran's Test for spatial effects
sampleCentroid.Pooled <- 
rbind(samplecentroid.europeReorderedCamEcon,samplecentroid.europeReorderedCamEcon)
eu.regions.nb_pooled <- dnearneigh(sampleCentroid.Pooled[iii,], 0, 
max(distanceMatrix), row.names=NULL, longlat=TRUE)
coords_pooled <- sampleCentroid.Pooled[iii,]
dlist_pooled <- nbdists(eu.regions.nb_pooled, coords_pooled, longlat=TRUE)

dlist1_pooled <- lapply(dlist_pooled, function(x) 1/(x^2))
eu.regions.w1_pooled <- nb2listw(eu.regions.nb_pooled, 
glist=dlist1_pooled, style="W", zero.policy=TRUE)

moranTestmodelI_w1 <- lm.morantest(modelI, 
eu.regions.w1_pooled,zero.policy=TRUE, alternative="two.sided")
print(rbind(c("Global Moran's I for Model I","w1_EK","bivand",""),
            c("Observed Moran's I", "EI", "VI", "p-value"),
            
c(as.numeric(moranTestmodelI_w1$estimate[1]),as.numeric(moranTestmodelI_w1$estimate[2]),
            
as.numeric(moranTestmodelI_w1$estimate[3]),moranTestmodelI_w1$p.value)
            ))
######################

Differently, I didn't understand yet how to build a spatial weights list 
for pooled data in case of first-order contiguity matrix. Can you help me?

Thank you in advance,
Angela Parenti
3 days later
#
On Thu, 14 Oct 2010, Angela Parenti wrote:

            
By "pooled", do you mean an NxT by NxT matrix? Is your data 
spatio-temporal in that case? How large is N, and how large T? Did your 
IDW procedure induce "spatial" relations above and below the block 
diagonal, or do you just need T replicated N by N weights matrices down 
the block diagonal? You may have a result from IDW, but is it what you 
think it is - should d_{itjt} == d_{itj(t-1)} == d_{itj(t+1)} and so on?

To create a contiguity matrix, you can use graph-based methods listed 
under ?graph2nb or contiguity using ?poly2nb, for which you do need the 
boundaries of your regions as for example a shapefile.

Roger