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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

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 clear* set obs 10000 g x =rnormal()*0.5 su 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... HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Alexander Kalb Sent: Monday, September 22, 2008 3:02 PM To: statalist@hsphsun2.harvard.edu 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: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: iid draw from a truncated normal distribution***From:*"Alexander Kalb" <kalb@zew.de>

- Prev by Date:
**st: RE: For help on outreg** - Next by Date:
**Re: st: Network meta analysis** - Previous by thread:
**st: iid draw from a truncated normal distribution** - Next by thread:
**st: iid draw from a truncated normal distribution** - Index(es):

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