Skip to main content
2 of 2
typo
Michael Hardy
  • 1
  • 12
  • 85
  • 126

Why should we expect this odd behavior of negative binomial distributions?

In independent Bernoulli trials with probability $p$ of success on each trial, let $X$ be the number of failures before the $n$th success. Then $$ \Pr(X=x) = \binom{-n}{\phantom{+}x} (-q)^x p^n \text{ for } x=0,1,2,3,\ldots, $$ where $q=1-p={}$probability of failure on each trial and $$ \binom m x = \frac{\overbrace{m(m-1)(m-2)\cdots(m-x+1)}^\text{$x$ factors}}{x!} \text{ for any } m\in \mathbb R, $$ i.e. $X$ has a negative binomial distribution. Then \begin{align} \operatorname E(X) & = nq/p, \\[5pt] \operatorname{var}(X) & = nq/p^2. \end{align} Thus $$\Pr(X>nq/p + 2\sqrt{nq} / p) \tag1$$ is the probability that $X$ is more than two standard deviations above the mean.

With $p=0.8= 1-q$ I graphed the probability in line $(1)$ as a function of $n$ for $n=1,\ldots,300$, using these R commands:

x <- seq(300)
y <- 1 - pnbinom(x * (1-0.8)/0.8 + 2*sqrt(x*(1-0.8)/0.8^2), x, 0.8)
plot(x,y)

enter image description here

Here is the part from $230$ to $280$:

enter image description here

This looks neat and orderly. Now enter this R command:

lines(xx,yy)

(where $\texttt{xx}$ is the sequence from $230$ to $280$ and $\texttt{yy}$ is the corresponding set of $\texttt{y}$ values).

enter image description here

This looks like approximate periodicity with period $7,$ with the lowest points corresponding to indices congruent to $1 \bmod 7.$ So I looked at

xxx <- seq(43)*7 + 1

etc., and got this:

enter image description here

So my question is: Why should we expect all this?

Michael Hardy
  • 1
  • 12
  • 85
  • 126