# Statistical inference question evaluating a joint probability mesure w.r.t. a distribution

Note: I have edited this question and delted my old question after following the guidlines to be more clear. I hope this new question is clear and well posed.

I attempted this question but I got stuck understanding the solution I found online

5.2 Suppose $$X_{1}, X_{2}, \ldots$$ are jointly continuous and independent, each distributed with marginal pdf $$f(x)$$, where each $$X_{i}$$ represents annual rainfall at a given location. (a) Find the distribution of the number of years until the first year's rainfall, $$X_{1}$$, is exceeded for the first time.

(a) Let $$N$$ denote the number of years until the first year's rainfall, $$X_{1}$$, is exceeded for the first time. Then, for $$n \geq 2$$, \begin{aligned} P(N=n-1) &=\int_{0}^{\infty} P\left(X_{1}=x, X_{2} \leq x, \ldots, X_{n-1} \leq x, X_{n}>x \mid X_{1}=x\right) f(x) \mathrm{d} x \\ &=\int_{0}^{\infty} F^{n-2}(x)(1-F(x)) f(x) \mathrm{d} x \quad(u=F(x)) \\ &=\int_{0}^{1} u^{n-2}(1-u) \mathrm{d} u \\ &=\left(\frac{1}{n-1}-\frac{1}{n}\right) \end{aligned}

Why must we integrate with respect to $$x$$? More specifically, what is the formal justification for this equality holding

$$P(N=n-1) =\int_{0}^{\infty} P\left(X_{1}=x, X_{2} \leq x, \ldots, X_{n-1} \leq x, X_{n}>x \mid X_{1}=x\right) f(x) \mathrm{d} x? \\$$

My instict for turning the probability of $$N=n-1$$ into an expectation would be:

$$P(N=n-1)\\ =\mathbb{E}\left[1_{\{\omega: X_{1}=x, X_{2} \leq x, \ldots, X_{n-1} \leq x, X_{n}>x \}} \right]\\ =\int_\Omega1_{\{\omega: X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x \}} dP\omega$$

but this does not make use of any conditional expectation. How can I arrive at first equality of the solution?

EDIT: Here is my full thought process:

First, observe that $$\{N=n-1\}=\left\{\omega \in \Omega: \exists x \in \mathbb{R} X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x, \right\}$$

Now $$P(N=n-1)\\ =\mathbb{E}\left[1_{N=n-1}\right]\\ =\mathbb{E}\left[1_{\left\{\omega \in \Omega: \exists x \in \mathbb{R} X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x, \right\}}\right]$$

By the law of total expectation

$$=\mathbb{E}\left[\mathbb{E}\left[1_{\left\{\omega \in \Omega: \exists x \in \mathbb{R}X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x, \right\}}\mid X_1\right] \right]\\ =\int_{\mathbb{R}} \mathbb{E}\left[1_{\left\{\omega \in \Omega:\exists x \in \mathbb{R} X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x, \right\}}\mid X_1 = x \right] f(x)dx\\ =\int_{\mathbb{R}} \mathbb{P}\left({\left\{\omega \in \Omega:\exists x \in \mathbb{R} X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x, \right\}}\mid X_1 = x \right) f(x)dx\\$$

Now $$\mathbb{P}\left({\left\{\omega \in \Omega:\exists x \in \mathbb{R} X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x, \right\}}\mid X_1 = x \right)\\ =\frac{\mathbb{P}({\left\{\omega \in \Omega:\exists x \in \mathbb{R} X_{1}(\omega)=x, X_{2}(\omega) \leq x, \ldots, X_{n-1}(\omega) \leq x, X_{n}(\omega)>x, \right\}}\cap \{X_1=x\})}{\mathbb{P}(\{X_1=x\})}\\ =\frac{\mathbb{P}({\left\{X_{1}(\omega)=x\}) \mathbb{P}(\{X_{2}(\omega) \leq x\}) \ldots \mathbb{P}(\{X_{n-1}(\omega) \leq x\}) \mathbb{P}(\{X_{n}(\omega)>x \right\}})}{\mathbb{P}(\{X_1=x\})}$$

So we have

$$=\int_{\mathbb{R}} \mathbb{P}(\{X_{2}(\omega) \leq x\}) \ldots \mathbb{P}(\{X_{n-1}(\omega) \leq x\}) \mathbb{P}(\{X_{n}(\omega)>x \})f(x)dx\\ =\int_{\mathbb{R}} F(x) \ldots F(X) (1-F(X))f(x)dx$$

• Are you asking whether LOTUS holds? If not, could you elaborate on what you are trying to do? (Incidentally, the question is more easily addressed with a symmetry argument: it's clear $X_1$ has a $1/n$ chance of being the largest of the first $n$ values and that the event in question is that $X_1$ is the largest of $n-1$ but not largest of $n$ values, whence the answer is $1/(n-1)-1/n$--with no integration required!)
– whuber
Jun 20 at 19:00
• @whuber I'm trying to understand the thought process of that integration solution. Namely how they went from "we need to compute $P(N=n-1)$" to realizing this is equal to conditional probability integrated. I don't understand how they knew to condition on X_1=x, and further that they should have integrated over all the possible values $X_1$ could take on. I would be really grateful if someone could highlight the thinking here. Jun 20 at 19:03
• Consider how the event is characterized: it is conditional on $X_1.$ That's explicit in the question.
– whuber
Jun 20 at 19:08
• @whuber ah that makes alot of sense! In my solution what exactly is conditioned? Should I include this conditioning in the expectation writing it instead as $=\mathbb{E}\left[1_{\{\omega: X_{1}=x, X_{2} \leq x, \ldots, X_{n-1} \leq x, X_{n}>x \}} \mid X_1 = x\right]$ But then where would the integral over all $x$ come into play? I'm used to the theorem which says "if you have a probability of a set this is the same as the integral of the indicator of this set w.r.t. the probability measure". But when conditioning comes into play im not sure what to do . Jun 20 at 19:12
• @whuber ah of course this makes a lot of sense now thank you! Jun 20 at 22:23