The function DBI()
defines the double binomial distribution, a two parameters distribution, for a gamlss.family
object to be used in GAMLSS fitting using the function gamlss()
. The functions dDBI
, pDBI
, qDBI
and rDBI
define the density, distribution function, quantile function and random generation for the double binomial, DBI()
, distribution. The function GetBI_C
calculates numericaly the constant of proportionality needed for the pdf to sum up to 1.
DBI(mu.link = "logit", sigma.link = "log")
dDBI(x, mu = 0.5, sigma = 1, bd = 2, log = FALSE)
pDBI(q, mu = 0.5, sigma = 1, bd = 2, lower.tail = TRUE,
log.p = FALSE)
qDBI(p, mu = 0.5, sigma = 1, bd = 2, lower.tail = TRUE,
log.p = FALSE)
rDBI(n, mu = 0.5, sigma = 1, bd = 2)
GetBI_C(mu, sigma, bd)
The function DBI
returns a gamlss.family
object which can be used to fit a double binomial distribution in the gamlss()
function.
the link function for mu
with default log
the link function for sigma
with default log
vector of (non-negative integer) quantiles
vector of binomial denominator
vector of probabilities
the mu
parameter
the sigma
parameter
logical; if TRUE
(default), probabilities are P[X <= x], otherwise, P[X > x]
logical; if TRUE
, probabilities p are given as log(p)
how many random values to generate
Mikis Stasinopoulos, Bob Rigby, Marco Enea and Fernanda de Bastiani
The definition for the Double Poisson distribution first introduced by Efron (1986) is:
$$p_Y(y|n, \mu,\sigma)= \frac{1}{C(n,\mu,\sigma)} \frac{\Gamma(n+1)}{\Gamma(y+1)\Gamma(n-y+1)} \frac{y^y \left(n-y \right)^{n-y}}{n^n}
\frac{n^{n/\sigma} \mu^{y/\sigma} \left( 1-\mu\right)^{(n-y)/\sigma}}
{y^{y/\sigma} \left( n-y\right)^{(n-y)/\sigma}}$$
for \(y=0,1,2,\ldots,\infty\), \(\mu>0\) and \(\sigma>0\) where \(C\) is the constant of proportinality which is calculated numerically using the function GetBI_C()
, see pp. 524-525 of Rigby et al. (2019).
Efron, B., 1986. Double exponential families and their use in generalized linear Regression. Journal of the American Statistical Association 81 (395), 709-721.
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, 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, 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. tools:::Rd_expr_doi("10.1201/b21973")
(see also https://www.gamlss.com/).
BI
,BB
DBI()
x <- 0:20
# underdispersed DBI
plot(x, dDBI(x, mu=.5, sigma=.2, bd=20), type="h", col="green", lwd=2)
# binomial
lines(x+0.1, dDBI(x, mu=.5, sigma=1, bd=20), type="h", col="black", lwd=2)
# overdispersed DBI
lines(x+.2, dDBI(x, mu=.5, sigma=2, bd=20), type="h", col="red",lwd=2)
Run the code above in your browser using DataLab