[Openspace] Multiple observations per location in GeoDa

Roger Bivand Roger.Bivand at nhh.no
Sun Nov 11 08:09:46 CST 2007


On Sun, 11 Nov 2007, Graeme Byrne wrote:

> Hi all, I have spatial regression problems where there are multiple 
> observations per locations. One particular model has cases for males and 
> females from the same place and I want to estimate the effect of gender 
> (via a dummy variable) as well as the effect of some gender specific 
> covariates. I can create a shape file from MapInfo but GeoDa requires a 
> unique location for each case so at the moment I am fitting separate 
> models for males and females which works but reduces the power of 
> statistical tests. Ideally I would like to include gender and possibly 
> other factors (e.g. Age) in a single SAR or SE model. Are there R 
> routines available or can GeoDa be coerced into doing this

A very preliminary R version would reshape to long and build a blocked-up 
set of spatial weights:

library(spdep)
data(columbus)
MCRIME <- rnorm(49, 45, sd(columbus$CRIME))
FCRIME <- rnorm(49, 25, sd(columbus$CRIME)/2)
df <- data.frame(CRIME=c(MCRIME, FCRIME), HOVAL=rep(columbus$HOVAL,2),
   INC=rep(columbus$INC,2))
m49 <- listw2mat(nb2listw(col.gal.nb))
z49 <- matrix(0, 49, 49)
m98 <- rbind(cbind(m49, z49), cbind(z49, m49))
l98 <- mat2listw(m98)
l98 <- nb2listw(l98$neighbours)
lm98 <- lm(CRIME ~ HOVAL + INC, df)
summary(lm98)
lm.morantest(lm98, l98)
summary(l98)

The summary of the spatial weights shows that this is preliminary, because 
the region.id attributes are no longer unique, but unless they are used 
for look-up by the user, this is only a cosmetic problem.

The same trick could be used to create a GAL file for GeoDa, but you'd 
need a "long" format *.dbf to get the data in, I think. I'm not sure what 
the Mi, Fi elements of spatial weights should be, here the off-diagonal 
blocks are just set to zero.

Hope this helps,

Roger

>
> Graeme
> _______________________________________________
> Openspace mailing list
> Openspace at sal.uiuc.edu
> http://sal.uiuc.edu/mailman/listinfo/openspace
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the Openspace mailing list