Generally Altered, Inflated, Truncated and Deflated Negative Binomial Distribution
gaitdnbinomUC.RdDensity, distribution function, quantile function and random generation for the generally altered, inflated, truncated and deflated negative binomial (GAITD-NB) distribution. Both parametric and nonparametric variants are supported; these are based on finite mixtures of the parent with itself and the multinomial logit model (MLM) respectively.
Usage
dgaitdnbinom(x, size.p, munb.p,
a.mix = NULL, a.mlm = NULL,
i.mix = NULL, i.mlm = NULL,
d.mix = NULL, d.mlm = NULL, truncate = NULL,
max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
pstr.mix = 0, pstr.mlm = 0,
pdip.mix = 0, pdip.mlm = 0, byrow.aid = FALSE,
size.a = size.p, size.i = size.p, size.d = size.p,
munb.a = munb.p, munb.i = munb.p, munb.d = munb.p,
log = FALSE)
pgaitdnbinom(q, size.p, munb.p,
a.mix = NULL, a.mlm = NULL,
i.mix = NULL, i.mlm = NULL,
d.mix = NULL, d.mlm = NULL, truncate = NULL,
max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
pstr.mix = 0, pstr.mlm = 0,
pdip.mix = 0, pdip.mlm = 0, byrow.aid = FALSE,
size.a = size.p, size.i = size.p, size.d = size.p,
munb.a = munb.p, munb.i = munb.p, munb.d = munb.p,
lower.tail = TRUE)
qgaitdnbinom(p, size.p, munb.p,
a.mix = NULL, a.mlm = NULL,
i.mix = NULL, i.mlm = NULL,
d.mix = NULL, d.mlm = NULL, truncate = NULL,
max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
pstr.mix = 0, pstr.mlm = 0,
pdip.mix = 0, pdip.mlm = 0, byrow.aid = FALSE,
size.a = size.p, size.i = size.p, size.d = size.p,
munb.a = munb.p, munb.i = munb.p, munb.d = munb.p)
rgaitdnbinom(n, size.p, munb.p,
a.mix = NULL, a.mlm = NULL,
i.mix = NULL, i.mlm = NULL,
d.mix = NULL, d.mlm = NULL, truncate = NULL,
max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
pstr.mix = 0, pstr.mlm = 0,
pdip.mix = 0, pdip.mlm = 0, byrow.aid = FALSE,
size.a = size.p, size.i = size.p, size.d = size.p,
munb.a = munb.p, munb.i = munb.p, munb.d = munb.p)Arguments
- x, q, p, n, log, lower.tail
Same meaning as in
rnbinom.- size.p, munb.p
Same meaning as in
rnbinom. SeeGaitdpoisfor generic information.- size.a, munb.a
See
Gaitdpoisfor generic information.- size.i, munb.i
See
Gaitdpoisfor generic information.- size.d, munb.d
See
Gaitdpoisfor generic information.- truncate, max.support
See
Gaitdpoisfor generic information.- a.mix, i.mix, d.mix
See
Gaitdpoisfor generic information.- a.mlm, i.mlm, d.mlm
See
Gaitdpoisfor generic information.- pobs.mlm, pstr.mlm, byrow.aid
See
Gaitdpoisfor generic information.- pobs.mix, pstr.mix
See
Gaitdpoisfor generic information.- pdip.mix, pdip.mlm
See
Gaitdpoisfor generic information.
Details
These functions for the NBD are analogous to the Poisson,
hence most details have been put in
Gaitdpois.
The NBD has two possible parameterizations: one
involving a probability (argument begins with prob)
and the other the mean (beginning with mu).
Only the latter is supported here.
For now, arguments such as prob.p and prob.a
are no longer supported.
That's because mu is more likely to be
used by most statisticians than prob;
see dnbinom.
Warning
See Gaitdpois about the dangers
of too much inflation and/or deflation on
GAITD PMFs, and the difficulties detecting such.
Value
dgaitdnbinom gives the density,
pgaitdnbinom gives the distribution function,
qgaitdnbinom gives the quantile function, and
rgaitdnbinom generates random deviates.
The default values of the arguments correspond to ordinary
dnbinom,
pnbinom,
qnbinom,
rnbinom
respectively.
Note
Four functions were moved from VGAM to VGAMdata;
they can be seen at Posnegbin.
It is preferable to use
dgaitdnbinom(x, size, munb.p = munb, truncate = 0)
instead of dposnbinom(x, size, munb = munb), etc.
Examples
size <- 10; xgrid <- 0:25
ivec <- c(5, 6, 10, 14); avec <- c(8, 11); munb <- 10
tvec <- 15; pobs.a <- 0.05; pstr.i <- 0.25
dvec <- 13; pdip.mlm <- 0.03; pobs.mlm <- 0.05
(ddd <- dgaitdnbinom(xgrid, size, munb.p = munb, munb.a = munb + 5,
truncate = tvec, pobs.mix = pobs.a,
pdip.mlm = pdip.mlm, d.mlm = dvec,
pobs.mlm = pobs.a, a.mlm = avec,
pstr.mix = pstr.i, i.mix = ivec))
#> [1] 0.000842496 0.004212480 0.011584320 0.023168640 0.037649040 0.108397814
#> [7] 0.135497268 0.075298081 0.050000000 0.080004211 0.156305777 0.050000000
#> [13] 0.060457727 0.021156538 0.086419059 0.000000000 0.026263401 0.020083778
#> [19] 0.015062833 0.011098930 0.008046724 0.005747660 0.004049488 0.002817035
#> [25] 0.001936712 0.001316964
if (FALSE) dgaitdplot(c(size, munb), fam = "nbinom",
ylab = "Probability", xlab = "x", xlim = c(0, 25),
truncate = tvec, pobs.mix = pobs.mix,
pobs.mlm = pobs.mlm, a.mlm = avec, all.lwd = 3,
pdip.mlm = pdip.mlm, d.mlm = dvec,
pstr.mix = pstr.i, i.mix = ivec, deflation = TRUE,
main = "GAITD Combo PMF---NB Parent") # \dontrun{}