Learn R Programming

nbconv (version 1.0.1)

nb_sum_exact: Furman's PMF

Description

Implements Furman's exact PMF for the evaluation of the sum of arbitrary NB random variables. Called by other functions. Not intended to be run alone.

Usage

nb_sum_exact(phis, ps, n.terms = 1000, counts, n.cores = 1, tolerance = 0.001)

Value

A numeric vector of probability densities.

Arguments

phis

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

ps

Vector of individual probabilities of success.

n.terms

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

counts

The vector of counts over which the PMF is evaluated.

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.

Examples

Run this code
nb_sum_exact(ps = c(0.05, 0.44), phis = c(5, 8), counts = 0:500)

Run the code above in your browser using DataLab