Learn R Programming

VGAM (version 1.1-4)

Gaitbinom: Generally--Altered, --Inflated and --Truncated Binomial Distribution

Description

Density, distribution function, quantile function and random generation for the generally--altered, --inflated and --truncated 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--Binom(size.p, prob.p)--Binom(size.a, prob.a)--MLM--Binom(size.i, prob.i)--MLM, and it is also known as the GAIT-Binom PNP combo where PNP stands for parametric and nonparametric.

Usage

dgaitbinom(x, size.p, prob.p,
           alt.mix = NULL, alt.mlm = NULL,
           inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
           max.support = NULL, 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,
           deflation = FALSE, log = FALSE)
pgaitbinom(q, size.p, prob.p,
           alt.mix = NULL, alt.mlm = NULL,
           inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
           max.support = NULL, 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,
           lower.tail = TRUE)
qgaitbinom(p, size.p, prob.p,
           alt.mix = NULL, alt.mlm = NULL,
           inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
           max.support = NULL, 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)
rgaitbinom(n, size.p, prob.p,
           alt.mix = NULL, alt.mlm = NULL,
           inf.mix = NULL, inf.mlm = NULL, truncate = NULL,
           max.support = NULL, 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)

Arguments

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

Same meaning as in Binomial.

size.p, prob.p

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

size.a, prob.a

See Gaitpois for generic information.

size.i, prob.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.

Value

dgaitbinom gives the density, pgaitbinom gives the distribution function, qgaitbinom gives the quantile function, and rgaitbinom generates random deviates. The default values of the arguments correspond to ordinary dbinom, pbinom, qbinom, rbinom respectively.

Details

These functions for the GAIT binomial distribution are analogous to the GAIT Poisson, hence most details have been put in Gaitpois.

See Also

Gaitpois, Gaitnbinom, multinomial, Gaitlog, Gaitzeta.

Examples

Run this code
# NOT RUN {
 size <- 20
ivec <- c(6, 10); avec <- c(8, 11); prob <- 0.5; xgrid <- 0:25
tvec <- 14; pobs.a <- 0.05; pstr.i <- 0.15
(ddd <- dgaitbinom(xgrid, size, prob.p = prob, prob.a = prob + 5,
   truncate = tvec, 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---Binomial 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(h = c(pobs.a, pstr.i, 0:1), col = 'gray', lty = "dashed")
lines(xgrid, dbinom(xgrid, size, prob), 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)  
# }

Run the code above in your browser using DataLab