Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73388

Help: how to identify nearest neighbor for one variable and calculate the distance

$
0
0
Dear all,

I have a problem to calculate the smallest difference between observations in each group in one variable. Could you please help me to calculate the distance between observation and its closest value observation? Thanks!

For example, my data sample looks like:

Group Var1
1 1
1 3
1 5
1 2
2 3
2 5
2 6
2 9

Viewing all articles
Browse latest Browse all 73388

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>