Statalist


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

st: AW: creating two groups with identical distribution of one variable


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: creating two groups with identical distribution of one variable
Date   Wed, 14 Oct 2009 22:46:42 +0200

<> 

" such that newgroup A and B will have equal age distribution"



What do you mean? "Equal" to what? To each other or to groups "1" and "2"?



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Michael
McCulloch
Gesendet: Mittwoch, 14. Oktober 2009 22:41
An: Statalist Statalist
Betreff: st: creating two groups with identical distribution of one variable

Hello Statalist folks,
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.

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)



Michael McCulloch
Pine Street Foundation
124 Pine Street
San Anselmo, CA 94960-2674
tel:	415-407-1357
fax: 	206-338-2391
[email protected]






*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index