zinb {bizicount}R Documentation

The zero-inflated negative binomial (ZINB) distribution

Description

These functions are used to evaluate the zero-inflated negative binomial distribution's probability mass function (PMF), cumulative distribution function (CDF), and quantile function (inverse CDF), as well as generate random realizations from the ZINB distribution.

Usage

dzinb(
  x,
  size,
  psi,
  mu = NULL,
  prob = NULL,
  lower.tail = TRUE,
  log = FALSE,
  recycle = FALSE
)

pzinb(
  q,
  size,
  psi,
  mu = NULL,
  prob = NULL,
  lower.tail = TRUE,
  log.p = FALSE,
  recycle = FALSE
)

qzinb(
  p,
  size,
  psi,
  mu = NULL,
  prob = NULL,
  lower.tail = TRUE,
  log.p = FALSE,
  recycle = FALSE
)

rzinb(n, size, psi, mu = NULL, prob = NULL, recycle = FALSE)

Arguments

x, q

Vector of quantiles at which to evaluate the PMF and CDF, respectively. Should be non-negative integers.

size

The inverse dispersion parameter, or number of successful trials, both for the negative binomial portion of the ZINB mixture distribution. See nbinom.

psi

Vector of zero-inflation probabilities.

mu

Vector of means for the count portion of the zero-inflated negative binomial distribution. Only one of mu or prob should be specified, not both. Should be non-negative. NOTE: This is not the mean of the ZINB distribution; it is the mean of the NB component of the mixture distribution. See nbinom.

prob

The probability of success on each trial in the negative binomial portion of the mixture distribution. Only one of mu or prob should be specified, not both. See nbinom.

lower.tail

Logical indicating whether probabilities should be Pr(X \le x) or Pr(X > x)

log, log.p

Logical indicating whether probabilities should be returned on log scale (for dzip and pzip), or are supplied on log-scale (for qzip).

recycle

Logical indicating whether to permit arbitrary recycling of arguments with unequal length. See 'Details' and 'Examples.'

p

Vector of probabilities at which to evaluate the quantile function.

n

Number of realizations to generate from the distribution

Value

dzinb returns the mass function evaluated at x, pzinb returns the CDF evaluated at q, qzinb returns the quantile function evaluated at p, and rzinb returns random realizations with the specified parameters.

Author(s)

John Niehaus

References

Lambert, Diane. "Zero-inflated Poisson regression, with an application to defects in manufacturing." Technometrics 34.1 (1992): 1-14.

Examples

# zero-inflated negative binomial examples

# two unique lengthed arguments, one is length 1 though. No error.

dzinb(4, size=.25, mu= c(1,2,3), psi=c(.2, .1, .15))


# two unique lengthed arguments, one of them is not length 1
# error
## Not run: 

     dzinb(5, size=c(.25, .3), mu= c(1,2,3), psi=c(.2, .1, .15))


## End(Not run)


# two unique lengthed arguments, one of them is not length 1, set
# recycle = T, no error but can give innacurate results.

dzinb(5, size=c(.25, .3), mu= c(1,2,3), psi=c(.2, .1, .15), recycle=TRUE)

[Package bizicount version 1.3.3 Index]