# The beta distribution for fitting a GAMLSS

### Description

The functions `BE()`

and `BEo()`

define the beta distribution, a two parameter distribution, for a
`gamlss.family`

object to be used in GAMLSS fitting
using the function `gamlss()`

. `BE()`

has mean equal to the parameter `mu`

and `sigma`

as scale parameter, see below. `BE()`

is the original parameterizations of the beta distribution as in `dbeta()`

with
`shape1`

=mu and `shape2`

=sigma.
The functions `dBE`

and `dBEo`

, `pBE`

and `pBEo`

, `qBE`

and `qBEo`

and finally `rBE`

and `rBE`

define the density, distribution function, quantile function and random
generation for the `BE`

and `BEo`

parameterizations respectively of the beta distribution.

### Usage

1 2 3 4 5 6 7 8 9 | ```
BE(mu.link = "logit", sigma.link = "logit")
dBE(x, mu = 0.5, sigma = 0.2, log = FALSE)
pBE(q, mu = 0.5, sigma = 0.2, lower.tail = TRUE, log.p = FALSE)
qBE(p, mu = 0.5, sigma = 0.2, lower.tail = TRUE, log.p = FALSE)
rBE(n, mu = 0.5, sigma = 0.2)
BEo(mu.link = "log", sigma.link = "log")
dBEo(x, mu = 0.5, sigma = 0.2, log = FALSE)
pBEo(q, mu = 0.5, sigma = 0.2, lower.tail = TRUE, log.p = FALSE)
qBEo(p, mu = 0.5, sigma = 0.2, lower.tail = TRUE, log.p = FALSE)
``` |

### Arguments

`mu.link` |
the |

`sigma.link` |
the |

`x,q` |
vector of quantiles |

`mu` |
vector of location parameter values |

`sigma` |
vector of scale parameter values |

`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] |

`p` |
vector of probabilities. |

`n` |
number of observations. If |

### Details

The original beta distributions distribution is given as

*f(y|a,b)=1/(Beta(a,b)) y^(a-1)(1-y)^(b-1)*

for *y=(0,1)*, *α>0* and *β>0*. In the `gamlss`

implementation of `BEo`

*α=μ* and *β>σ*. The reparametrization in the function `BE()`

is
*mu=a/(a+b)* and *sigma=1/(a+b+1)*
for *mu=(0,1)* and *sigma=(0,1)*.
The expected value of y is *mu* and the variance is *sigma^2*mu*(1-mu)*.

### Value

returns a `gamlss.family`

object which can be used to fit a normal distribution in the `gamlss()`

function.

### Note

Note that for `BE`

, `mu`

is the mean and `sigma`

a scale parameter contributing to the variance of y

### Author(s)

Bob Rigby and Mikis Stasinopoulos

### References

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion),
*Appl. Statist.*, **54**, part 3, pp 507-554.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R.
*Journal of Statistical Software*, Vol. **23**, Issue 7, Dec 2007, http://www.jstatsoft.org/v23/i07.

### See Also

`gamlss.family`

, `BEINF`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
BE()# gives information about the default links for the normal distribution
dat1<-rBE(100, mu=.3, sigma=.5)
hist(dat1)
#library(gamlss)
# mod1<-gamlss(dat1~1,family=BE) # fits a constant for mu and sigma
#fitted(mod1)[1]
#fitted(mod1,"sigma")[1]
plot(function(y) dBE(y, mu=.1 ,sigma=.5), 0.001, .999)
plot(function(y) pBE(y, mu=.1 ,sigma=.5), 0.001, 0.999)
plot(function(y) qBE(y, mu=.1 ,sigma=.5), 0.001, 0.999)
plot(function(y) qBE(y, mu=.1 ,sigma=.5, lower.tail=FALSE), 0.001, .999)
dat2<-rBEo(100, mu=1, sigma=2)
#mod2<-gamlss(dat2~1,family=BEo) # fits a constant for mu and sigma
#fitted(mod2)[1]
#fitted(mod2,"sigma")[1]
``` |