negative binomial distribution

different definitions

Negative binomial distribution NB(k,p), I have seen four definitions in different textbooks and wikis.

  1. For each experiment with a success rate of p, the number of trials required to achieve k successes (ie the minimum value is k)
  2. For each experiment with a success rate of p, the number of failures before reaching k successes (ie the minimum value is 0)
  3. For each experiment with a failure rate of p, the number of trials required to achieve k successes
  4. For each experiment with a failure rate of p, the number of failures before reaching k successes

Negative binomial distribution (Pascal distribution)

Definition: For each experiment with a success rate of p, the number of failures before reaching k successes (ie the minimum value is 0)

Probability mass function:
insert image description here

insert image description here

Code mock:

  • negative_binomial(n, p, size) # nunpy
  • nbinom.rvs(n, p, size) # scipy.stats
# nunpy  
import numpy as np
rng = np.random.default_rng()
print(rng.negative_binomial(n=1, p=0.5, size=3))  # N次成功前的失败次数


# scipy.stats
from scipy import stats
stats.nbinom.rvs(n=1,p=0.1,size=3) # N次成功前的失败次数

Application of Negative Binomial Distribution in DeepAR

Application of Negative Binomial Distribution in DeepAR

Guess you like

Origin blog.csdn.net/qq_34184505/article/details/128919480