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

st: RE: iid draw from a truncated normal distribution

From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: iid draw from a truncated normal distribution
Date   Mon, 22 Sep 2008 15:10:53 +0200

This problem is difficult to comprehend. If you

vers 10.1
set obs 10000
g x =rnormal()*0.5
drop if x<-2 | x>2

you get a truncated normal at -2 and 2, with standard deviation of 0.5 (in the untruncated case). Most of the time the truncation will have no effect, though, as the minimum will be above -2 or the max below 2...


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Alexander Kalb
Sent: Monday, September 22, 2008 3:02 PM
To: [email protected]
Subject: st: iid draw from a truncated normal distribution

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:

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index