3

My question derives from Problem calculating joint and marginal distribution of two uniform distributions. So, suppose we have random variables $X_1$ distributed as $U[0,1]$ and $X_2$ distributed as $U[0,X_1]$, where $U[a,b]$ means uniform distribution in interval $[a,b]$.

From the previous answer, we have the following:.

$$ p(x_1,x_2) = \frac{1}{x_1}, \text{ for }\quad 0\le x_1\le 1, \quad 0\le x_2 \le x_1,$$

$$ p(x_1)= 1, \text{ for } \quad 0\le x_1\le 1.$$

$$ p(x_2)= \log\big(\frac{1}{x_2}\big), \text{ for } \quad 0\le x_2\le x_1.$$.

Now, I have two questions:

  1. If I compute $$\int_{0}^{1} p(x_2) dx_2 = \int_{0}^{x_1} \log\big(\frac{1}{x_2}\big) dx_2 = x_1 + x_1\log (x_1)$$ since $0\le x_2\le x_1$ and assuming that $0 \log(0) = 0$. But this formula is not equal to one unless $x_1 = 1$. So is $p(x_2)$ a distribution?

  2. What is the distribution $p(y)$ of $Y = X_1 + X_2$? I tried to compute it analytically with the convolution formula but without obtaining any success.

aprospero
  • 153
  • 5
  • In (1), what does your computation reflect? It's not the conditional distribution. Its value isn't supposed to be $1$ *except* when $x_1=1.$ In (2), exactly how did you set up the computation? (It's a little tricky, so it would help to see what you tried.) – whuber Aug 22 '19 at 15:51
  • In (1) my aim was to verify that the distribution $p(x2)$ indeed is a distribution, so that the integral of the marginal over the support is 1. I guessed that the integral should have been one for each value of $x_1 \in [0,1]$ and not just for $x_1 = 1$. – aprospero Aug 22 '19 at 16:34
  • The integral you computed is the cumulative distribution function. It cannot be $1$ except at the maximum value of $x_1$ and above. – whuber Aug 22 '19 at 16:38
  • In (1) I guess the cumulative distribution function by definition is integrated over $x_2$ in the upper limit and not $x_1$, so that $F(x_2) = \int_0^{x_2} p(x_2) dx_2$. In (2) I tried to apply the formula in here: (https://en.wikipedia.org/wiki/Convolution_of_probability_distributions), so that $p_3(y) = \int_{-\infty}^{+\infty}p_1(x)p_2(y-x)dx$, where $p_1$ and $p_2$ represent the distributions of $Y$, $X_1$, $X_2$ respectively (needed to slightly change the notation). – aprospero Aug 22 '19 at 16:51
  • It's unclear what you mean by "$p_1$" and "$p_2$." The variables in this distribution are obviously not dependent, so the joint distribution does not factor. Perhaps you should begin by working out the answer to the referenced question explicitly. (Neither that question nor any of its answers actually display the joint distribution function.) – whuber Aug 22 '19 at 17:22
  • You're right. Variables are clearly dependent and convolution formula cannot be computed, I missed this point. I changed the title of the question accordingly. I don't get why you say we don't have the joint probability distribution though. The joint probability distribution is $p(x_1, x_2) = \frac{1}{x_1}$, right? Also, even if this is joint distribution, I don't know how computing the sum of these dependent random variables. – aprospero Aug 22 '19 at 20:19
  • That's not the correct joint distribution: it's essential to include an explicit indication of where its values are *zero.* Getting the right answer depends on this! – whuber Aug 22 '19 at 20:35
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/97746/discussion-between-aprospero-and-whuber). – aprospero Aug 22 '19 at 20:40
  • @aprospero be very careful not to use the same variable as the upper limit of an integral and as the dummy in the integral (the "x" referred to by the "dx" at the end of the integral, the thing you're integrating over). This expression: $ \int_0^{x_2} p(x_2) dx_2$ is a problem. Try something like $ \int_0^{x_2} p_{s}(u) du$ where $s$ here stands for some random variable or vector of variables (since you need to distinguish which $p$ is being discussed) – Glen_b Aug 23 '19 at 02:20
  • @Glen_b yes you're right, I guess some of my errors during the computation were due to this. Thanks – aprospero Aug 24 '19 at 12:08

1 Answers1

4

It is important to keep track of where the densities are zero. Drawing a picture helps immensely.

When $X$ has a uniform distribution on $[0,1]$ (with density $f_X(x)=1$ on that interval, $0$ elsewhere) and $Y,$ conditional on $X,$ has a uniform distribution on $[0,X]$ (therefore with density $f_{X\mid Y}(y\mid x)=1/x$ on that interval and $0$ elsewhere) then

  1. The support of $(X,Y)$ is the triangle $\Delta$ defined by the X-axis, the line $X=1,$ and the line $Y=X.$

  2. On the triangle $\Delta$ the joint density is $$h(x,y) = f_{X\mid Y}(y \mid x) f_X(x) = \frac{1}{x}$$ and elsewhere $h$ is zero.

Note that the conditional CDF is just as readily obtained as

$$\Pr(Y \le y \mid X) = \left\{\matrix{1& y \ge X \\ \frac{y}{X} & 0 \le y \le X}\right.$$

The CDF of $T=X+Y$ at any value $t$ can be found by integrating over the values of $X$ and breaking that into three regions marked by the endpoints $t/2,t,0$ and $1:$

  • $t/2$ is a key point because when $X\le t/2,$ $Y$ can have any value between $0$ and $t/2,$ but when $X\gt t/2,$ $Y$ is limited to the range $[0,t-X],$ where it has probability $(t-X)/X.$

  • $t$ is a key point because it is impossible for $X$ to exceed $t$ when $X+Y=t.$

  • $0$ and $1$ are key points because they delimit the support of $X.$

![Plot of regions

In this figure, $\Delta$--the support of $(X,Y)$--is the gray triangle. The region $X+Y\lt t$ below and to the left of the red line is shaded red. The integration is carried out for $x$ from $0$ to $t,$ covering the triangle of base $t$ and height $t/2.$ That triangle consists of two equal halves, from which the blue portion at the right from $1$ to $t$ is subtracted.

Thus

$$\eqalign{ \Pr(X+Y\lt t) &= \Pr(Y \le t-X) = E[\Pr(Y\le t-x) \mid X=x] \\ &= \int_0^{t/2} 1\mathrm{d}x + \int_0^t \frac{t-x}{x}\mathrm{d}x + \int_t^1 \frac{t-x}{x}\mathrm{d}x \\ &= \left\{\matrix{t\log 2 & t \le 1 \\ t\log 2 + t - 1 - t\log t & 1 \lt t \le 2.}\right. }$$

Differentiating with respect to $t$ yields the density of $T$, given by $f_T(t)=\log 2$ when $0\le t \lt 1$ and by $f_T(t)=\log 2 - \log t$ for $1 \lt t \le 2.$

Here, as a check, is a graph of this $f_T$ superimposed on a histogram of ten million iid realizations of $X+Y:$

Figure

The R code used to produce this simulation is clear and swift in execution:

n <- 1e7
x <- runif(n)
y <- runif(n, 0, x)
z <- x+y
hist(z, freq=FALSE, breaks=100, main="Density of T", xlab="T")
curve(ifelse(x <= 1, log(2), log(2/x)), col="Red", add=TRUE, lwd=2)
whuber
  • 281,159
  • 54
  • 637
  • 1,101