dnbconv {nbconv}R Documentation

Probability mass function

Description

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

Usage

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

Arguments

counts

The counts over which the convolution is evaluated. Should be a vector.

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.

Value

A numeric vector of probability densities.

Examples

dnbconv(counts = 0:500, mus = c(100, 10), phis = c(5, 8), method = "exact")


[Package nbconv version 1.0.1 Index]