How can I compute the conditional expectation C-X in the following formula


where C is a constant and X a random variable following exponential distribution?

  • $\begingroup$ Have you tried writing the expression as an integral and solving that? $\endgroup$
    – Björn
    Mar 4 '19 at 20:23

Suppose that $X \sim \mathcal{E}(\lambda)$, then we have

\begin{align*} \mathbb{E}[C-X \mid X < C] &= \frac{\mathbb{E}[ (C-X)I_{X<C}]}{P(X<C)} \\ &= \frac{CP(X<C) - \mathbb{E}[XI_{X<C}]}{P(X<C)} \\ &= C - \frac{\mathbb{E}[XI_{X<C}]}{1- e^{-\lambda C}} \end{align*}

Where $I_{\cdot}$ is the indicator function.

Now we need to solve the expectation which is basic integration

\begin{align*} \mathbb{E}[XI_{X<C}] &= \int_0^C \lambda x e^{-\lambda x} dx \\ &= \frac{1}{\lambda} - e^{-\lambda C}(C + \frac{1}{\lambda} ) \end{align*}

Thus we finally have

$$ \mathbb{E}[C-X \mid X < C] = C + \frac{ e^{-\lambda C}(C + \frac{1}{\lambda} ) - \frac{1}{\lambda}}{1 - e^{-\lambda C}} $$

Here is a little R code to check if it works with $\lambda = 0.01$ and $C=45$

Y<-X[X<Ck]   ## Select only the values of X < Ck
mean(Ck-Y)   ## empirical expectation 
Ck + (Ck*exp(-0.01*Ck) + (exp(-0.01*Ck)-1)/0.01)/(1-exp(-0.01*Ck)) 

More generally when you have an conditional expectation of the type

$$ \mathbb{E}[X \mid A] $$

you can use the relation

$$ \mathbb{E}[X \mid A] = \frac{\mathbb{E}[X I_A]}{P(A)} $$

  • $\begingroup$ Thank you @winperikle. I had done the sam job but my result is a bit different. In your last equation, in the numerator, it should be $\e^{-\lambda.C}$ (C+1/$\lambda$) I guess, no ? My solution differs from there $\endgroup$
    – Angelıque
    Mar 6 '19 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.