loglikelihood.negativeBinomial
loglikelihood.negativeBinomial, function
def autodiff pure loglikelihood.negativeBinomial(
mean: number,
dispersion: number,
k: number): number
def autodiff pure loglikelihood.negativeBinomial(
mean: number,
dispersion: number,
zeroInflation: number,
k: number): number
Returns the log-likelihood of observing k under a negative binomial
distribution, optionally with zero inflation.
mean: mean of the distribution, must be positive.dispersion: dispersion, must be >= 1.zeroInflation: extra probability mass at zero, in [0, 1].k: observation, must be a non-negative integer.
Examples
table T = with
[| as Mean, as Dispersion, as K |]
[| 2, 1.5, 3 |]
[| 4, 2.0, 0 |]
T.LL = loglikelihood.negativeBinomial(T.Mean, T.Dispersion, T.K)
show table "Negative binomial" with
T.Mean
T.Dispersion
T.K
T.LL
This produces the following table:
| Mean | Dispersion | K | LL |
|---|---|---|---|
| 2 | 1.5 | 3 | -1.921965 |
| 4 | 2 | 0 | -2.772589 |
table T = with
[| as Mean, as Dispersion, as ZeroInflation, as K |]
[| 2, 1.5, 0.2, 0 |]
[| 2, 1.5, 0.2, 3 |]
T.LL = loglikelihood.negativeBinomial(
T.Mean, T.Dispersion, T.ZeroInflation, T.K)
show table "Zero inflated" with
T.K
T.LL
This produces the following table:
| K | LL |
|---|---|
| 0 | -1.027153 |
| 3 | -2.145108 |