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]

st: How to generate a censored random variable


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

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/


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