Skip to content

Moran's I based on ZIP Code data

5 messages · Michael Haenlein, Sharon O'Donnell, Nikhil Kaza +2 more

#
The national files for the zipcodes seems greyed out. I would caution  
against creating nb lists for each state separate and then creating a  
US wide neighbour list because, there will some zip codes in Alabama  
who are neighbours to  zipcodes in GA, MS, TN. I would merge them  
first into one big file and then construct the poly list.  you may run  
into memory issues for this operation, depending on your set up.


Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina

nikhil.list at gmail.com
On Aug 20, 2010, at 1:06 PM, Sharon O'Donnell wrote:

            
#
On Fri, 20 Aug 2010, Michael Haenlein wrote:

            
Combine the imported SpatialPolygonsDataFrames, possibly after filtering 
out the ones with no hits, and possibly after checking for ZIP uniqueness. 
If not unique (if a ZIP crosses a state boundary or if the input maps 
assign a single ZIP code to multiple Polygons objects) use 
unionSpatialPolygons in maptools (usual warning about gpclib) or 
gUnionCascade() in rgeos. If you can install rgeos, you can also speed up 
the poly2nb() step for the whole map by providing a GEOS-generated list of 
candidate neighbours.

It is feasible, but perhaps tedious - there are a lot of polygons!

Good luck!

Roger

  
    
#
Nikhil has a point here. The combined shapefile is > 1 GB.
As I am into working with national census datasets (and would eventually 
like to do the same for tracts and blocks), I created a neighbor list 
and then a weights list. The latter required using the zero.policy=TRUE 
switch as we are working with many islands that have no topological 
neighbors. I uploaded the two as R objects to 
http:giscience.hunter.cuny.edu/zcta/zcta.nb.R and 
http://giscience.hunter.cuny.edu/zcta/zcta.w.R.
Cheers,
    Jochen
Nikhil Kaza wrote: