Help understanding steps in computations with Conditional random variables

70 Views Asked by At

I was given the following problem:

Let $X\sim U[-3,-1]$, $Y\sim\text{Exp}(1/4)$, and $Z\sim\text{Bern}(3/4)$ be independent random variables. Let $T$ be defined as:

$$T = \begin{cases} X & Z = 0 \\ Y & Z = 1\end{cases}$$

a. Compute the CDF of $T$

b. Compute $\mathbb{E}[TZ]$

c. Compute $\text{Cov}(T,Z)$

I've also been given the following worked solutions for this problem:

enter image description here

I'm having issues understanding this worked solution though. My questions are:

  1. What formula, principle or theorem did we use by applying $\mathbb{E}(T)=\mathbb{E}(Y)\Pr(Z=1)$.

  2. why is $F_T(t)=1/4$ for $t\in[-1,0)$?

  3. How did we get the expression:

$$TZ = \begin{cases} 0 & T <0\\ T & T\geq 0\end{cases}$$

2

There are 2 best solutions below

2
On
  1. The Law of Total Expectation states that: $$\mathbb{E}[X] = \mathbb{E}[\mathbb{E}[X|Y]]$$

This means that:

$$\mathbb{E}[TZ] = \mathbb{E}[\mathbb{E}[TZ|Z]]$$

Now, we have that: $$\mathbb{E}[TZ] = \mathbb{E}[TZ|Z = 0] \Pr[Z = 0] + \mathbb{E}[TZ|Z = 1]\Pr[Z = 1]$$ We have that $\mathbb{E}[TZ|Z = 0]=\mathbb{E}[0X] = 0$, and that $\mathbb{E}[TZ|Z = 1] = \mathbb{E}[Y]$, so:

$$\mathbb{E}[TZ] = \mathbb{E}[Y]\Pr[Z = 1]$$ as desired.

  1. Since $X\sim U[-3,-1]$, we have that $\Pr[X < t] = 1$ for $t\in[-1,0)$. Since $Y\sim\text{Exp}(1/4)$, we have that $\Pr[Y < t] = 0$ for $t\in[-1,0)$ (the support of an exponential random variable is $t > 0$). It follows that:

$$F_T(t) = \Pr[X < t]\frac{1}{4} + \Pr[Y < t] \frac{3}{4} = 1\frac{1}{4} + 0\frac{3}{4} = \frac{1}{4},\quad t\in [-1,0)$$

  1. The relevant line of reasoning here is:

Since $T = Y\geq 0$ when $Z = 1$, and $T = X < 0$ when $Z = 0$.

This observes that the only way for $T\geq 0$ to hold is if $T = Y$ and $Z = 1$, so $TZ = T*1 = T$ (It's additionally the case that $T = Y$, but writing this doesn't aid the integral later).

Similarly, the only way for $T < 0$ to hold is if $T = X < 0$, but this occurs when $Z = 0$, so $TZ = X*0 = 0$.

0
On

Graphical Comment: You have a nice analytical answer from @Mark (+1). This is a 'mixture distribution' of the uniform distribution of $X$ and the exponential distribution of $Y,$ where mixing is controlled by the Bernoulli distribution of $Z.$ [Because the exponential distribution is parameterized in a couple of different ways depending on the text or software you are using, you need to say that your exponential distribution has mean $\mu = 4$ or rate $\lambda = 1/4.$]

The empirical cumulative distribution function (ECDF) of $n$ observations from a random variable $T$ is found by sorting the $n$ observations from smallest to largest and then making a jump function with steps of height $1/n$ at each observation. For large enough $n$ the ECDF is nearly the same as the CDF of $T,$ just as the histogram of the observed values indicates the density function of $T.$ (Usually, the ECDF is more precise because some information is lost when data are sorted into bins to make a histogram.)

A simulation of a sample of size $n = 1,000,000$ makes it easy to draw an ECDF of $X$ and a histogram of $X.$ Along the way, we can get approximations of $E(TZ) = 3$ and $Cov(T,Z) = 9/8$ that are accurate to two or three places.

set.seed(724);  m = 10^6
x = runif(m, -3, -1);  y = rexp(m, 1/4);  z = rbinom(m, 1, 3/4)
t[z == 0] = x;  t[z == 1] = y
mean(t*z);  cov(t, z)
## 2.996441              # aprx E(TZ) = 3
## 1.12467               # aprx Cov(T, Z) = 9/8 = 1.125

par(mfrow=c(1,2))
  plot(ecdf(t), main="ECDF: Sampled Values of T")
  hist(t, prob=T, br=50, col="skyblue2", main="Histogram: Sampled Values of T")
par(mfrow=c(1,1))

In the histogram you can see a 'uniform part' of the mixture distribution of $T$ at the left and an 'exponential part' of that distribution towards the right. The two parts can be easily distinguished here because the distributions being 'mixed together' have disjoint supports. Also, notice the interval $(-1,0)$ in the ECDF that contains no probability; the ECDF is level there. [The 'stair steps' of the ECDF are too small to show at the resolution of the graph, giving the impression of a mostly-smooth curve.]

enter image description here

Note: Because $Z$ has a discrete distribution and the other random variables have continuous distributions, it is not easy to make informative plots of joint distributions of $Z$ and one of the other random variables.