Learn R Programming

VGAM (version 1.1-2)

Gaitbinom.mlm: Generally-Altered, -Inflated and -Truncated Binomial Distribution (GAIT--binom--MLM--MLM)

Description

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

Usage

dgaitbinom.mlm(x, size, prob, alter = NULL, inflate = NULL,
                 truncate = NULL, pobs.a = 0, pstr.i = 0,
                 byrow.arg = FALSE, log.arg = FALSE, .errorcheck = TRUE)
pgaitbinom.mlm(q, size, prob, alter = NULL, inflate = NULL,
                 truncate = NULL, pobs.a = 0, pstr.i = 0,
                 byrow.arg = FALSE, .errorcheck = TRUE)
qgaitbinom.mlm(p, size, prob, alter = NULL, inflate = NULL,
             truncate = NULL, pobs.a = 0, pstr.i = 0, byrow.arg = FALSE)
rgaitbinom.mlm(n, size, prob, alter = NULL, inflate = NULL,
             truncate = NULL, pobs.a = 0, pstr.i = 0, byrow.arg = FALSE)

Arguments

x, q, p, n, log.arg

Same meaning as in rbinom.

size, prob

Same meaning as in rbinom, i.e., for an ordinary binomial distribution. Short vectors are recycled.

alter, inflate, truncate

Vectors of nonnegative integers; the altered, inflated and truncated values. Each argument must have unique values only. The default value of NULL means an empty set.

pstr.i, byrow.arg

The first argument can be a length(inflate)-vector of probabilities; else a matrix of dimension n x length(inflate) of probabilities. If a vector then this matrix is constructed from the vector using byrow.arg to determine the enumeration of the elements (similar to matrix). These arguments are not used unless inflate is assigned.

pobs.a

This argument is similar to pstr.i but is used when alter is assigned a vector. The argument byrow.arg is used similarly to construct a matrix of dimension n x length(alter) of probabilities. This argument is not used unless alter is assigned.

.errorcheck

Logical. Should be ignored by the user.

Value

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

Details

See Gaitpois.mlm for generic details applying to both distributions.

These functions do what dgabinom, dgibinom, dgtbinom, pgabinom, pgibinom, pgtbinom, qgabinom, qgibinom, qgtbinom, rgabinom, rgibinom, rgtbinom collectively did because the arguments alter, inflate and truncate have been combined.

See Also

Gaitnbinom.mlm, Posbinom, Binomial.

Examples

Run this code
# NOT RUN {
avec <- 5:6   # Alter these (special) values
ivec <- 9:10  # Inflate these (special) values
tvec <- 2:4   # Truncate these (special) values
pobs.a <- c(0.1, 0.2)
pstr.i <- (1:2)/10
size <- 10; prob <- 0.5; xx <- 0:11
y <- rgaitbinom.mlm(1000, size, prob, alter = avec, inflate = ivec,
       truncate = tvec, pstr.i = pstr.i, pobs.a = pobs.a, byrow = TRUE)
table(y)
(ii <- dgaitbinom.mlm(xx, size, prob, alter = avec, inflate = ivec,
       truncate = tvec, pstr.i = pstr.i, pobs.a = pobs.a, byrow = TRUE))
# }

Run the code above in your browser using DataLab