9

$$ P(x,n) = \frac{x(n-1)!}{n^{x}(n-x)! } $$

I'm having a really tough time describing what this distribution does, but it's simple in code. So if you know code, then read on:

// example with n = 10
// keep incrementing x until it is greater than random number between 0 and 10
// note that the random number is generated after each iteration
var i = 0;
while (i++ < Math.random() * 10){};
i = i - 1;
// P(3, 10) = the odds that i will end up being 3 

What is the name of this distribution?

Amzoti
  • 56,093

1 Answers1

4

Let $X$ be a random variable with probability mass function $$ p_m = \mathbb{P}\left(X=m\right) = \frac{m}{n^m} \frac{(n-1)!}{(n-m)!} [ 1 \leqslant m \leqslant n ] $$ The pmf satisfies a simple recurrence equation: $$ \frac{p_{m+1}}{p_m} = \frac{n-m}{n} \frac{m+1}{m} $$ discrete distributions whose pmf satisfy first order difference equation with polynomial coefficients were studies by Katz (see Johnson, Kemp, Kotz), who considered them discrete analogs of Pearson distribution family.

It remains to prove that the sampling procedure is correct. The probability of the event that the sampling code above yields $m$, is equivalent to the probability that $$ \mathbb{P}\left(U_1 > \frac{1}{n}, U_2 > \frac{2}{n}, \ldots, U_{m-1} > \frac{m-1}{n}, U_m < \frac{m}{n} \right) = \frac{m}{n}\prod_{k=1}^{m-1} \left(1-\frac{k}{n}\right) = \frac{m}{n^m} \frac{(n-1)!}{(n-m)!} $$ where $U_k$ are iid continuous random variables, uniformly distributed on the unit interval.


Actually this particular distribution is known as Naor's distribution, which arises in an urn model.
Sasha
  • 70,631
  • 2
    +1 It would also worth noting that for $\displaystyle F_m = - \frac{n!}{(n-m)! n^m}$ we have $F_{m+1} - F_m = p_m$ implying $$\sum_{m=1}^n p_m = F_{n+1} - F_1 = 0 - (-1) = 1$$ Thus verifying the normalization. – user40314 Jan 11 '13 at 22:55