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: random samples within each of 1,152 categories


From   Steve Samuels <[email protected]>
To   [email protected]
Subject   Re: st: random samples within each of 1,152 categories
Date   Wed, 8 May 2013 17:30:40 -0400

I don't follow your thinking here.

Questions:

1. Are the original data from a sample survey? If so, what is the design?

2. What's the goal of your analysis?

3.. Here is a hypothetical category of individuals (one of
the 1,152), classified by your "Non-working female" criterion:
            
                    
Non-Working Female   Other      Total
17                     33         50

The percentage of non-working females is 34%.

What will the numbers in the sample of this category look like?


Steve



On May 7, 2013, at 9:18 PM, Olga Gorbachev wrote:

Hello,

I need to generate random samples for 1,152 categories and I am not
sure how to do it.

To be specific:

for each cell, I need to compute a fraction of not working females.  I
generated the needed fraction (swr), like this:

bys year ed white nokid wife: gen w=(work==0 & rlinc!=.)
bys year ed white nokid wife: egen sw=sum(w)
bys year ed white nokid wife: gen swr=100*sw/_N

Thus, swr gives me the percent of nonworking females within each cell.

I then  generated categories/cells using group command:

egen x=group(ed wife nokid white year)

this gave me 1,152 groups.

Thus, for each x I have a number given by swr that tells me what
percentage I want to sample. So for x=1, swr=43.2

Thus, I'd like to 'designate' randomly for x=1 if work=1 43.2% of
females to be not working. And I'd like to do this for each x.
Ultimately, I'll need to sample with weights.

I tried using gsample, but was unable to figure out the syntax for the
looping that I think I'll need to do for this problem.

Thank you in advance for your help.

--
Olga Gorbachev
Assistant Professor of Economics
University of Delaware
Newark, DE 19716
*
*   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/

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