Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gaitnbinomUC

Generally–Altered, –Inflated and –Truncated Negative Binomial Distribution


Description

Density, distribution function, quantile function and random generation for the generally–altered, –inflated and –truncated negative binomial 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. Altogether it can be abbreviated as GAAIIT–NB(size.p, munb.p)–NB(size.a, munb.a)–MLM–NB(size.i, munb.i)–MLM, and it is also known as the GAIT-NB PNP combo where PNP stands for parametric and nonparametric.

Usage

dgaitnbinom(x, size.p, prob.p = NULL, munb.p = NULL,
            alt.mix = NULL, alt.mlm = NULL,
            inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
            max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
            pstr.mix = 0, pstr.mlm = 0, byrow.ai = FALSE,
            size.a = size.p, size.i = size.p,
            prob.a = prob.p, prob.i = prob.p,
            munb.a = munb.p, munb.i = munb.p,
            deflation = FALSE, log = FALSE)
pgaitnbinom(q, size.p, prob.p = NULL, munb.p = NULL,
            alt.mix = NULL, alt.mlm = NULL,
            inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
            max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
            pstr.mix = 0, pstr.mlm = 0, byrow.ai = FALSE,
            size.a = size.p, size.i = size.p,
            prob.a = prob.p, prob.i = prob.p,
            munb.a = munb.p, munb.i = munb.p,
            lower.tail = TRUE)
qgaitnbinom(p, size.p, prob.p = NULL, munb.p = NULL,
            alt.mix = NULL, alt.mlm = NULL,
            inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
            max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
            pstr.mix = 0, pstr.mlm = 0, byrow.ai = FALSE,
            size.a = size.p, size.i = size.p,
            prob.a = prob.p, prob.i = prob.p,
            munb.a = munb.p, munb.i = munb.p)
rgaitnbinom(n, size.p, prob.p = NULL, munb.p = NULL,
            alt.mix = NULL, alt.mlm = NULL,
            inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
            max.support = Inf, pobs.mix = 0, pobs.mlm = 0,
            pstr.mix = 0, pstr.mlm = 0, byrow.ai = FALSE,
            size.a = size.p, size.i = size.p,
            prob.a = prob.p, prob.i = prob.p,
            munb.a = munb.p, munb.i = munb.p)

Arguments

x, q, p, n, log, lower.tail

Same meaning as in rnbinom.

size.p, prob.p, munb.p

Same meaning as in rnbinom. See Gaitpois for generic information.

size.a, prob.a, munb.a

See Gaitpois for generic information.

size.i, prob.i, munb.i

See Gaitpois for generic information.

truncate, max.support

See Gaitpois for generic information.

alt.mix, inf.mix

See Gaitpois for generic information.

alt.mlm, inf.mlm

See Gaitpois for generic information.

pobs.mlm, pstr.mlm, byrow.ai

See Gaitpois for generic information.

pobs.mix, pstr.mix

See Gaitpois for generic information.

deflation

See Gaitpois for generic information.

Details

These functions for the NBD are analogous to the Poisson, hence most details have been put in Gaitpois. The NBD has two possible parameterizations: one involving a probability (argument begins with prob) and the other the mean (beginning with mu). Because NegBinomial only allows one of these arguments to be used, the functions here have the same behaviour.

Value

dgaitnbinom gives the density, pgaitnbinom gives the distribution function, qgaitnbinom gives the quantile function, and rgaitnbinom 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 better to use dgaitnbinom(x, size, munb.p = munb, truncate = 0) instead of dposnbinom(x, size, munb = munb), etc.

Author(s)

T. W. Yee.

See Also

Examples

size <- 10
ivec <- c(6, 14); avec <- c(8, 11); munb <- 10; xgrid <- 0:25
tvec <- 15; max.support <- 20; pobs.a <- 0.05; pstr.i <- 0.25
(ddd <- dgaitnbinom(xgrid, size, munb.p = munb, munb.a = munb + 5,
   truncate = tvec, max.support = max.support, pobs.mix = pobs.a,
   pobs.mlm = pobs.a, alt.mlm = avec,
   pstr.mix = pstr.i, inf.mix = ivec))
## Not run: plot(xgrid, ddd, type = "n", ylab = "Probability", xlab = "x",
              main = "GAIT PNP Combo PMF---NB Parent")
mylwd <- 1
abline(v = avec, col = 'blue', lwd = mylwd)
abline(v = ivec, col = 'purple', lwd = mylwd)
abline(v = tvec, col = 'tan', lwd = mylwd)
abline(v = max.support, col = 'magenta', lwd = mylwd)
abline(h = c(pobs.a, pstr.i, 0:1), col = 'gray', lty = "dashed")
lines(xgrid, dnbinom(xgrid, size, mu = munb), col = 'gray', lty = 2)
lines(xgrid, ddd, type = "h", col = "pink", lwd = 7)  # GAIT PNP combo PMF
points(xgrid[ddd == 0], ddd[ddd == 0], pch = 16)  
## End(Not run)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.