Bookmark and Share

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]

Re: st: How to generate a censored random variable


From   "Joao Ricardo F. Lima" <[email protected]>
To   [email protected]
Subject   Re: st: How to generate a censored random variable
Date   Thu, 6 Feb 2014 15:47:46 -0200

Nick,

sorry. Can you explain better?

I saw the -help f_rnormal- and the options are -rnormal()-,
-rnormal(m)- and -rnormal(m,s)- and don't know how can I change the
range -min()- and -max()- of this function.

Thanks again,

2014-02-06 Nick Cox <[email protected]>:
> Why not feed your random values to -min()- and -max()-?
> Nick
> [email protected]
>
>
> On 6 February 2014 17:28, Joao Ricardo F. Lima <[email protected]> wrote:
>> Dear Statalisters,
>>
>> How can I create a censored random variable (left=0 and right=2) in
>> Stata, with mean=0 and sigma=sdpb1?
>>
>> I was using - gen erb= rnormal(0,sdpb1)- but the variable isn't
>> censored. The mean is 0 and std error is sdpb1, but it's out of the
>> range 0-2.
>>
>> In R, the code is:
>>
>> erb[n,]=rnorm.trunc(1, t.left = 0, t.right = medb[n], mean = 0, sigma = sdpb1)
>>
>> However, I would like to do in Stata.
>>
>> Thanks a lot,
>>
>>
>> --
>> ---------------------------------------------------------
>> João Ricardo F. de Lima, D.Sc.
>> Pesquisador A - Economia Aplicada
>> Embrapa Semiárido
>> e-mail: [email protected]
>> fone: +55 (87) 3866-3667
>> home-page: www.cpatsa.embrapa.br
>> ----------------------------------------------------------
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/



-- 
---------------------------------------------------------
João Ricardo F. de Lima, D.Sc.
Pesquisador A - Economia Aplicada
Embrapa Semiárido
e-mail: [email protected]
fone: +55 (87) 3866-3667
home-page: www.cpatsa.embrapa.br
----------------------------------------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index