BEINF: The beta inflated distribution for fitting a GAMLSS

BEINFR Documentation

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

Details

The beta inflated distribution is defined as

f(y)=p_0 \quad \textit{if} \quad y=0

f(y)=p_1 \quad \textit{if} \quad y=1

f(y|\alpha,\beta)=\frac{1}{B(\alpha, \beta)} y^{\alpha-1}(1-y)^{\beta-1} \quad \textit{otherwise}

for 0 \le y \le 1, \alpha>0, \beta>0, 0<p_0<1, 0<p_1<1 and 0<p_0+p_1<1.

The GAMLSS function BEINF() re-parametrize the parameters as

\mu=\frac{\alpha}{\alpha+\beta}

\sigma=\frac{1}{\alpha+\beta+1}

\nu=\frac{p_0}{p_2}

\tau=\frac{p_1}{p_2}

where p_2=1-p_0-p_1 so 0<\mu<1, 0<\sigma<1, \nu>0 and \tau>0 see pp. 466-467 of Rigby et al. (2019).

The beta inflated at zero distribution is defined as

f(y)=p_0 \quad \textit{if} \quad y=0

f(y|\alpha,\beta)=\frac{1}{B(\alpha, \beta)} y^{\alpha-1}(1-y)^{\beta-1} \quad \textit{otherwise}

for 0 \le y < 1, \alpha>0, \beta>0 and 0<p_0<1.

The GAMLSS function BEINF0() re-parametrize the parameters as

\mu=\frac{\alpha}{\alpha+\beta}

\sigma=\frac{1}{\alpha+\beta+1}

\nu=\frac{p_0}{1-P_0}

so 0<\mu<1, 0<\sigma<1 and \nu>0 see pp. 467-468 of Rigby et al. (2019).

The beta inflated at 1 distribution is defined as

f(y|\alpha,\beta)=\frac{1}{B(\alpha, \beta)} y^{\alpha-1}(1-y)^{\beta-1} \quad \textit{if} \quad 0<y<1

f(y)=p_1 \quad \quad \textit{if} \: \quad y=1

for 0 < y \le 1, \alpha>0, \beta>0 and 0<p_1<1.

The GAMLSS function BEINF1() re-parametrize the parameters as

\mu=\frac{\alpha}{\alpha+\beta}

\sigma=\frac{1}{\alpha+\beta+1}

\nu=\frac{p_1}{1-P_1}

so 0<\mu<1, 0<\sigma<1 and \nu>0 see pp. 468-469 of Rigby et al. (2019).

Value

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

Author(s)

Bob Rigby and Mikis Stasinopoulos

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,\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/9780429298547")}. An older version can be found in https://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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v023.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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/b21973")}

(see also https://www.gamlss.com/).

See Also

gamlss.family, BE, BEo, BEZI, BEOI

Examples

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]

gamlss.dist documentation built on Aug. 24, 2023, 1:06 a.m.