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]
[no subject]
input x prob
1 .2
2 .1
3 .3
4 .3
5 .1
end
gen int fw = 100000*prob
expand fw
bsample 10000, weight(fw)
tab x if fw>0
It would be handy if can have this in a single command, say something
like
-sample(x=1:5, N=10000, prob=(0.2,0.1,0.3,0.3,0.1), replace=TRUE)- for
general use purpose.
Cheers
Ning
*
* 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/