Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Beta distribution

 From Stas Kolenikov To statalist@hsphsun2.harvard.edu Subject Re: st: Beta distribution Date Thu, 27 Jan 2011 21:58:33 -0600

```Wikipedia article (http://en.wikipedia.org/wiki/Beta_distribution)
contains all the necessary bits and pieces. You can characterize the
distribution with the range locals `a' and `b', the mean local `mu',
and the shape local `shape':

* standardized mean
local stdmean = (`mu'-`a')/(`b'-`a')
assert `stdmean' >= 0 & `stdmean' <= 1
* if the `shape' local is the alpha parameter,
* then the other shape parameter is found from the mean:
local shape2 = `shape'*(1-`stdmean')/`stdmean'
generate mybeta = `a' + `b'*rbeta(`shape',`shape2')

You would still be somewhat limited with the shapes as you only have
one free parameter of your distribution. For more weird distribution
functions, you can entertain the mixtures of the above betas with
different shapes.

On Thu, Jan 27, 2011 at 9:33 PM, Hartman, Rob <rhartman@mitre.org> wrote:
> Hi Listers,
> Is it possible to generate a random beta variable with
> -a fixed/predetermined range of possible values, as well as
> -a fixed mean, but still have
> -the ability to vary the shape parameters meaningfully?
>
> This is more a distributions question in general than a stata question in particular, but I would want to implement using stata.
>
> I want to test the power of a mean comparison test (with means/mean difference specified a priori) for variables with fixed range of values (0 to 2 in this case) but where the underlying distributions are anyone's guess. That is, I want to be able to experiment w/ different distributional properties while maintaining the mean and range.
>
> Would appreciate any guidance, including alternative approaches.

--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

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