4
$\begingroup$

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?

$\endgroup$
5
  • 1
    $\begingroup$ It might be due to the fact that it only takes integers — can you try to graph the fractional part of $nq/p +2\sqrt{nq}/p$? $\endgroup$ Commented Dec 1, 2023 at 3:59
  • $\begingroup$ I don't understand. If you plot from 1250 to 1300 you get a periodicity of 4. Isn't this the usual effect if you approximate real numbers by integers? $\endgroup$ Commented Dec 1, 2023 at 13:01
  • $\begingroup$ Plotting with 3100:3200 again looks quite different. Here the period may be around 25. $\endgroup$ Commented Dec 1, 2023 at 13:28
  • $\begingroup$ @CommandMaster : I think I may try that later today$\,\ldots \qquad$ $\endgroup$ Commented Dec 2, 2023 at 19:27
  • $\begingroup$ ok, Part of the answer is starting to become clear, I think. $\endgroup$ Commented Dec 4, 2023 at 21:46

1 Answer 1

6
$\begingroup$

This "odd behavior" is not peculiar to the negative binomial distribution.

A somewhat similar behavior is exhibited e.g. by the binomial distribution. For instance, here is the graph $\{(n,g_{0.6}(n))\colon n=1,\dots,300\}$, where $g_p(n):=P(X_{n,p}>EX_{n,p}+2\sqrt{\operatorname{Var}X_{n,p}})$ and $X_{n,p}$ has the binomial distribution with parameters $n,p$:

enter image description here

(Cf. your first picture.)

The cause of such "quasi-periodic" behavior is that the underlying distribution (say, that of $X_{1,p}$) is supported on a lattice. This phenomenon is well explained by the asymptotic expansion (in powers of $1/\sqrt n$) of the (standardized) c.d.f. of the sum of lattice-valued i.i.d. random variables given, say, by Theorem 6 in Ch. VI of Petrov's book. Note, in particular, the presence in that asymptotic expansion of the $1$-periodic, somewhat trig-like "functions" $$S_{2k}(x):= \sum _{l=1}^{\infty } \frac{\cos (2 \pi l x)}{(2 \pi l)^{2 k}},\quad S_{2k+1}(x):= \sum _{l=1}^{\infty } \frac{\sin(2 \pi l x)}{(2 \pi l)^{2 k+1}}$$ (as well as the "function" $\delta_\nu$, which depends on $\nu\text{ mod }4$). Here are the graphs $\{(x,S_{2k+1}(x))\colon-1<x<2\}$ for $k=0$ (left), $k=1$ (center), and $k=2$ (right):

enter image description here

Here is also the graph $\{(n,S_1(2 \sqrt{n p (1-p)}+p n+\lfloor -p n\rfloor)) \colon n=1,\dots,100\}$ for $p=0.6$, relevant to the above graph $\{(n,g_{0.6}(n))\colon n=1,\dots,300\}$:

enter image description here

$\endgroup$
1
  • $\begingroup$ I could say I was "about to" answer this in essentially the same way myself, if "about to" means I realized what the issue was, but if "about to" is construed chronologically, then I wasn't since it would have take time to organize all my words. $\endgroup$ Commented Dec 5, 2023 at 23:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .