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

From |
Antoine Terracol <terracol@univ-paris1.fr> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Generate a random variable with a range constraint |

Date |
Sat, 06 Dec 2008 20:04:50 +0100 |

Hello David, I'm not sure this is what you want, but the following code clear set obs 5000 scalar sig=70 scalar mu=0.15 scalar up=95 scalar low=45

su wt

hope this helps, Antoine David Collins wrote:

I apologise for what may be a fairly rudimentary question. I want togenerate a random variable (wt), n = 5000; as follows;set obs 5000 set seed 1000 g wt = 70 * rnormal(1, 0.15)However, wt also needs to be constrained as follows, 45 < wt < 95. I amhaving difficulty incorporating the constraint into the generatefunction, and would appreciate any help.--David

* * 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/

**Follow-Ups**:**Re: st: Generate a random variable with a range constraint***From:*Antoine Terracol <terracol@univ-paris1.fr>

**References**:**st: Generate a random variable with a range constraint***From:*David Collins <dcoll@ms.umanitoba.ca>

- Prev by Date:
**RE: Re: st: question related to collapse** - Next by Date:
**Re: st: Generate a random variable with a range constraint** - Previous by thread:
**st: Re: Generate a random variable with a range constraint** - Next by thread:
**Re: st: Generate a random variable with a range constraint** - Index(es):

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