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]

st: Randomize points to map polygons using -spmap- ?


From   [email protected]
To   Statalist <[email protected]>
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/


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