gamlss.dist (version 5.1-6)

BE: 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. BEo() 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

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 mu link function with default logit

sigma.link

the sigma link function with default logit

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 length(n) > 1, the length is taken to be the number required

Value

BE() and BEo() return a gamlss.family object which can be used to fit a beta distribution in the gamlss() function.

Details

The original beta distribution is given as $$f(y|\alpha,\beta)=\frac{1}{B(\alpha, \beta)} y^{\alpha-1}(1-y)^{\beta-1}$$ for \(y=(0,1)\), \(\alpha>0\) and \(\beta>0\). In the gamlss implementation of BEo \(\alpha=\mu\) and \(\beta>\sigma\). The reparametrization in the function BE() is \(\mu=\frac{\alpha}{\alpha+\beta}\) and \(\sigma=(\frac{1}{\alpha+\beta+1)^{1/2}}\) for \(\mu=(0,1)\) and \(\sigma=(0,1)\). The expected value of y is \(\mu\) and the variance is \(\sigma^2\mu*(1-\mu)\).

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.

Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R. An older version can be found in http://www.gamlss.com/.

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.com/).

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.

Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.

See Also

gamlss.family, BE, LOGITNO, GB1, BEINF

Examples

Run this code
# NOT RUN {
BE()# gives information about the default links for the beta 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]
# }

Run the code above in your browser using DataLab