Statalist The Stata Listserver


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

Re: st: Sampling from a uniform distribution - suggestion


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: Sampling from a uniform distribution - suggestion
Date   Wed, 20 Jun 2007 14:57:58 -0400

How about:

  set obs 1000
  gen X =  uniform()*(60-10)+10
  replace X = uniform()*(3000-2000)+2000 if mod(_n,6)==0

?
hth,
Jeph

[email protected] wrote:
Dear statalisters,

I would like to generate a random variable X (say 1000 new observations)
wih an uniform distribution on the interval [10, 60].

That�s ok (using Stata):

set obs 1000
gene X =  uniform()*(60-10)+10

However, due to empirical observations from our laboratory experiments (to
produce a more realistic dataset), I have interest in adding one
observation on the interval [2000, 3000] after 5 observations on the
interval [10, 60]. Example:

28 42 12 56 41 2658 26 14 47 59 43 2157 ....

Is there a simple way to generate such kind of observations using Stata?

Thank you for all your help.

Best regards,

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/


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