gamlss.dist (version 5.1-6)

BEINF: The beta inflated distribution for fitting a GAMLSS

Description

The function BEINF() defines the beta inflated distribution, a four parameter distribution, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss(). The beta inflated is similar to the beta but allows zeros and ones as values for the response variable. The two extra parameters model the probabilities at zero and one.

The functions BEINF0() and BEINF1() are three parameter beta inflated distributions allowing zeros or ones only at the response respectively. BEINF0() and BEINF1() are re-parameterize versions of the distributions BEZI and BEOI contributed to gamlss by Raydonal Ospina (see Ospina and Ferrari (2010)).

The functions dBEINF, pBEINF, qBEINF and rBEINF define the density, distribution function, quantile function and random generation for the BEINF parametrization of the beta inflated distribution.

The functions dBEINF0, pBEINF0, qBEINF0 and rBEINF0 define the density, distribution function, quantile function and random generation for the BEINF0 parametrization of the beta inflated at zero distribution.

The functions dBEINF1, pBEINF1, qBEINF1 and rBEINF1 define the density, distribution function, quantile function and random generation for the BEINF1 parametrization of the beta inflated at one distribution.

plotBEINF, plotBEINF0 and plotBEINF1 can be used to plot the distributions. meanBEINF, meanBEINF0 and meanBEINF1 calculates the expected value of the response for a fitted model.

Usage

BEINF(mu.link = "logit", sigma.link = "logit", nu.link = "log", 
      tau.link = "log")
BEINF0(mu.link = "logit", sigma.link = "logit", nu.link = "log")
BEINF1(mu.link = "logit", sigma.link = "logit", nu.link = "log")
      
dBEINF(x, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1, 
       log = FALSE)
dBEINF0(x, mu = 0.5, sigma = 0.1, nu = 0.1, log = FALSE)
dBEINF1(x, mu = 0.5, sigma = 0.1, nu = 0.1, log = FALSE)       

pBEINF(q, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1, lower.tail = TRUE, log.p = FALSE) pBEINF0(q, mu = 0.5, sigma = 0.1, nu = 0.1, lower.tail = TRUE, log.p = FALSE) pBEINF1(q, mu = 0.5, sigma = 0.1, nu = 0.1, lower.tail = TRUE, log.p = FALSE)

qBEINF(p, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1, lower.tail = TRUE, log.p = FALSE) qBEINF0(p, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1, lower.tail = TRUE, log.p = FALSE) qBEINF1(p, mu = 0.5, sigma = 0.1, nu = 0.1, lower.tail = TRUE, log.p = FALSE) rBEINF(n, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1) rBEINF0(n, mu = 0.5, sigma = 0.1, nu = 0.1) rBEINF1(n, mu = 0.5, sigma = 0.1, nu = 0.1)

plotBEINF(mu = 0.5, sigma = 0.5, nu = 0.5, tau = 0.5, from = 0.001, to = 0.999, n = 101, ...) plotBEINF0(mu = 0.5, sigma = 0.5, nu = 0.5, from = 1e-04, to = 0.9999, n = 101, ...) plotBEINF1(mu = 0.5, sigma = 0.5, nu = 0.5, from = 1e-04, to = 0.9999, n = 101, ...)

meanBEINF(obj) meanBEINF0(obj) meanBEINF1(obj)

Arguments

mu.link

the mu link function with default logit

sigma.link

the sigma link function with default logit

nu.link

the nu link function with default log

tau.link

the tau link function with default log

x,q

vector of quantiles

mu

vector of location parameter values

sigma

vector of scale parameter values

nu

vector of parameter values modelling the probability at zero

tau

vector of parameter values modelling the probability at one

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

from

where to start plotting the distribution from

to

up to where to plot the distribution

obj

a fitted BEINF object

other graphical parameters for plotting

Value

returns a gamlss.family object which can be used to fit a beta inflated distribution in the gamlss() function. ...

Details

The beta inflated distribution is given as $$f(y)=p_0$$ if (y=0) $$f(y)=p_1$$ if (y=1) $$f(y|\alpha,\beta)=\frac{1}{B(\alpha, \beta)} y^{\alpha-1}(1-y)^{\beta-1}$$ otherwise

for \(y=(0,1)\), \(\alpha>0\) and \(\beta>0\). The parametrization in the function BEINF() is \(\mu=\frac{\alpha}{\alpha+\beta}\) and \(\sigma=\frac{1}{\alpha+\beta+1}\) for \(\mu=(0,1)\) and \(\sigma=(0,1)\) and \(\nu=\frac{p_0}{p_2}\), \(\tau=\frac{p_1}{p_2}\) where \(p_2=1-p_0-p_1\).

References

Ospina R. and Ferrari S. L. P. (2010) Inflated beta distributions, Statistical Papers, 23, 111-126.

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, Chapman and Hall/CRC. An older version can be found in 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, BEo, BEZI, BEOI

Examples

Run this code
# NOT RUN {
BEINF()# gives information about the default links for the beta inflated distribution
BEINF0()
BEINF1()
# plotting the distributions
op<-par(mfrow=c(2,2)) 
plotBEINF( mu =.5 , sigma=.5, nu = 0.5, tau = 0.5, from = 0, to=1, n = 101)
plotBEINF0( mu =.5 , sigma=.5, nu = 0.5,  from = 0, to=1, n = 101)
plotBEINF1( mu =.5 , sigma=.5, nu = 0.5,  from = 0.001, to=1, n = 101)
curve(dBE(x, mu =.5, sigma=.5),  0.01, 0.999)
par(op)
# plotting the cdf
op<-par(mfrow=c(2,2)) 
plotBEINF( mu =.5 , sigma=.5, nu = 0.5, tau = 0.5, from = 0, to=1, n = 101, main="BEINF")
plotBEINF0( mu =.5 , sigma=.5, nu = 0.5,  from = 0, to=1, n = 101, main="BEINF0")
plotBEINF1( mu =.5 , sigma=.5, nu = 0.5,  from = 0.001, to=1, n = 101, main="BEINF1")
curve(dBE(x, mu =.5, sigma=.5),  0.01, 0.999, main="BE")
par(op)
#---------------------------------------------
op<-par(mfrow=c(2,2)) 
plotBEINF( mu =.5 , sigma=.5, nu = 0.5, tau = 0.5, from = 0, to=1, n = 101, main="BEINF")
plotBEINF0( mu =.5 , sigma=.5, nu = 0.5,  from = 0, to=1, n = 101, main="BEINF0")
plotBEINF1( mu =.5 , sigma=.5, nu = 0.5,  from = 0.001, to=1, n = 101, main="BEINF1")
curve(dBE(x, mu =.5, sigma=.5),  0.01, 0.999, main="BE")
par(op)
#---------------------------------------------
op<-par(mfrow=c(2,2)) 
curve( pBEINF(x, mu=.5 ,sigma=.5, nu = 0.5, tau = 0.5,), 0, 1, ylim=c(0,1), main="BEINF" )
curve(pBEINF0(x, mu=.5 ,sigma=.5, nu = 0.5), 0, 1, ylim=c(0,1), main="BEINF0")
curve(pBEINF1(x, mu=.5 ,sigma=.5, nu = 0.5), 0, 1, ylim=c(0,1), main="BEINF1")
curve(    pBE(x, mu=.5 ,sigma=.5), .001, .99, ylim=c(0,1), main="BE")
par(op)
#---------------------------------------------
op<-par(mfrow=c(2,2)) 
curve(qBEINF(x, mu=.5 ,sigma=.5, nu = 0.5, tau = 0.5), .01, .99, main="BEINF" )
curve(qBEINF0(x, mu=.5 ,sigma=.5, nu = 0.5), .01, .99, main="BEINF0" )
curve(qBEINF1(x, mu=.5 ,sigma=.5, nu = 0.5), .01, .99, main="BEINF1" )
curve(qBE(x, mu=.5 ,sigma=.5), .01, .99 , main="BE")
par(op)

#---------------------------------------------
op<-par(mfrow=c(2,2)) 
hist(rBEINF(200, mu=.5 ,sigma=.5, nu = 0.5, tau = 0.5))
hist(rBEINF0(200, mu=.5 ,sigma=.5, nu = 0.5))
hist(rBEINF1(200, mu=.5 ,sigma=.5, nu = 0.5))
hist(rBE(200, mu=.5 ,sigma=.5))
par(op)
# fit a model to the data 
# library(gamlss)
#m1<-gamlss(dat~1,family=BEINF)
#meanBEINF(m1)[1]
# }

Run the code above in your browser using DataLab