Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: distance-based grouping


From   "Anirudh V. S. Ruhil" <[email protected]>
To   [email protected]
Subject   st: distance-based grouping
Date   Sat, 09 Dec 2006 18:36:21 -0500

Given the following data:

nest_id nest_id distance
0 408 67.38784
0 35 55.74133
0 299 72.978
0 496 96.11179
0 373 62.25668
0 466 32.23399
0 358 52.49713
0 0 0
0 42 90.56657
0 407 75.57355
1 161 21.8282
1 128 30.91449
1 373 91.10458
1 465 54.24871
1 496 68.08784
1 1 0
1 42 61.35756
1 34 21.97413

where "nest_id" flags unique bird nests, and "distance" is measured in feet.

I need to identify all nests within a specified distance (for e.g., 100) of each other, and thus create unique clusters of nests. These clusters will contain nests that show up once per cluster but may show up in more than one cluster (for e.g., nest 496 shows up in the same cluster as nest 0, shows up again in a different cluster with nest 1, but nest 0 and nest 1 are not in a common cluster). Hopefully my articulation of the problem is comprehensible, and someone has a clue as to the appropriate syntax. I need to be able to run this code for nests along several miles of a river so anything that cuts down on manual labor would be invaluable.

best

Ani
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index