Learn R Programming

nbconv (version 1.0.1)

pnbconv: Cumulative distribution function

Description

Calculates the CDF for the convolution of arbitrary negative binomial random variables.

Usage

pnbconv(
  quants,
  mus,
  ps,
  phis,
  method = c("exact", "moments", "saddlepoint"),
  n.terms = 1000,
  n.cores = 1,
  tolerance = 0.001,
  normalize = TRUE
)

Value

A numeric vector of cumulative probability densities.

Arguments

quants

Vector of quantiles.

mus

Vector of individual mean values

ps

Vector of individual probabilities of success.

phis

Vector of individual dispersion parameters. Equivalent to 'size' in dnbinom.

method

The method by which to evaluate the PMF. One of "exact", "moments", or "saddlepoint".

n.terms

The number of terms to include in the series for evaluating the PMF at a given number of counts. Defaults to 1000.

n.cores

The number of CPU cores to use in the evaluation. Allows parallelization.

tolerance

The acceptable difference between the sum of the K distribution and 1.

normalize

Boolean. If TRUE, the PMF is normalized to sum to 1.

Examples

Run this code
pnbconv(quants = 200, mus = c(100, 10), phis = c(5, 8), method = "exact")

Run the code above in your browser using DataLab