Hi everyone,
I am struggling to generate random points around a fixed point (defined by latitude and longitude) in Stata.
Here is a snapshot of data:
I was able to generate random points, however, they seems to be very far apart and mixed with other centroids. I am latter using these random points in the grmap command for choropleth mappping. I used the following following codes.
Some of these points are good to go, but some were not identifiable with respect to its centroids.
Does anyone know how to drawn these random number in a circle around the centroids(lat,long in data) that does not get mixed with other points in the data.
Thanks and appreciation.
I am struggling to generate random points around a fixed point (defined by latitude and longitude) in Stata.
Here is a snapshot of data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int _ID double(_CX _CY) float points 111 181.0026701446173 -103.6144711763335 2 35 179.83644482349095 -102.25931438232391 2 95 173.62410139032926 -108.25203422744671 7 120 176.696210689136 -109.6219042419326 2 126 177.62000961513976 -109.32669927586673 4 21 178.2751472150729 -104.06769361471842 4 18 175.99721564981806 -108.14985411307012 4 60 178.872501415726 -102.72883884892121 3 119 176.90713462711736 -109.26361044014674 1 20 178.09477094181506 -105.2803015017441 5 40 176.37581822494718 -107.06071352670077 2 36 176.2594233462089 -105.51304940173509 3 34 178.38042942412704 -102.75056129345269 2 69 176.36218391402446 -106.42921144019289 3 97 175.82515586054384 -104.95031844141755 3 51 172.8322553280801 -108.84294571923179 8 77 175.52420409001067 -105.79796467844942 5 3 174.49476863694187 -108.68563432712384 8 25 178.91401313578396 -102.5597069872018 1 14 179.57927904199687 -103.20172421743248 4 end
Code:
expand points gen y = _CY + runiform(0, .1) gen x = _CX + runiform(0, .1) scatter y x,msize(.5)
Does anyone know how to drawn these random number in a circle around the centroids(lat,long in data) that does not get mixed with other points in the data.
Thanks and appreciation.
Comment