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: Choosing the best set of longitude/latitude coordinates from three choices


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: Choosing the best set of longitude/latitude coordinates from three choices
Date   Wed, 14 Jul 2010 16:26:55 +0000

<>

Hi Matt:

I used USC as the default when it was the minimum, but I couldn't tell from your description whether to use oshpd or intel as the default when that pair is the minimum--I picked oshpd, so you may want to change this in the loop:

******************!
clear
inp str10(oshpd_fac_no)	intel_usc_lat_diff	intel_usc_long_diff	oshpd_usc_lat_diff	oshpd_usc_long_diff	oshpd_intel_lat_diff	oshpd_intel_long_diff	oshpd_long	oshpd_lat	usc_lat	usc_long	intel_lat	intel_long
"206271717"	-2.928555	4.037598	2.928555	-4.037582	0.000000	0.000015	-121.9128	36.56206	33.63351	-117.8752	36.56206	-121.9128
"206100833"	-0.124664	0.399834	0.123066	-0.401627	-0.001598	-0.001793	-119.4988	37.10662	36.98355	-119.0972	37.10822	-119.497
"206491017"	-0.086819	0.052116	0.024086	-0.007385	-0.062733	0.044731	-122.4599	38.27798	38.25389	-122.4525	38.34071	-122.5046
"206044001"	-0.058876	-0.041939	0.058018	0.040482	-0.000858	-0.001457	-121.598	39.78528	39.72726	-121.6385	39.78614	-121.5965
"206190123"	-0.056854	-0.162796	0.054424	0.182648	-0.002430	0.019852	-118.2801	34.05378	33.99936	-118.4627	34.05621	-118.2999
"206281040"	-0.050270	-0.041695	0.000572	0.000282	-0.049698	-0.041412	-122.3058	38.31432	38.31374	-122.3061	38.36401	-122.2644
"206040974"	-0.039154	-0.023483	0.043438	0.026169	0.004284	0.002686	-121.6123	39.7707	39.72726	-121.6385	39.76641	-121.615
"206070948"	-0.038231	-0.044518	-0.001057	-0.000832	-0.039288	-0.045349	-122.132	37.88853	37.88959	-122.1312	37.92782	-122.0867
"206374019"	-0.036625	-0.008965	-0.001068	-0.000153	-0.037693	-0.009117	-116.984	32.83546	32.83652	-116.9839	32.87315	-116.9749
"206301202"	-0.033604	-0.016846	.	.	.	.	. .	33.74551	-117.8347	33.77912	-117.8179
end
	**watch for wrapping issues when you copy/paste the data above**



foreach v in lat long {
	g master_`v' = .
	 egen min_`v' = rowmin(*_`v'_diff)
		**usc as default in its pairs**
		replace master_`v' = usc_`v' if min_`v'==intel_usc_`v'_diff
		replace master_`v' = usc_`v' if min_`v'==oshpd_usc_`v'_diff
			**what if the minimum is for the intel - oshpd diff?  I chose oshpd as the default**
			replace master_`v' = oshpd_`v' if min_`v'==oshpd_intel_`v'_diff 
	  }
	order master_*
******************!
^ Note: I changed some values in your oshpd_long/lat to missing since you mentioned that there were missings in the real data.


~ Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754


On Jul 14, 2010, at 10:19 AM, Matthew Krauchunas wrote:

> oshpd_fac_no	intel_usc_lat_diff	intel_usc_long_diff	oshpd_usc_lat_diff	oshpd_usc_long_diff	oshpd_intel_lat_diff	oshpd_intel_long_diff	oshpd_long	oshpd_lat	usc_lat	usc_long	intel_lat	intel_long
> 206271717	-2.928555	4.037598	2.928555	-4.037582	0.000000	0.000015	-121.9128	36.56206	33.63351	-117.8752	36.56206	-121.9128
> 206100833	-0.124664	0.399834	0.123066	-0.401627	-0.001598	-0.001793	-119.4988	37.10662	36.98355	-119.0972	37.10822	-119.497
> 206491017	-0.086819	0.052116	0.024086	-0.007385	-0.062733	0.044731	-122.4599	38.27798	38.25389	-122.4525	38.34071	-122.5046
> 206044001	-0.058876	-0.041939	0.058018	0.040482	-0.000858	-0.001457	-121.598	39.78528	39.72726	-121.6385	39.78614	-121.5965
> 206190123	-0.056854	-0.162796	0.054424	0.182648	-0.002430	0.019852	-118.2801	34.05378	33.99936	-118.4627	34.05621	-118.2999
> 206281040	-0.050270	-0.041695	0.000572	0.000282	-0.049698	-0.041412	-122.3058	38.31432	38.31374	-122.3061	38.36401	-122.2644
> 206040974	-0.039154	-0.023483	0.043438	0.026169	0.004284	0.002686	-121.6123	39.7707	39.72726	-121.6385	39.76641	-121.615
> 206070948	-0.038231	-0.044518	-0.001057	-0.000832	-0.039288	-0.045349	-122.132	37.88853	37.88959	-122.1312	37.92782	-122.0867
> 206374019	-0.036625	-0.008965	-0.001068	-0.000153	-0.037693	-0.009117	-116.984	32.83546	32.83652	-116.9839	32.87315	-116.9749
> 206301202	-0.033604	-0.016846	-0.000050	-0.001251	-0.033653	-0.018097	-117.836	33.74546	33.74551	-117.8347	33.77912	-117.8179




*
*   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