[R-sig-Geo] algorthirm to join polygons based on population properties

Roger Bivand Roger.Bivand at nhh.no
Tue Jan 7 09:28:48 CET 2014


On Tue, 7 Jan 2014, James Rooney wrote:

> Dear all,
>
> I have dataset with very many more polygons than cases. I wish to apply 
> Bayesian smoothing to areal disease rates, however I have too many 
> polygons and need a smart way to combine them so that there are less 
> overall polygons.
> Bascially I need to only combine polygons of similar population density 
> and it would be best if the new polygons have a distribution of total 
> population that was within a limited range/normally distributed.

This is not clear. Do you mean density (count/area) or just count? If you 
have "too many polygons", then probably you haven't thought through your 
sampling design - you need polygons with the correct support for the data 
collection protocol used. Are you looking at postcode polygons and sparse 
geocoded cases, with many empty postcodes? Are postcodes the relevant 
support?

If you think through support first (Gotway & Young 2002), then ad hoc 
aggregation (that's the easy part) may be replaced by appropriate 
aggregation (postcodes by health agency, surgery, etc.). The aggregation 
can be done with rgeos::gUnaryUnion, but you need a vector assigning 
polygons to aggregates first, preferably coded so that the data can be 
maptools::spCbind using well-matched row.names of the aggregated 
SpatialPolygons and data.frame objects to key on observation IDs.

First clarity on support, then aggregate polygons to appropriate support, 
then merge. Otherwise you are ignoring the uncertainty introduced into 
your Bayesian analysis by the aggregation (dfferent aggregations will give 
different results). There are good chapters on this in the Handbook of 
Spatial Statistics by Gelfand and Wakefield/Lyons.

Hope this clarifies,

Roger

>
> I can of course come up with some way of doing this myself, but I'm not 
> keen to reinvent the wheel and so I am wondering - are there any smart 
> algorithms already out there for doing this kind of thing ?
>
> Thanks,
> James
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
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 R-sig-Geo mailing list