Learn R Programming

nbconv

Introduction

nbconv was written to facilitate the evaluation of the sums of arbitrary negative binomial (NB) random variables. nbconv implements three distinct methods for approaching this problem: Furman's exact probability mass function (https://ssrn.com/abstract=1650365), saddlepoint approximation, and a method of moments approximation. I would like to acknowledge Martin Modrák for inspiring me to pursue the saddlepoint approximation with his related blog post.

It should be noted that Furman's PMF is expressed as a series representation. Because of this, the accuracy of the evaluation is limited by the number of terms included in the series. The probability values calculated in this way are therefore also approximate solutions, meaning that nbconv only offers approximate solutions to the convolution of NB random variables. Nevertheless, the approximations appear to be rather good ones.

Like other distribution functions in R, nbconv can calculate the density, distribution, and quantile functions of NB convolutions. These are done with dnbconv(), pnbconv(), and qnbconv(), respectively. Each of these functions requires specification of the method of evaluation. Random deviates can be sampled with the rnbconv() function and are obtained independently of any evaluation method. Finally, the function nbconv_params() explicitly calculates the mean, variance, skewness, and excess kurtosis of the convolution distribution using cumulants.

See the manual for more information and please do not hesitate to reach out with any questions or comments.

Installation

You can install the development version of nbconv from GitHub with:

# install.packages("devtools")
devtools::install_github("gbedwell/nbconv")

Copy Link

Version

Install

install.packages('nbconv')

Monthly Downloads

159

Version

1.0.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Gregory Bedwell

Last Published

July 6th, 2023

Functions in nbconv (1.0.1)

nb_sum_saddlepoint

Saddlepoint approximation
qnbconv

Quantile function
nb_sum_exact

Furman's PMF
nb_sum_moments

Method of moments
rnbconv

Random deviates
pnbconv

Cumulative distribution function
nbconv_params

Summary statistics
dnbconv

Probability mass function