VGAM (version 1.1-3)

Gaitnbinom.mlm: Generally--Altered, --Inflated and --Truncated Negative Binomial Distribution (GAIT--NB--MLM--MLM)

Description

Density, distribution function, quantile function and random generation for the generally--altered, --inflated and --truncated negative binomial distribution, based on the multinomial logit model (MLM). This distribution is sometimes abbreviated as GAIT--NB--MLM--MLM.

Usage

dgaitnbinom.mlm(x, size, prob = NULL, munb = NULL, alter = NULL,
                inflate = NULL, truncate = NULL, max.support = Inf,
                pobs.a = 0, pstr.i = 0, byrow.arg = FALSE,
                log.arg = FALSE)
pgaitnbinom.mlm(q, size, prob = NULL, munb = NULL, alter = NULL,
                inflate = NULL, truncate = NULL, max.support = Inf,
                pobs.a = 0, pstr.i = 0, byrow.arg = FALSE)
qgaitnbinom.mlm(p, size, prob = NULL, munb = NULL, alter = NULL,
                inflate = NULL, truncate = NULL, max.support = Inf,
                pobs.a = 0, pstr.i = 0, byrow.arg = FALSE)
rgaitnbinom.mlm(n, size, prob = NULL, munb = NULL, alter = NULL,
                inflate = NULL, truncate = NULL, max.support = Inf,
                pobs.a = 0, pstr.i = 0, byrow.arg = FALSE)

Arguments

x, q, p, n, log.arg

Same meaning as in NegBinomial.

size, prob, munb

Same meaning as in NegBinomial, i.e., for an ordinary negative binomial distribution. Argument mu has been renamed to munb to emphasize that it refers to the negative binomial mean. Only one of prob and munb should be specified. Short vectors are recycled.

alter, inflate, truncate
pstr.i, byrow.arg
pobs.a, max.support

See Gaitpois.

Value

dgaitnbinom.mlm gives the density (PMF), pgaitnbinom.mlm gives the distribution function, qgaitnbinom.mlm gives the quantile function, and rgaitnbinom.mlm generates random deviates. The default values of the arguments correspond to ordinary dnegbin, pnegbin, qnegbin, rnegbin respectively.

Details

Largely similar to Gaitpois except a negative binomial distribution replaces the Poisson distribution. Special cases of these functions include dposnegbin, dzanegbin, dzinegbin, pposnegbin, pzanegbin, pzinegbin, qposnegbin, qzanegbin, qzinegbin, rposnegbin, rzanegbin, rzinegbin corresponding to the special value 0. However, now arguments alter, inflate and truncate have been supplied in one function.

See Also

gatnbinomial.mlm, Gaitpois, NegBinomial.

Examples

Run this code
# NOT RUN {
avec <- c(5, 10)   # Alter these (special) values
ivec <- c(15, 20)  # Inflate these (special) values
tvec <- 0          # Truncate this (special) value
pobs.a <- c(0.1, 0.2)
pstr.i <- c(0.1, 0.1); size <- 3; munb <- 15; x <- 0:22
y <- rgaitnbinom.mlm(1000, size, munb = munb, alter = avec,
                     inflate = ivec, truncate = tvec, max.support = 20,
                     pstr.i = pstr.i, pobs.a = pobs.a, byrow = TRUE)
table(y)
(pmf <- dgaitnbinom.mlm(x, size, munb = munb, alter = avec,
                        inflate = ivec, truncate = tvec, max.support = 20,
                        pstr.i = pstr.i, pobs.a = pobs.a, byrow = TRUE))
# }
# NOT RUN {
 plot(x, pmf, type = "h", col = "blue", las = 1,
               main = "Heaped data that is also upper-truncated") 
# }

Run the code above in your browser using DataLab