Bookmark and Share

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


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

Re: st: Matching procedure based on shortest distance given latitudes and longitudes


From   brendan.halpin@ul.ie (Brendan Halpin)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Matching procedure based on shortest distance given latitudes and longitudes
Date   Thu, 09 Feb 2012 11:58:35 +0000

On Thu, Feb 09 2012, Rüdiger Vollmeier wrote:

> Does anybody have an idea for a nice solution or is there even a
> command out there that would match based on distance given the
> latitudes and longitudes?

Given a pairwise distance, I'd look at the strategy used by -psmatch2-
to match a case to the case with the closest propensity score. It seems
that the problem is the same. I'm not sure how easy it would be to
extract the relevant functionality, though (it seems to lie mostly in
the match_pscore mata function).

Here's a crude but simple formula to map lat/lon to kilometres:

dist = 111.6234927323819 * sqrt((lat1 - lat2)^2
       + (cos(0.5 * pi * (lat1 + lat2)/180.0) * (lon1 - lon2))^2)

(a fair approximation if lat1 and lat2 are not too different). 

Brendan
-- 
Brendan Halpin,   Department of Sociology,   University of Limerick,   Ireland
Tel: w +353-61-213147  f +353-61-202569  h +353-61-338562;  Room F1-009 x 3147
mailto:brendan.halpin@ul.ie    ULSociology on Facebook: http://on.fb.me/fjIK9t
http://teaching.sociology.ul.ie/bhalpin/wordpress         twitter:@ULSociology

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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