1
$\begingroup$

This question is a follow up of this previous question

Let us suppose that we have a sample of 3 random distinct numbers $I=\{z_1,z_2,z_3\}$ that are generated from a uniform distribution with support in $[0,1]$. Let's call $m = \max{I}$ the maximum of the randomly generated sample.

The goal

I want to compute

$$ p(z_2^{n-2}>r\, \cap\, z_2 = m \cap z_1^{n-1}\leq r) $$

for $n=3$ and for some $0\leq r \leq 1$.

Let me call $E_1 : z_2^{n-2}>r$, $E_2 : z_2 = m $ and $E_3 : z_1^{n-1}\leq r$.

First attempt

We can compute the probability using the PDF of the max. Indeed,

$$ p(E_1\cap E_2 \cap E_3) = \frac{1}{n} p(E_1\, \cap E_3| E_2) $$ which could be written as

$$ \begin{align} n \times p(E_1\cap E_2 \cap E_3) &= \int_{r^{\frac{1}{n-2}}}^{r^{\frac{1}{n-1}}} dm \int_0^m dz_1 f_{z_2}(m)+\int_{r^{\frac{1}{n-1}}}^{1} dm \int_0^{r^{\frac{1}{n-1}}} dz_1 f_{z_2}(m)\\ &= -\frac{3 r^4}{4}-\frac{r^2}{4}+\sqrt{r} \end{align} $$

where $f_{z_2}(m) = n\times m^{n-1}$ is the PDF of the maximum.

The question

However, this result is wrong. I can compute $p(E_1\, \cap E_2\, \cap E_3) $ numerically on Mathematica with the following commands

checkDistribution[r_] := 
 Module[{win = 0, loss = 0, list, probability, i},
  For[i = 1, i <= 10000, i++,

(* generating the random sample of float numbers *)
   list = RandomSample[Range[300], 3]/(300) // N;

(* Checking if the condition is met; eventually, increase the variable win *)
   If[list[[2]] > list[[1]] && list[[2]] > list[[3]] && 
     list[[1]]^2 <= r && list[[2]] > r, win = win + 1];];

 (* The variable loss is the number of times the condition is not met *)
  loss = 10000 - win;

(* Compute and return the probability *)
  probability = win/(win + loss);
  Return[{r, probability}]]

(* Generate list of probabilities for different values of r *)
points = Table[checkDistribution[r], {r, 0, 1, 0.01}];

(* Plot points, wrong and correct result *)
Show[points // ListPlot, Plot[{1/3 (Sqrt[r] - r^2/4 - (3 r^4)/4), -(1/6) Sqrt[r] (-3 + r + 2 r^(5/2))}, {r, 0, 1}, PlotStyle -> {Red, Darker[Green]}]]

and I find the following result (see plot below). The dots are the numerics and the red line is the result of the integral. The green line is the solution of the probability described in the next section of the post.

enter image description here

So, the integral must be wrong. Where did I make the mistake? What seems wrong to me is that I am not imposing any constraint on $z_3$. If $z_2 = m$, then I should take into account that $z_3<z_2$.

The correct result

I can compute the probability by brute force. Let me call for simplicity $r_1=\sqrt{r}$ and $r_2=r$. The probability is then

$$ \begin{align} p(E_1\cap E_2 \cap E_3) &= \int_0^1 dz_1\int_0^1 dz_2\int_0^1 dz_3 \theta(z_2-r_2)\theta(r_1-z_1)\theta(z_2-z_1)\theta(z_2-z_3)\\ &= \int_0^{z_2} dz_3 \left[ \int_0^{r_2} dz_1\int_{r_2}^1 dz_2+\int_{r_2}^{r_1} dz_1\int_{z_1}^1 dz_2\right] = -\frac{1}{6} \sqrt{r} \left(2 r^{5/2}+r-3\right) \end{align} $$

after I substitute the definitions of $r_1$, $r_2$. In the first line, $\theta(x)$ is the Heaviside step function.

This is the correct expression of the probability, as can be seen by the green curve in the plot.

$\endgroup$
10
  • $\begingroup$ Your formula $p(E_1 \cap E_2 \cap E_3) = \frac{1}{n} P(E_1 \cap E_3 \mid E_2)$ seems wrong, how did you get it? $\endgroup$
    – William M.
    Commented Mar 18, 2022 at 16:15
  • $\begingroup$ I think that formula is right. It is just $p(E_1\cap E_2 \cap E_3) = p(E_2)p(E_1\, \cap E_3| E_2) $ and $p(E_2)=p(z_2 = m) = 1/n$. $\endgroup$
    – apt45
    Commented Mar 18, 2022 at 16:19
  • $\begingroup$ So $n = 3$? ${}$ $\endgroup$
    – William M.
    Commented Mar 18, 2022 at 16:41
  • $\begingroup$ @WilliamM. yes that's right. It's written in the question $\endgroup$
    – apt45
    Commented Mar 18, 2022 at 16:42
  • $\begingroup$ As a general rule of thumb when asking question, be aware that whatever context or notation you are using that is very specific, we (the mathSE community) most likely will not know. For instance, you are writting $n-2$ and $n-1$ instead of $1$ and $2,$ respectively. In your edit, you wrote $\theta$ but nowhere is the definition of $\theta.$ In general, you should abstract your question so that some context is provided and your doubt is stated clearly without much baggage, which quite frankly, is just noise. $\endgroup$
    – William M.
    Commented Mar 18, 2022 at 17:05

1 Answer 1

1
$\begingroup$

Your notation is confusing, so I will change it to make it clear.

Let $U_1, U_2$ and $U_3$ be three independent random variables drawn from a uniform distribution on $[0, 1].$ We are interested in $$ \lambda = \mathbf{P}(U_1 \leq b, U_2 \geq a, U_2 \geq U_1, U_2 \geq U_3), $$ where $0 < a < b < 1.$ Conditioning on $U_2$ and then using independence, we reach $$ \begin{align*} \lambda &= \int\limits_a^1 du_2\ P(U_1 \leq \min(b, u_2), U_3 \leq u_2) = \int\limits_a^1 du_2\ \min(b, u_2) u_2 \\ &= \int\limits_a^b dt\ t^2 + \int\limits_b^1 dt\ bt = \dfrac{b^3-a^3}{3} + \dfrac{b(1-b^2)}{2}. \end{align*} $$ Upon setting $a = r$ and $b = \sqrt{r},$ the result will follow: $$ \lambda = \dfrac{r\sqrt{r}-r^3}{3} + \dfrac{\sqrt{r}(1-r)}{2} = \dfrac{1}{2} \sqrt{r} - \dfrac{1}{6} r\sqrt{r} - \dfrac{1}{3} r^3. $$

$\endgroup$
5
  • $\begingroup$ Are you sure your result is right? It doesn't match my final formula $-\frac{1}{6} \sqrt{r} \left(2 r^{5/2}+r-3\right)$ (and notice that my formula fits the numerical data) $\endgroup$
    – apt45
    Commented Mar 18, 2022 at 17:05
  • $\begingroup$ I checked it twice. I did notice it doesn't match. Again, your notation is just too much to follow. Maybe your code is also wrong and you are estimating something else, IDK. I will not check your code. $\endgroup$
    – William M.
    Commented Mar 18, 2022 at 17:07
  • $\begingroup$ There is a mistake in the second line of your answer. $\int\limits_a^1 du_2\ \min(b, u_2) u_2 = \int_b^1 dt b t + \int_a^b dt t^2$ which gives my answer. $\endgroup$
    – apt45
    Commented Mar 18, 2022 at 17:48
  • $\begingroup$ That's great! I was also stuck checking my own computations now. And indeed, I messed up the minimum. $\endgroup$
    – William M.
    Commented Mar 18, 2022 at 17:52
  • $\begingroup$ I would like however to compute the probability by just using the PDF of the maximum $m$, that is $f_\text{max}(m) = 3 m^2$ $\endgroup$
    – apt45
    Commented Mar 18, 2022 at 18:38

You must log in to answer this question.

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