FB: The Flexible Beta Distribution

dFBR Documentation

The Flexible Beta Distribution

Description

Density function, distribution function, quantile function, and random generation for the (augmented) flexible beta distribution.

Usage

dFB(x, mu, phi, p, w, q0 = NULL, q1 = NULL, log = FALSE)

qFB(prob, mu, phi, p, w, q0 = NULL, q1 = NULL, log.prob = FALSE)

pFB(q, mu, phi, p, w, q0 = NULL, q1 = NULL, log.prob = FALSE)

rFB(n, mu, phi, p, w, q0 = NULL, q1 = NULL)

Arguments

x, q

a vector of quantiles.

mu

the mean parameter. It must lie in (0, 1).

phi

the precision parameter. It must be a real positive value.

p

the mixing weight. It must lie in (0, 1).

w

the normalized distance among component means. It must lie in (0, 1).

q0

the probability of augmentation in zero. It must lie in (0, 1). In case of no augmentation, it is NULL (default).

q1

the probability of augmentation in one. It must lie in (0, 1). In case of no augmentation, it is NULL (default).

log

logical; if TRUE, densities are returned on log-scale.

prob

a vector of probabilities.

log.prob

logical; if TRUE, probabilities prob are given as log(prob).

n

the number of values to generate. If length(n) > 1, the length is taken to be the number required.

Details

The FB distribution is a special mixture of two beta distributions with probability density function

f_{FB}(x;\mu,\phi,p,w)=p f_B(x;\lambda_1,\phi)+(1-p)f_B(x;\lambda_2,\phi),

for 0<x<1, where f_B(x;\cdot,\cdot) is the beta density with a mean-precision parameterization. Moreover, 0<\mu=p\lambda_1+(1-p)\lambda_2<1 is the overall mean, \phi>0 is a precision parameter, 0<p<1 is the mixing weight, 0<w<1 is the normalized distance between component means, and \lambda_1=\mu+(1-p)w and \lambda_2=\mu-pw are the means of the first and second component of the mixture, respectively.

The augmented FB distribution has density

  • q_0, if x=0

  • q_1, if x=1

  • (1-q_0-q_1)f_{FB}(x;\mu,\phi,p,w), if 0<x<1

where 0<q_0<1 identifies the augmentation in zero, 0<q_1<1 identifies the augmentation in one, and q_0+q_1<1.

Value

The function dFB returns a vector with the same length as x containing the density values. The function pFB returns a vector with the same length as q containing the values of the distribution function. The function qFB returns a vector with the same length as prob containing the quantiles. The function rFB returns a vector of length n containing the generated random values.

References

Di Brisco, A. M., Migliorati, S. (2020). A new mixed-effects mixture model for constrained longitudinal data. Statistics in Medicine, 39(2), 129–145. doi:10.1002/sim.8406

Migliorati, S., Di Brisco, A. M., Ongaro, A. (2018). A New Regression Model for Bounded Responses. Bayesian Analysis, 13(3), 845–872. doi:10.1214/17-BA1079

Examples

dFB(x = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5)
dFB(x = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5, q0 = .2)
dFB(x = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5, q0 = .2, q1 = .1)

qFB(prob = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5)
qFB(prob = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5, q0 = .2)
qFB(prob = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5, q0 = .2, q1 = .1)

pFB(q = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5)
pFB(q = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5, q0 = .2)
pFB(q = c(.5,.7,.8), mu = .3, phi = 20, p = .5, w = .5, q0 = .2, q1 = .1)

rFB(n = 100, mu = .5, phi = 30,p = .3, w = .6)
rFB(n = 100, mu = .5, phi = 30,p = .3, w = .6, q0 = .2, q1 = .1)


FlexReg documentation built on Sept. 9, 2025, 5:49 p.m.