Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | graupel75@gmail.com |
To | Statalist <statalist@hsphsun2.harvard.edu> |
Subject | st: Randomize points to map polygons using -spmap- ? |
Date | Mon, 15 Jul 2013 23:13:56 +0800 |
Dear Statalist, Any thoughts on the possibility of randomizing in space a given number of points to polygons (say, states, districts, etc) using Maurizio Pisati's -spmap- (from SSC)? ******** Example starts here ******** * cd "User/Data/" ssc install spmap ssc install shp2dta * open-source shapefile for Andorra(AND) copy "http://gadm.org/data/shp/AND_adm.zip"; AND_adm.zip, replace unzipfile AND_adm.zip, replace shp2dta using "AND_adm1", database(ADMdb) coordinates(ADMcoord) genid(id) replace use ADMdb, clear gen cases = ceil(uniform() * 25) desc * use ADMcoord, clear * desc ******** Example ends here ******** How to randomize 'cases' within 'NAME_1' and export the coordinates? Thanks for taking a look- cheers- Andrew Lover ___________________________________________________________ Epidemiologist Centre for Infectious Disease Epidemiology Research (CIDER) Saw Swee Hock School of Public Health National University of Singapore * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/