Random Variable – How to Calculate the Expectation of a Function of a Random Variable from CDF

expected valuerandom variable

Is it possible to calculate the expectation of a function of a random variable with only the the r.v.'s CDF? Say I have a function $g(x)$ that has the property $\int_{-\infty}^{\infty}g(x)dx \leq \infty $ and the only information I have about the random variable is the CDF.

For example, I have a scenario where there are three timers that can be modeled as exponential random variables $X_1,X_2,X_3$ with rate parameters $\lambda_1,\lambda_2,\lambda_3$ respectively. For each moment in time I earn a reward according to some reward function $g(x)$. That is, my reward for waiting until time $t$ can be written as $\int_0^tg(x)dx$. However, $g(x)$ experiences diminishing returns so the the marginal reward received from waiting one second at $t=0$ is greater than one second at say $t=27$. This 'game' ends when one of two things happens. Either both timers $X_1$ or $X_2$ must ring or timers $X_1$ or $X_3$ must ring. I'm trying to find the expected reward of playing this game.

Currently I can calculate the the CDF of the random variable modeling the time until the game ends, but I dont know how to use this information to when what I really need is reward associated with this time.

So far I have the additional random variables:
$$ W_{12}=\max(X_1,X_2) \quad W_{13}=\max(X_1,X_3) \quad Z=\min(W_{12},W_{13})$$
Also let $F_i(x), i\in \{1,2,3\}$ denote the CDF of $X_i$
The CDF of $Z$, can be written as:
$$F_Z(t) = F_1(t)F_2(t) + F_1(t)F_3(t) – F_1(t)F_2(t)F_3(t)$$

I know when a random variable takes on non-negative values, you can use a shortcut to calculate the expectation using the CDF. That is, $E[X] = \int_0^\infty F(X\geq x)dx$. Is there something similar I could use for a function of a random variable, or is it necessary to compute the pdf of $Z$ first to compute $\int_0^\infty g(t)f_z(t)dx$

Best Answer

When $F$ is the CDF of a random variable $X$ and $g$ is a (measurable) function, the expectation of $g(X)$ can be found as a Riemann-Stieltjes integral

$$\mathbb{E}(g(X)) = \int_{-\infty}^\infty g(x) dF(x).$$

This expresses the Law of the Unconscious Statistician.

If $g$ is also differentiable, write $dF = -d(1-F)$ and integrate by parts to give

$$\mathbb{E}(g(X)) = -g(x)(1-F(x)){\big|}_{-\infty}^\infty + \int_{-\infty}^\infty (1-F(x)) g^\prime(x)\, \text{d}x$$

provided both addends converge. This means several things, which may be simply expressed by breaking the integral at some definite finite value such as $0$:

  1. ${\lim}_{x\to -\infty} g(x)(1-F(x))$ and ${\lim}_{x\to \infty} g(x)(1-F(x))$ exist and are finite. If so, the first addend is the difference of these two.

  2. $\lim_{t\to -\infty} \int_t^0 (1-F(x))g^\prime(x)\,\text{d}x$ and $\lim_{t\to \infty} \int_0^t (1-F(x))g^\prime(x)\,\text{d}x$ exist and are finite. If so, the second addend is the sum of these two.

A good place to break the integral is at any zero of $g$, because--provided $g$ eventually decreases fast enough for large $|x|$--that causes the first addend to vanish, leaving only the integral of $g^\prime$ against the survival function $1-F$.

Example

The expectation of a non-negative variable $X$ is obtained by applying the formula to the identity function $g(x)=x$ for which $g^\prime(x)=1$ and utilizing the fact that the integration may begin at zero:

$$\mathbb{E}(X) = -x(1-F(x))\big|_{0}^\infty + \int_{0}^\infty (1-F(x))\,\text{d}x.$$

Provided $\lim_{x\to\infty} x (1-F(x)) = 0$ (that is, the survival function does not have an overly heavy tail), the upper limit of the first term vanishes. Its lower limit obviously vanishes. We are left only with the integral, giving the expression in the question.