fitNB: Fit a negative binomial distribution

Description Usage Arguments Value

View source: R/kfoots.R

Description

Maximum Likelihood Estimate for the parameters of a negative binomial distribution generating a specified vector of counts. The MLE for the negative binomial should not be used with a small number of datapoints, it is known to be biased. Internally, this function is using Brent's method to find the optimal dispersion parameter.

Usage

1
2
fitNB(counts, posteriors = NULL, old_r = NULL, tol = 1e-08,
  nthreads = 1)

Arguments

counts

a vector of counts. If a list is given, then it is assumed to be the result of the function mapToUnique(counts)

posteriors

a vector specifying a weight for each count. The maximized function is: ∑_{i=1}{L}{posteriors[i]\log(Prob\{counts[i]\}}. If not specified, equal weights will be assumed

old_r

an initial value for the size parameter of the negative binomial. If not specified the methods of moments will be used for an initial guess.

tol

numerical tolerance of the fitting algorithm

nthreads

number of threads. Too many threads might worsen the performance

Value

A list with the parameters of the negative binomial.

mu

the mu parameter

r

the size parameter


lamortenera/kfoots documentation built on May 20, 2019, 7:34 p.m.