zanegbinUC: Zero-Altered Negative Binomial Distribution

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Density, distribution function, quantile function and random generation for the zero-altered negative binomial distribution with parameter pobs0.

Usage

1
2
3
4
dzanegbin(x, size, prob = NULL, munb = NULL, pobs0 = 0, log = FALSE)
pzanegbin(q, size, prob = NULL, munb = NULL, pobs0 = 0)
qzanegbin(p, size, prob = NULL, munb = NULL, pobs0 = 0)
rzanegbin(n, size, prob = NULL, munb = NULL, pobs0 = 0)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1 then the length is taken to be the number required.

size, prob, munb, log

Parameters from the ordinary negative binomial distribution (see dnbinom). Some arguments have been renamed slightly.

pobs0

Probability of zero, called pobs0. The default value of pobs0 = 0 corresponds to the response having a positive negative binomial distribution.

Details

The probability function of Y is 0 with probability pobs0, else a positive negative binomial(munb, size) distribution.

Value

dzanegbin gives the density and pzanegbin gives the distribution function, qzanegbin gives the quantile function, and rzanegbin generates random deviates.

Note

The argument pobs0 is recycled to the required length, and must have values which lie in the interval [0,1].

Author(s)

T. W. Yee

See Also

zanegbinomial, rposnegbin.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
munb <- 3; size <- 4; pobs0 <- 0.3; x <- (-1):7
dzanegbin(x, munb = munb, size = size, pobs0 = pobs0)
table(rzanegbin(100, munb = munb, size = size, pobs0 = pobs0))

## Not run:  x <- 0:10
barplot(rbind(dzanegbin(x, munb = munb, size = size, pobs0 = pobs0),
                dnbinom(x, mu   = munb, size = size)),
        beside = TRUE, col = c("blue", "green"), cex.main = 0.7, las = 1,
        ylab = "Probability", names.arg = as.character(x),
        main = paste("ZANB(munb = ", munb, ", size = ", size,",
                     pobs0 = ", pobs0,
                   ") [blue] vs",  " NB(mu = ", munb, ", size = ", size,
                   ") [green] densities", sep = "")) 
## End(Not run)


Search within the VGAM package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.