getSizeNB: Maximum-likelihood and maximum-a-posteriori estimators for...

Description Usage Arguments Details Value Author(s) Examples

View source: R/getSizeNB.R

Description

Estimates the size parameter of a a negative binomial distribution from given data.

Usage

1
2
  getSizeNB(x, maxCyc = 1000, eta = 0, rmax = Inf,
    method = "bisection")

Arguments

x

The input data. Must be a numeric vector.

maxCyc

The maximum number of cycles of the numeric procedure to find the estimator. (Default = 1000).

eta

The weight of the exponential prior. The higher eta, the lower the estimate for the size parameter. Setting eta = 0 means that the prior is not used and, therefore, the maximum-likelihood estimator is calculated. (Default = 0).

rmax

Upper bound on the size parameter. This corresponds to a truncated exponential prior. If not used there is a non-zero probability that the estimator for the size parameter is . (Default = Inf).

method

The procedure used to solve the equation

∑_{k=1} ^N ψ (x_i+r) - Nψ(r)+N \log ≤ft(\frac{r}{r+ 1/N ∑_{i=1}^N x_i} \right) - η =0

for r.

This can either be "bisection" or "regula falsi". (Default="bisection").

Details

Depending on the parameters you can either obtain the Maximum-likelihood estimator or the maximum-a-posteriori estimator using an exponential prior.

maximum-likelihood estimator eta = 0
maximum-a-posteriori estimator eta > 0

By setting the variable rmax to a positive value one can enforce an upper bound on the parameter.

The inverse of the size parameter is the overdispersion parameter.

Value

"numeric" An estimate of the size parameter of the negative binomial distribution. The overdispersion parameter is the inverse of the size parameter of a negative binomial distribution

Author(s)

Guenter Klambauer klambauer@bioinf.jku.at and Thomas Unterthiner unterthiner@bioinf.jku.at

Examples

1
2
x <- rnbinom(mu=50, size=5, n=10)
getSizeNB(x)

dexus documentation built on Nov. 8, 2020, 11:08 p.m.