| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: sampling problem
I have been trying a number of ways of sampling. I want to use the samplepps
command which has the following syntax:
samplepps newvar, withrepl size(varname) ncases(integer)
What I want to do is to create a program which will run this command several
times. The problem is that I want the ncases(integer) to be different. I
have a vector of values which I want ncases to take on. So I run I may have
5 different values in my vector. I want to run samplepps five times with
ncases taking on the value of the first row of the vector for the first
time, the second row the second time and so on.
Is there any quick way of doing this or do I just have to manually enter the
number each time?
Thank you,
John
I want to sample data on the basis of counterfactuals - so what would the
distribution of income in 2007 look like if individuals had the distribution
of health of 1985.
So imagine I have the following data
id income2007 health2007 health1985
wgt1985
1 10 1 1
65.38
2 10 1 1
153.91
3 20 1 1
458.34
4 20 1 1
484.2
5 40 2 1
906.1
6 40 2 4
943.96
7 60 4 5
1176.87
8 60 4 5
1389.91
9 100 5 5
1716.93
10 100 5 5
4067.68
where weight is the sampling weights for the 1985 data (I also have sampling
weights for the 2007 data). The order of the 1985 data makes no difference
to the 2007 data it is just pasted in to obtain the health distribution.
What I want to do is sample from the 2007 data to make the distribution of
health in 2007 look like that in 1985. So I want to draw individuals from
2007 according to the distribution of health in 1985 so I draw individuals
with health=1 with prob=0.4, health=2 with prob=0, health=4 with prob=0.1
and health=5 with prob=5 (where the probabilities comes from the health1985
distribution). This should give me a hypothetical distribution of income in
2007 if the distribution of health was as in 1985.
I cannot see how to do this with the bsample command. Further I am not sure
then how to incorporate the sampling weights to ensure that my samples
correctly represent the population distributions.
Any help would be much appreciated.
Yours,
John
_________________________________________________________________
Win tickets to the sold out Live Earth concert! http://liveearth.uk.msn.com
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/