Generating string variable(s) specifying neighbours
neigh locivar locjvar [weightvar] , generate(newvar) [ wgenerate(newweightvar) ]
Description
neigh converts spatial neighbourhood information of the form
locivar locjvar (optionally) weightvar ------- ------- ---------------------- 1 2 0.123 1 3 0.456 1 4 0.421
into the form
locivar newvar (optionally) newweightvar ------- ------- ------------------------- 1 "2 3 4" "0.123 0.456 0.421"
That is, locations 2, 3 and 4 are neighbours of location 1. (The degree of neighbourliness - perhaps determined by distance and/or length of common boundary - is indicated by the weights specified.)
Remarks
neigh is a utility for users of spautoc.
It is envisaged that a dataset of neighbourhood information given by two variables containing numeric identifiers will be converted to a dataset containing one numeric identifier and one single string variable, for merging with a normal data file. Optionally, a numeric weight variable will also be packed into a new string variable.
Options
generate() specifies a new variable to contain information. It is a required option.
wgenerate() specifies a new variable to contain weight information.
Examples
. neigh i j, gen(neigh) . neigh i j w, gen(neigh) wgen(W)
Author
Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk
Also see
On-line: help for spautoc, dupneigh, numids