Learn R Programming

nbconv (version 1.0.1)

qnbconv: Quantile function

Description

Calculates the quantile function for the convolution of arbitrary negative binomial random variables.

Usage

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

Value

A numeric vector of quantiles.

Arguments

probs

Vector of target (cumulative) probabilities.

counts

Vector of counts over which the PMF is evaluated.

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
qnbconv(probs = c(0.05, 0.25, 0.5, 0.75, 0.95), counts = 0:500,
       mus = c(100, 10), phis = c(5, 8), method = "exact")

Run the code above in your browser using DataLab