nb_sum_saddlepoint {nbconv}R Documentation

Saddlepoint approximation

Description

Implements the saddlepoint approximation for the sum of arbitrary NB random variables. Called by other functions. Not intended to be run alone.

Usage

nb_sum_saddlepoint(mus, phis, counts, normalize = TRUE, n.cores = 1)

Arguments

mus

Vector of individual mean values.

phis

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

counts

The vector of counts over which the PMF is evaluated.

normalize

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

n.cores

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

Details

Inspired by https://www.martinmodrak.cz/2019/06/20/approximate-densities-for-sums-of-variables-negative-binomials-and-saddlepoint/

Value

A numeric vector of probability densities.

Examples

nb_sum_saddlepoint(mus = c(100, 10), phis = c(5, 8), counts = 0:500)


[Package nbconv version 1.0.1 Index]