[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Re: Monte Carlo Simulation with a binomial probability
> Good morning.
> 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
* For searches and help try: