[R-sig-Geo] Complete neighbours

Roger Bivand Roger.Bivand at nhh.no
Sun Sep 5 21:14:46 CEST 2010


On Fri, 3 Sep 2010, German Sanchez Hernandez wrote:

> Dear list,
>
> I would like to complete my neighbour list in order to increase the 
> number of neighbours of regions with less neighbours (links) than a 
> certain number. The idea is to complete these links using knearneigh 
> function.
>
>
> My try:
>
> nb <- poly2nb(map)
> # Compute distribution of linkage:
> distr <- as.data.frame(table(card(nb)))
> # Try to identify the "isolated" regions (equal or less than, for example, 3 neighbours
> minim <- 3 # It's a computed number
> isolated <- subset(nb, subset=card(nb) <= minim)
> # Get the "isolated" region IDs
> regions <- attr(unclass(isolated), 'region.id')
> # Modify nb using knearneigh ¿?

For the edited version of nblag_cumul on R-forge on the spdep project, 
you'd do something like:

example(columbus)
table(card(col.gal.nb))
k4 <- knn2nb(knearneigh(coordinates(columbus), 4))
mod_nb <- nblag_cumul(list(col.gal.nb, k4))
table(card(mod_nb))

but I'm not at all sure that this is a good idea. Most often observations 
with few neighbours are on the edge of the data set, so there is a very 
good reason for their apparent "isolation".

Hope this helps,

Roger

>
>
> # Alternative 2:
> nbmat <- nb2mat(nb)
> # Modify nbmat ¿?, mat2listw, listw2nb
>
>
> # Alternative 3:
> listw <- nb2listw(nb)
> # Modify listw ¿?, listw2nb
>
>
> The question is:
>
> How to modify nb (or nbmat or listw) to increase the number of links of 
> the "isolated" regions?
>
> Any idea?
>
> Thank you!
> Germán Sánchez
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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 R-sig-Geo mailing list