# betagen: The Generalised Beta Distribution In mc2d: Tools for Two-Dimensional Monte-Carlo Simulations

## Description

Density, distribution function, quantile function and random generation for the Beta distribution defined on the [min, max] domain with parameters shape1 and shape2 ( and optional non-centrality parameter ncp).

## Usage

 ```1 2 3 4 5 6``` ```dbetagen(x, shape1, shape2, min=0, max=1, ncp=0, log=FALSE) pbetagen(q, shape1, shape2, min=0, max=1, ncp=0, lower.tail=TRUE, log.p=FALSE) qbetagen(p, shape1, shape2, min=0, max=1, ncp=0, lower.tail=TRUE, log.p=FALSE) rbetagen(n, shape1, shape2, min=0, max=1, ncp=0) ```

## Arguments

 `x,q` Vector of quantiles. `p` Vector of probabilities. `n` Number of observations. If length(n) > 1, the length is taken to be the number required. `shape1, shape2` Positive parameters of the Beta distribution. `min` Vector of minima. `max` Vector of maxima. `ncp` Non-centrality parameter of the Beta distribution. `log, log.p` Logical; if TRUE, probabilities p are given as log(p). `lower.tail` Logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

## Details

x ~ betagen(shape1, shape2, min, max, ncp)

if

(x-min)/(max-min)~beta(shape1,shape2,ncp)

These functions use the `Beta` distribution functions after correct parametrisation.

## Value

dbetagen gives the density, pbetagen gives the distribution function, qbetagen gives the quantile function, and rbetagen generates random deviates.

`Beta`
 ```1 2 3``` ```curve(dbetagen(x, shape1=3, shape2=5, min=1, max=6), from = 0, to = 7) curve(dbetagen(x, shape1=1, shape2=1, min=2, max=5), from = 0, to = 7, lty=2, add=TRUE) curve(dbetagen(x, shape1=.5, shape2=.5, min=0, max=7), from = 0, to = 7, lty=3, add=TRUE) ```