[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Austin Nichols <austinnichols@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: censored random normal with a fixed mean and standard deviation |

Date |
Wed, 21 Oct 2009 23:59:09 -0400 |

Scott Merryman <scott.merryman@gmail.com> et al.: Thanks to Kit Baum, you can now: ssc inst cnormp clear all set obs 100000 cnormp 25 30, c(0) g y=max(0,rnormal(r(m),r(s))) su The program currently does not do a lot of error checking (e.g. that the censoring point is less than the desired mean), but will eventually be updated to produce informative error messages in various nonsensical cases. If anyone has any ideas about how to improve on the method, I'd be interested to hear them. Probably there is an easier solution that simply did not occur to me--I am currently solving the system of nonlinear equations by brute force using Mata's optimize(). On Tue, Oct 20, 2009 at 2:48 PM, Scott Merryman <scott.merryman@gmail.com> wrote: > In generating censored random normal variate with a fixed mean and > standard deviation is there a way to determine what the mean and > standard deviation should be for the uncensored normal. > > For exmaple, if one wants a cenored normal (at 0) with mean 25 and > standard deviation 30, then > > -gen yield = max(0, rnormal(25,30))- > > will result in a mean too large and standard deviation too small. In > this example values of -rnormal(13.5,43.75)- work, but is there way to > determine what the uncensored mean and standard deviation should be? > > clear > set obs 1000000 > set seed 123456 > gen yield1 = max(0, rnormal(25,30)) > gen yield2 = max(0, rnormal(13.5,43.75)) > sum > > > Scott * * 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: censored random normal with a fixed mean and standard deviation***From:*Scott Merryman <scott.merryman@gmail.com>

- Prev by Date:
**Re: st: row and column titles for graphs with the by option** - Next by Date:
**AW: st: RE: RE: How to generate this variable please?** - Previous by thread:
**st: censored random normal with a fixed mean and standard deviation** - Next by thread:
**st: getting standard deviations with multiply imputed data** - Index(es):

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