# How can I find the distribution for the number of years until the first year's rainfall is exceeded for the first time?

Let $$X_1, X_2, \cdots$$ be jointly continuous and independently distributed with marginal pdf $$f(x)$$, where each $$X_i$$ represents annual rainfall at a given location. How can I find the distribution for the number of years until the first year's rainfall $$(X_1)$$ is exceeded for the first time?

I assume this is a fairly straight forward problem, but I am failing to see what the most logical first step would be. How would you go about thinking of the first step?

• "independent" and also "identical"? The "identical" changes the complexity of this problem considerably.
– Him
Commented Jun 10, 2023 at 13:48
• @Him - the fact that all the $X_i$ have the same marginal PDF and are independent implies identical. Commented Jun 15, 2023 at 15:58

Let us assume that annual rainfall can be considered a continuous variable (which requires the probability of no rainfall in a year to be equal to zero.) The following steps get us to our goal:

1. The first year's rainfall has cumulative distribution function $$F(X_1)$$, and, as is well-known, $$F(X_1) \sim \text{Uniform}(0,1)$$ (the Probability Integral Transform)

2. The probability that any given successive year's rainfall exceeds the first year's rainfall is $$1-F(X_1)$$, label it $$p$$. (This is because the probability of any given successive year's rainfall being $$\leq$$ year 1's rainfall is $$F(X_1)$$, so the probability of exceeding it is just $$1-F(X_1)$$.) Since $$F(X_1) \sim \text{Uniform}(0,1)$$, $$p$$ is too; $$1 -$$ a $$\text{Uniform}(0,1)$$ variate is also a $$\text{Uniform}(0,1)$$ variate.

3. The number of years ($$k$$) until the first exceedence of the first year's rainfall, conditional upon $$p$$, has a Geometric distribution with probability parameter $$p$$: $$p(k | p) = (1-p)^{k-1}p$$.

To remove the conditioning upon $$p$$, we integrate the Geometric distribution with respect to the Uniform distribution on $$p$$, which "disappears" in the expression below because it is equal to $$1$$ everywhere:

$$p(k) = \int_0^1(1-p)^{k-1}p\text{d}p$$

which is the $$\text{Beta}(2,k)$$ function. Expanding this function leads to:

$$p(k) = {1 \over k(k+1)}, \, k \geq 1$$

A quick check in R that this (plausibly) does sum to $$1$$:

> sum(beta(2,1:100000))
[1] 0.99999

• So $p(k)=\frac{1}{k(k+1)}$ is the distribution, where $k \ge 0$, correct? Also, how do you know $F(X_1) \sim U(0,1)$? Commented Nov 28, 2019 at 21:13
• Also, I don't understand your (2) entirely. How do you make those claims? Commented Nov 28, 2019 at 21:15
• Awesome, thanks for adding the link and a bit of an explanation in #2. I did not know about that 1 - $U(0,1) \sim U(0,1)$. That seems like a nice property to know! Commented Nov 29, 2019 at 3:25
• There is an unstated premise in this analysis that all years' chances of exceeding the first years' rainfall are i.i.d.
– Him
Commented Jun 10, 2023 at 13:45

jbowman's answer is correct, though there is an alternative approach to the same answer

By symmetry/exchangeability and assuming a continuous distribution so no ties, the probability that $$X_1$$ is the largest of $$\{X_1,X_2,\cdots X_n\}$$ is $$\frac1n$$ and the probability that $$X_1$$ is the largest of $$\{X_1,X_2,\cdots X_n, X_{n+1}\}$$ is $$\frac1{n+1}$$.

This means the probability $$X_{n+1}$$ is the first value to exceed $$X_1$$ is $$\frac{1}{n}-\frac{1}{n+1}=\frac{1}{n(n+1)}.$$

Slightly counter-intuitively, this implies that the expected number of years until $$X_1$$ is exceeded is therefore infinite. Suppose $$X_{n+1}$$ is the first to exceed $$X_1$$, which takes $$n$$ years to happen. Then the expected number of years is $$\sum\limits_1^\infty n \times \frac1{n(n+1)} = \sum\limits_1^\infty \frac1{n+1}$$ and this is infinite.

• Elegant! (+1) I think you could also have done it with the second "probability that $X_1$ is the..." replaced by "probability that $X_{n+1}$ is the largest...", then just multiplied the two probabilities, since they are clearly independent. Commented Dec 1, 2019 at 1:59
• @jbowman that works too - both working allows independence to be proved formally, and settle any doubts of somebody who thinks perhaps $X_1$ being high (if it is the highest of the first $n$) makes it less likely $X_{n+1}$ will exceed it Commented Dec 1, 2019 at 2:08
• @Edison Try writing $X_1 = \max\limits_{1 \le i \le n} (X_i)$ to say $X_1$ is the largest of the first $n$ $X_i$s. Then the following three equations are true as the first says either $X_1 \gt X_{n+1}$ or $X_1 < X_{n+1}$ and the others are rearrangements with the third being what we want Commented Dec 3, 2019 at 1:42
• $\mathbb P(X_1 = \max\limits_{1 \le i \le n} (X_i)) = \mathbb P(X_1 = \max\limits_{1 \le i \le n} (X_i)\gt X_{n+1}) +\mathbb P(X_1 = \max\limits_{1 \le i \le n} (X_i)\lt X_{n+1})$ $\mathbb P(X_1 = \max\limits_{1 \le i \le n} (X_i)) = \mathbb P(X_1 = \max\limits_{1 \le i \le n+1} (X_i)) +\mathbb P(X_{n+1} \gt X_1 = \max\limits_{1 \le i \le n} (X_i))$ $\mathbb P(X_{n+1} \gt X_1 = \max\limits_{1 \le i \le n} (X_i)) = \mathbb P(X_1 = \max\limits_{1 \le i \le n} (X_i)) -\mathbb P(X_1 = \max\limits_{1 \le i \le n+1} (X_i))$ Commented Dec 3, 2019 at 1:43
• @xabush I have added to the final paragraph Commented Jun 10, 2023 at 13:08