--- On Wed, 14/10/09, Michael McCulloch wrote:
> Using the following simulation, I create two groups: #1 =
> mean age 50, #2 = mean age 60.
> I'm seeking some guidance on how to create variable
> newgroup, such that newgroup A and B will have equal age
> distribution.
What about this:
*-------------- begin example --------------------
clear
set obs 1000
gen group=1
replace group=2 in 501/1000
gen id=_n
set seed 12358
gen age = 50+10 * invnorm(uniform()) if group==1
replace age = 60+10 * invnorm(uniform()) if group==2
hist age, by(group)
gen newgroup = runiform() < .5
table newgroup, c(mean age)
*---------------- end example ----------------------
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/