I have a dataset which, by the looks of it, closely resembles a negative binomial distribution. It is the number of minutes an event has lasted. Here is the original data:

!Raw Data1

I calculate the mean and variance of my data. Mean = 19.08, Variance = 54.67. I try to find out the parameters with which a negative binomial distribution would have the same mean and variance to see if it looks anything like my sample. I see in the literature people work with different parameters - normally they choose two of the p, r, the mean and the variance. Since I have made an assumption for the mean and the variance I decide to look for p and r. Using the following formulas for the mean and the variance (courtesy of Wikipedia):

enter image description here

... I arrive at p = 0.65 & r = 10.23. If I understand correctly r that is not an integer is perhaps not very logical but computationally possible. Then I calculate the pmf for the single values of X and compare with my sample. To my surprise the negative binomial distribution I have simulated looks nothing like my sample:

enter image description here

I decide to start playing around with the parameters and with certain values I get pretty close to what I observe. For example, for p = 0.375 and r = 11 it looks like this:

enter image description here

Now that looks pretty much like the distribution of my sample. However, using the Wiki formulas from above, those p and r values lead to a mean = 6.6! It is obvious from the diagram alone that that doesn't make sense. The graph peaks around 17, and is a bit skewed to the left, so the mean should be somewhat bigger than that. Now I am confused.

So my question is, why do the p and r values that match my observed mean and variance lead to an entirely different distribution? Or the other way around, why do the p and r values that produce a distribution matching the observed one, lead to a mean that is obviously very wrong? What am I doing wrong here?

Note: All the calculation are done in Excel. Using the Excel formula for a pmf of a negative binomial and calculating it "manually" leads to the same result. As you see it is a very layman's task and I don't aim at the most acurate estimation of the parameters but want to understand where is the mistake in my reasoning and why am I so far off.

Thanks in advance to anyone willing to help!


I ran into a similar problem a couple weeks ago. On Wikipedia, the definition has $r$ as the number of failures, and the random variable is the number of successes. But everywhere else, $r$ is the number of successes, and the random variable is the number of failures.

Defined in the usual way, the mean of a negative binomial RV is $\mu = \frac{r(1 - p)}{p}$ and the variance is $\sigma^2 = \frac{r(1 - p)}{p^2}$.

Using these with the $r$ and $p$ you found, you get $\mu = 18.33$ and $\sigma^2 = 48.88$, which looks to be more in line with what you're seeing.

I'm not sure why Wikipedia has a different definition than the typical one.

  • $\begingroup$ That's it! Thank you! $\endgroup$ – Nenko Mar 23 '20 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.