Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: How to sample uniformly over a set of specific observations?


From   tiago.pereira@incor.usp.br
To   statalist@hsphsun2.harvard.edu
Subject   st: How to sample uniformly over a set of specific observations?
Date   Sun, 14 Oct 2007 14:47:56 -0300 (BRT)

Dear Statalisters,

Suppose I have the following data set:

var1 var2 var3
0.5 0.5 0.25
0.4 0.4 0.16
0.3 0.4 0.12
0.8 0.4 0.32
0.4 0.2 0.08

In this sense, I would like to generate a new variable, say var4, which
may take one out of the 5 values presented (with equal probabilities).
I could not think about an easy way to do that using Stata when I have
several observations and, in some cases, repeated observations as well.
Hence, I will be grateful for any help.

All the best,

Tiago



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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index