Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Nearstat version

From   "P. Wilner Jeanty" <>
Subject   st: Re: Nearstat version
Date   Mon, 6 Feb 2012 10:33:26 -0600

2012/2/5 Rüdiger Vollmeier <>:
> Thanks a lot for the good advice how to run the program.
> I ve got one question regarding the programming: It seems that in case
> of non-identical observations with identical longitude and latitude,
> the programs does not return the distance 0 but calculates the
> shortest distance to non-identical latitude and longitudes. Am I
> right? This is surprising and, I guess, for many users not desired. Is
> it possible to change that (such that the distance 0 will be returned
> in these cases)?

This is a legitimate behavior by the program. Because it does not
stand to reason that two different locations have identical latitudes
and longitudes, -nearstat- thinks that it is computing the distance
between an observation and itself. In order to identify the nearest
neighbors (1st, 2nd, 3rd, and so forth), distance computed from an
observation to itself is intentionally set to missing as part of the
programming process. Ruediger's case where non-identical observations
have identical latitudes and longitudes is an unusual one. As a
result, I don't intend to modify -nearstat- to allow for it, at least
not now, unless many users want this change to be made. Without more
information, I find it odd that non-identical observations or areal
units have identical latitudes and longitudes.

FYI, a new version of -nearstat- with Mata code compiled in Stata 10.1
has been submitted to SSC.



P. Wilner Jeanty
Rice University

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index