1. uniform() is a built-in function that returns a pseudo-random number
between 0 and 1
2. setting something equal to a logical expression such as "<= 0.6" returns
1 if the condition is true, otherwise it returns 0. So for those
observations where the random number is less than or equal to 0.6, y will be
set to 1; otherwise y will be set to 0.
Al Feiveson
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Saturday, January 01, 2005 3:43 AM
To: [email protected]
Subject: Re: RE: st: RE: Random assignment
i am new to stata,so i can't understand some stat functions.
can anyone explains what the following function means--y=uniform()<=0.6.
thank you!
>Oops! Thank you -
>A.F.
>
>-----Original Message-----
>From: [email protected] [mailto:[email protected]]
>Sent: Friday, December 26, 2003 5:02 PM
>To: [email protected]
>Subject: Re: st: RE: Random assignment
>
>
>I think you meant:
>
>replace y=uniform()<=`p' if y==.
>
>Dario Consonni
>
>----- Original Message -----
>From: "FEIVESON, ALAN H. (AL) (JSC-SK) (NASA)" <[email protected]>
>Date: Wednesday, December 24, 2003 10:18 pm
>Subject: st: RE: Random assignment
>
>> Here's one way - suppose your dichotomous variable is y:
>>
>> summ y
>> local p=r(mean)
>> replace y=uniform<=`p' if y==.
>>
>> Al Feiveson
>>
>>
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]]
>> Sent: Wednesday, December 24, 2003 12:40 PM
>> To: [email protected]
>> Subject: st: Random assignment
>>
>>
>> I have a data set with 50 missing values for a dichotomous
>> variable, coded
>> 1 and 0; I would like to recode the 50 missing values to non-
>> missing,
>> inserting 1 and 0's on a random basis proportionate to their
>> presence in
>> the overall data set. Any porcedure for this sort of thing in
>> stata.
>> Thanks.
>>
>> *
>> * 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/
>>
>
>*
>* 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/
= = = = = = = = = = = = = = = = = = = =
��
��
�ٹ�
[email protected]
2005-01-01
*
* 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/