Hello,

I got an error message after running the following R code:

Error in moran.test(resid(mod.lm), ga159_mat) :  objects of different length

# load data
srm <- read.csv("srm.csv",sep=",",header=T)
ga159.shp <- readShapeSpatial("srm.shp")
data <- srm

# create a weight matrix
ga159w <- poly2nb(ga159.shp, queen=T)
ga159w_mat <- nb2listw(ga159, style="B", zero.policy=TRUE)

# Linear Model
mod.lm <- lm(Rate_A ~ BlackZ + PopDenZ + MFIncomeZ + LanZ + Less9Z, data =
data)
summary(mod.lm)
moran.test(resid(mod.lm),ga159w_mat)

srm.shp is a shapefile including 159 counties in Georgia.

Thanks!

Wei

	[[alternative HTML version deleted]]

