Statalist


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

st: iid draw from a truncated normal distribution


From   "Alexander Kalb" <[email protected]>
To   <[email protected]>
Subject   st: iid draw from a truncated normal distribution
Date   Mon, 22 Sep 2008 15:01:58 +0200

I would like to create an iid draw form a truncated normal distribution
(on the left and right side) with standard deviation 0.5 (in the
untruncated case). I tried the following commands:

set obs 10000
gen c = -2  /*left truncation point*/
gen d = 2 /*right truncation point*/
gen stdv = 0.5  /*standard deviation*/
gen v = uniform()
gen c_bar = c/stdv
gen d_bar = d/stdv
gen v_bar = (normal(c_bar) + (normal(d_bar) - normal(c_bar))*v)
gen u = stdv*invnorm(v_bar)

This seems to work but it shifts the truncation points below 2 and
above -2. Has anybody an idea how I can get an iid draw (with standard
deviaton of 0.5 in the untruncated case) which does not shift the
truncation points?

Zentrum für Europäische Wirtschaftsforschung GmbH (ZEW) 
Centre for European Economic Research 
L 7, 1 · 68161 Mannheim · Germany 
Sitz der Gesellschaft: Mannheim · Amtsgericht Mannheim HRB 6554 
Aufsichtsratsvorsitzender: Gerhard Stratthaus MdL, Finanzminister a.D. 
Geschaeftsfuehrer: Prof. Dr. Dr. h.c. mult. Wolfgang Franz, Thomas Kohl
------------------------------------------------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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