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

From |
Linn Renée Naper <linn.naper@ecgroup.no> |

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

Subject |
RE: st: from normal to bimodal distribution |

Date |
Mon, 17 Nov 2008 16:17:59 +0100 |

Hi The command from you Maarten works well with regard to generating a new variable with a bimodal distribution. I have generated a bimodal variable, one for each observation, and then added it to the original price. But, I am still not sure how adding this kind of variable to the original prices will help me to change the distribution in the way I want to. At least I haven't yet figured out exactly how this may be done. I want to "force" the old prices into having a "new distributional shape" with two peaks, but I do not necessarily want to change the global mean very much. My prices have the following distribution (in case it may be useful to know in order to comment on this): variable | mean min max sd variance p25 p50 p75 -------------+-------------------------------------------------------------------------------- mip | 60.28128 8.918235 776.2332 39.47987 1558.66 36.53056 48.77862 69.81553 ---------------------------------------------------------------------------------------------- I realize that the distribution of the "new prices" will vary with how I define means and sd of the bimodal variable. Moreover, the prices will be changed randomly even though the changes are drawn from a bimodal distribution, so what I might need is some weighting of the observations in order to get the "shape" that I want. Alternatively, is there a way to for example redefine the percentiles in an already existing distribution perhaps? Or in some other way imposing the distributional change directly to the original data (the original price)? Thanks -----Opprinnelig melding----- Fra: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] På vegne av Maarten buis Sendt: 17. november 2008 11:45 Til: statalist@hsphsun2.harvard.edu Emne: Re: st: from normal to bimodal distribution --- Linn Renée Naper <linn.naper@ecgroup.no> wrote: > How do I tell Stata to draw random variables or generate a stochastic > variable with a bimodal distribution? Can the rnd-command by Hilde be > used? You can create a mixture of Gaussian (normal) distributions, like in the example below: the local p represents the probability of belonging to group 1, the locals mu1 and mu2 represents the means of group 1 and 2 respectively, and the locals sd1 and sd2 the standard deviations in group 1 and group 2. *--------------- begin example ----------------- drop _all set obs 10000 local p = .5 local sd1 = .75 local sd2 = 1.5 local mu1 = -2 local mu2 = 2 gen u = uniform() gen e = invnorm(uniform()) * /// cond(u < `p', `sd1', `sd2') + /// cond(u < `p', `mu1', `mu2') hist e *---------------- end example --------------------- (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room N515 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- * * 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: from normal to bimodal distribution***From:*Linn Renée Naper <linn.naper@ecgroup.no>

**Re: st: from normal to bimodal distribution***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**Re: st: robust regression with robust errors** - Next by Date:
**st: RE: easy command for correlation tables???** - Previous by thread:
**RE: st: from normal to bimodal distribution** - Next by thread:
**Re: st: from normal to bimodal distribution** - Index(es):

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