Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: proportional random sampling


From   Cameron McIntosh <cnm100@hotmail.com>
To   STATA LIST <statalist@hsphsun2.harvard.edu>
Subject   RE: st: proportional random sampling
Date   Mon, 24 Oct 2011 22:51:27 -0400

Steve,
I think that if you described the motivation for this exercise, it might help elicit advice -- perhaps some that even suggests an alternative way of looking at your problem, whatever that may be. :)
Thanks,
Cam

----------------------------------------
> From: scnakone@ucalgary.ca
> To: statalist@hsphsun2.harvard.edu
> Date: Mon, 24 Oct 2011 17:15:20 -0600
> Subject: st: proportional random sampling
>
> Dear Statalisters,
>
> I have a small dataset (n=44) from which I want to draw a random sample of records. The distribution of these records across my variable of interest in approximately 2:1. What I wish to do is to create a random sample of records of size n that retains the proportional distribution across my variable of interest.
>
> Assuming a random sample where n=12, I wrote the following code:
>
> sort ecs
> by ecs: sample 8,count
> sample 50 if ecs==1
>
> ------
> Although how I coded it certainly works, what I am wondering if there is a more elegant means of coding to achieve a similar result?
>
>
> Thanks,
> Steve
> *
> * 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/
 		 	   		  
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index