(Basic Statistics for Citizen Data Scientist)
Negative Binomial and Geometric Distributions
Negative Binomial Distribution
Definition 1: Under the same assumptions as for the binomial distribution, let x be a discrete random variable. The probability density function (pdf) for the negative binomial distribution is the probability of getting x failures before k successes where p = the probability of success on any single trial. Thus the pdf is
f(x) = C(x+k−1, x)pk(1−p)x
Excel Functions: Excel provides the following function regarding the negative binomial distribution:
NEGBINOMDIST(x, k, p) = the probability of getting x failures before y successes where p = the probability of success on any single trial; i.e. the pdf of the negative binomial distribution.
Excel 2010/2013 provide the following additional function: NEGBINOM.DIST(x, k, p, cum) where cum takes the values TRUE or FALSE. In particular, NEGBINOM.DIST(x, k, p, FALSE) = NEGBINOMDIST(x, k, p), while NEGBINOM.DIST(x, k, p, TRUE) = the probability of getting at most x failures before k successes, where p = the probability of success on any single trial; i.e. the cumulative probability function.
Real Statistics Function: Excel doesn’t provide a worksheet function for the inverse of the negative binomial distribution. Instead you can use the following function provided by the Real Statistics Resource Pack.
NEGBINOM_INV(p, k, pp) = smallest integer x such that NEGBINOM.DIST(x, k, pp, TRUE) ≥ p.
Note that the maximum value of x is 1,024,000,000. A value higher than this indicates an error. This function is only available for users of Excel 2010 or later.
Key statistical properties of the negative binomial distribution are:
- Mean = k(1 – p) ⁄ p
- Variance = k(1 – p) ⁄ p2
- Skewness = (2 – p) ⁄
- Kurtosis = (p2 – 6p + 6) ⁄ [k(1 – p)]
Geometric Distribution
The geometric distribution is a special case of the negative binomial distribution, where k = 1. The pdf is
The cumulative distribution function (cdf) of the geometric distribution is
The pdf represents the probability of getting x failures before the first success, while the cdf represents the probability of getting at most x failures before the first success.
Observation: The geometric distribution is memoryless, which means that if you intend to repeat an experiment until the first success, then, given that the first success has not yet occurred, the conditional probability distribution of the number of additional trials required until the first success does not depend on how many failures have already occurred. The die one throws or the coin one tosses does not have a “memory” of any previous successes or failures. The geometric distribution is in fact the only memoryless discrete distribution that we will study.
Other key statistical properties of the geometric distribution are:
- Mean = (1 – p) ⁄ p
- Mode = 0
- Range = [0, ∞)
- Variance = (1 – p) ⁄ p2
- Skewness = (2 – p) ⁄
- Kurtosis = 6 + p2 ⁄ (1 – p)
Statistics for Beginners in Excel – Negative Binomial and Geometric Distributions
Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.
Learn by Coding: v-Tutorials on Applied Machine Learning and Data Science for Beginners
Latest end-to-end Learn by Coding Projects (Jupyter Notebooks) in Python and R:
All Notebooks in One Bundle: Data Science Recipes and Examples in Python & R.
End-to-End Python Machine Learning Recipes & Examples.
End-to-End R Machine Learning Recipes & Examples.
Applied Statistics with R for Beginners and Business Professionals
Data Science and Machine Learning Projects in Python: Tabular Data Analytics
Data Science and Machine Learning Projects in R: Tabular Data Analytics
Python Machine Learning & Data Science Recipes: Learn by Coding
R Machine Learning & Data Science Recipes: Learn by Coding
Comparing Different Machine Learning Algorithms in Python for Classification (FREE)
There are 2000+ End-to-End Python & R Notebooks are available to build Professional Portfolio as a Data Scientist and/or Machine Learning Specialist. All Notebooks are only $29.95. We would like to request you to have a look at the website for FREE the end-to-end notebooks, and then decide whether you would like to purchase or not.