2
$\begingroup$

Suppose you have 2 i.i.d. drawn variables X,Y $\sim\mathcal{U}(0,1)$ , I'm trying to calculate the CDF of $Z = X + (1-X)Y\in[0,1]$. I get stuck around the CDF calculation.

$F_Z(z) = P(Z \leq z) = P(Y \leq \frac{z-X}{1-X})$

I'm trying to find this by integrating out $f_{XY}$. This, however, leads to divergence:

$$ \begin{align} \int\limits_0^1\int\limits_0^\frac{z-x}{1-x} \frac{z-x}{1-x} \, \textrm{d}x \textrm{d}y &= \int\limits_0^1\min \left\{ \frac{z-x}{1-x}, 1\right\} \,\textrm{d}x \\ &= \int\limits_0^1 \frac{x-z}{x-1}\,\textrm{d}x \end{align} $$

How come this is divergent? Intuitively it seems like it should converge properly, but I think I am missing something ...

Update: a random simulation show a similar finding of divergence (as I decrease the bin size, the right bar goes up) so I guess my question changes to: what does it mean for a CDF to be divergent? Is it not proper then?

simulation

Update 2: despite the density keyword in the above code, the y-axis in the above plot is incorrect as described here.

$\endgroup$
4
  • 1
    $\begingroup$ Are you accounting for the minimum in your final line? $\endgroup$
    – Brian Tung
    Commented Jul 11, 2020 at 0:03
  • $\begingroup$ I think so, the minimum is $\frac{z-x}{1-x}$ when $\frac{z-x}{1-x}\leq 1$ and $1$ otherwise. The first condition translates to $z \leq 1$ which is always true due to $z\in[0,1]$. $\endgroup$
    – ciri
    Commented Jul 11, 2020 at 1:07
  • 1
    $\begingroup$ You've plotted the PDF (Probability Density Function), not the CDF (Cumulative Distribution Function). The CDF is $P(Z\le z)$ by definition, so its values are always in the interval $[0,1].$ In R, you can simulate this using x <- runif(10000, 0, 1);y <- runif(10000, 0, 1);z <- x + (1-x)*y;cdf <- ecdf(z);plot(cdf). $\endgroup$
    – r.e.s.
    Commented Jul 14, 2020 at 22:43
  • $\begingroup$ Thanks @r.e.s. , yes it seems like I didn't use mpl correctly here. I was looking at the behavior of the right-most bar which seemed to increase in size and therefore indicated to me that the CDF had a singular point at the edge. As it turns out this is due to my incorrect interpretation of the y-axis (the bars are plotted such that the total area=1 so decreasing bar width increases y axis). Thanks for pointing it out though, I've updated my answer to reflect your comment. $\endgroup$
    – ciri
    Commented Jul 14, 2020 at 22:46

2 Answers 2

1
$\begingroup$

I am not encountering an issue with divergence. Here's how I proceeded; define random variables $U$ and $V$ by $U:=X$ and $V:=X+(1-X)Y$. It's easy to see that $(U,V)$ has joint density $f_{UV}$ where $\\f_{UV}(u,v)=f_{XY}(u,\frac{v-u}{1-u})\left\lvert\frac{\partial(x,y)}{\partial(u,v)}\right\lvert=\frac{1}{1-u}$ whenever $(u,v)\in\Omega$ and $f_{UV}(u,v)=0$ elsewhere. Here, $\Omega:=\{(u,v)\in(0,1)^2|u<v\}$. We can obtain the density for $f_V$ simply by "integrating away" the $u$ variable in the joint density. Doing so gives us $f_V(v)=\ln\big(\frac{1}{1-v}\big)$ for $v\in(0,1)$ and $f_V(v)=0$ elsewhere. From basic integration in Calculus we get that $F_V(v)=(1-v)\ln(1-v)+v$ for $v\in(0,1)$, $F_V(v)=0$ for $v\leq0$, and $F_V(v)=1$ for $v\geq1$. This is the CDF you're looking for.

$\endgroup$
3
  • $\begingroup$ Thank you very much Matthew, the final result looks correct. I'm wondering how you get to $f_{UV}(u,v)=\frac{1}{1-u}$ though. If I calculate $f_{XY}(u,\frac{v-u}{1-u})=v$ and $|\frac{\partial (x,y)}{\partial (u,v)}|=\frac{1}{1-u}$ I obtain $f_{UV}(u,v)=\frac{v}{1-u}$. $\endgroup$
    – ciri
    Commented Jul 14, 2020 at 19:37
  • $\begingroup$ If $X$ and $Y$ are i.i.d. uniform random variables on $[0,1]$ then the joint density of $(X,Y)$ factors as $f_{XY}(x,y)=f_{X}(x)f_{Y}(y)$. This means we can say $f_{XY}(x,y)=1$ on the unit square $[0,1]^2$ and $f_{XY}(x,y)=0$ elsewhere. $\endgroup$
    – user801306
    Commented Jul 14, 2020 at 21:52
  • $\begingroup$ Clear, thank you! $\endgroup$
    – ciri
    Commented Jul 14, 2020 at 21:54
1
$\begingroup$

You can actually proceed with your initial method to arrive at this answer as well. Notice for $z\in[0,1]$ fixed we have that

$P\big(Y\leq\frac{z-X}{1-X}\big)=\int_{ -\infty}^{\infty}P\big(Y\leq\frac{z-x}{1-x}\lvert X=x\big)f_X(x)\,dx=\int_{0}^{z}F_{Y|X}(\frac{z-x}{1-x}|x)f_X(x)\,dx$

Independence suggests that $F_{Y|X}(y|x)=F_Y(y)$ so the last integral simplifies to $\int_{0}^{z}\big(\frac{z-x}{1-x}\big)\,dx=(1-z)\ln(1-z)+z$. I was going to show you this method initially but I took the opportunity to show you how to find the density of a random variable using transformations because I think it's cool af :)

$\endgroup$
1
  • $\begingroup$ Thanks for this! I actually do need to calculate more complex ones with up to 6 variables so I'm already in the process of getting used to it now, learning as I go. I think for this particular question the key was the integral domain. $\endgroup$
    – ciri
    Commented Jul 14, 2020 at 22:44

You must log in to answer this question.

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