Skip to content

Moran's I based on ZIP Code data

2 messages · Michael Haenlein, Roger Bivand

#
On Thu, 19 Aug 2010, Michael Haenlein wrote:

            
The first thing is to get the locations of the zip codes (about 30,000?) - 
they are published as shapefiles by state (US Census ZCTA), so a polygon 
representation is possible, but you could also look for a point 
representation. Next make a neighbour list (nb) object to the zip code 
entities for which you have observations. Then you could use nb2blocknb() 
in spdep to "block up" observations where more than one belongs to the 
same zip code, which effectively makes all the observations in a zip code 
neighbours, and adds all the observations in neighbouring zip codes too. 
It was written for housing data with only a postcode but no geocoded 
address.

Hope this helps,

Roger