Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: Monte Carlo Simulation with a binomial probability


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: Monte Carlo Simulation with a binomial probability
Date   Tue, 12 Nov 2002 14:44:18 -0000

Murray Finkelstein
>
> Good morning.

Geographist comment...

> I would like to perform a sensitivity analysis of some
> regression results. I know the proportion of smokers by
> neighbourhood, but
> I do not have information about individual smoking habits. I wish to
> perform Monte Carlo simulations in which, in each run, I assign each
> individual a dichotomous (0/1) smoking variable based upon
> the probability
> of his being a smoker (as derived from the proportion in his
> neighbourhood). Is there a Stata function that will allow
> me to randomly
> draw 0s or 1s based upon the binomial proportion?

Suppose you have a fraction of smokers .345.

. gen whatever = uniform() < 0.345

returns 1 or 0 with approximately the
correct proportions.

Nick
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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