# Mean

### Integrating survival function to calculate the mean

Posted on Updated on

For a continuous random variable $X$ that are non-negative in values, the mean $E(X)$ is obtained by integrating $x f(x)$ from $0$ to $\infty$ where $f(x)$ is the probability density function of $X$. In some cases, this integral is hard (or impossible) to do. In these cases, it may be possible to find the mean and higher moments by integrating the survival functions.

Here’s the usual way to calculate moments. $\displaystyle (1) \ \ \ \ E(X)=\int_0^\infty x f(x) \ dx$ $\text{ }$ $\displaystyle (2) \ \ \ \ E(X^k)=\int_0^\infty x^k f(x) \ dx$

Moments can be calculated by integrating the survival function. $\displaystyle (3) \ \ \ \ E(X)=\int_0^\infty S(x) \ dx$ $\text{ }$ $\displaystyle (4) \ \ \ \ E(X^k)=\int_0^\infty k x^{k-1} S(x) \ dx$

In fact, the mean and moments of many of the distributions in the Exam C table are calculated using the survival function method, e.g. the Pareto distribution and the exponential distribution.

The integrals in (3) and (4) are derived from (1) and (2) by performing integration by parts. The derivation is not very hard. You will find out that some assumptions are needed to make the integration by parts work. Specifically, the assumption is that the following limit is 0. $\displaystyle \lim_{x \rightarrow \infty} x^k \ S(x)= 0$

The integrals in (3) and (4) works only if this limit converges to zero. Essentially this limit is zero if the expectation $E(X^k)$ exists.

The same idea can be applied to a discrete distribution. $\displaystyle (5) \ \ \ \ E(X)=\sum_{x=0}^\infty x P(X=x)$ $\text{ }$ $\displaystyle (6) \ \ \ \ E(X^k)=\sum_{x=0}^\infty x^k P(X=x)$ $\displaystyle (7) \ \ \ \ E(X)=\sum_{x=0}^\infty P(X>x)$ $\text{ }$ $\displaystyle (8) \ \ \ \ E(X^k)=\sum_{x=0}^\infty [(x+1)^k-x^k] P(X>x)$ $\text{ }$ $\text{ }$

Examples

Example 1
Suppose that the useful life (in months) of a device is modeled by the CDF $F(x)=1-(1- x/120)^{1/2}$ for $0 \le x \le 120$. Calculated the expected useful of a brand new device. Calculate the variance of the lifetime of such a device.

Note that the survival function is $S(x)=(1- x/120)^{1/2}$. The following shows the calculation. $\displaystyle E(X)=\int_0^{120} (1- x/120)^{1/2} \ dx=80$ \displaystyle \begin{aligned} E(X^2)&=\int_0^{120} 2x \ (1- x/120)^{1/2} \ dx \\&=\int_1^{0} 2 \cdot 120(1-U) \ U^{1/2} (-120) \ dU \\&=\int_0^{1} 28800 \ (U^{1/2}-U^{3/2}) \ dU \\&=28800 \ \biggl[\frac{2}{3} U^{3/2}-\frac{2}{5} U^{5/2} \biggr]_0^1 \\&=7680 \end{aligned} $Var(X)=E(X^2)-E(X)^2=7680-80^2=1280$

Note that the integral for $E(X^2)$ uses the method of substitution.

Example 2
Suppose that the lifetime of a machine follows a distribution with the following CDF. $\displaystyle F(x)=1+e^{-x/6}-2 e^{-x/12} \ \ \ \ \ x>0$

Calculate the mean and variance of the lifetime.

The survival function is $\displaystyle S(x)=2 e^{-x/12}-e^{-x/6}$. The first is to calculate the first 2 moments. \displaystyle \begin{aligned} E(X)&=\int_0^\infty (2 e^{-x/12}-e^{-x/6}) \ dx \\&=\int_0^\infty (2 \cdot 12 \frac{1}{12} e^{-x/12}-6 \ \frac{1}{6} e^{-x/6}) \ dx \\&=24 \int_0^\infty \frac{1}{12} e^{-x/12} \ dx- 6 \int_0^\infty \frac{1}{6} e^{-x/6} \ dx=24-6=18 \end{aligned} \displaystyle \begin{aligned} E(X^2)&=\int_0^\infty 2x (2 e^{-x/12}-e^{-x/6}) \ dx \\&=\int_0^\infty (4x e^{-x/12}-2x e^{-x/6}) \ dx \\&=\int_0^\infty (4 \cdot 12 \ x \frac{1}{12} e^{-x/12}-2 \cdot 6 \ x \ \frac{1}{6} e^{-x/6}) \ dx \\&=48 \int_0^\infty x \frac{1}{12} e^{-x/12} \ dx -12 \int_0^\infty x \ \frac{1}{6} e^{-x/6} \ dx=48(12)-12(6)=504 \end{aligned} $Var(X)=E(X^2)-E(X)^2=504-18^2=180$

Note that the integral for $E(X)$ is manipulated to be in terms of integrals of exponential density functions while the integral for $E(X^2)$ is manipulated to be in terms of integrals of $x$ times exponential density functions (each becoming the mean of that exponential distribution).

Example 3
The two-parameter Pareto distribution (Type II Lomax) is discussed in here in a companion blog. Its survival function is $\displaystyle S(x)=\biggl(\frac{\theta}{x+\theta} \biggr)^\alpha \ \ \ \ \ x>0$

Derive the mean of the Pareto distribution using the survival function approach. What assumption is made on the shape parameter $\alpha$? \displaystyle \begin{aligned} E(X)&=\int_0^\infty \biggl(\frac{\theta}{x+\theta} \biggr)^\alpha \ dx \\&=\int_0^\infty \theta^\alpha (x+\theta)^{- \alpha} \ dx \\&=\frac{\theta^\alpha}{-\alpha+1} \ (x+\theta)^{-\alpha+1} \biggr|_0^\infty \\&=\frac{\theta^\alpha}{-\alpha+1} \ \frac{1}{(x+\theta)^{\alpha-1}} \biggr|_0^\infty =\frac{\theta}{\alpha-1} \end{aligned}

In order for the integral to converge, we need to assume $\alpha>1$.

The next two examples are left as exercises.

Practice Problems

Practice Problem 1
The survival function for the distribution of a lifetime of a type of electronic devices is $\displaystyle S(x)=\frac{1}{40} \ e^{-x/10}+\frac{1}{20} \ e^{-x/15} \ \ \ \ \ x>0$.

Calculate the mean and variance of the lifetime of such devices.

Practice Problem 2
The probability that the size of a randomly selected auto collision loss is greater than $x$ is $\displaystyle S(x)=\biggl(1-\frac{x}{10} \biggr)^6 \ \ \ \ 0.

Calculate the mean and variance of the loss size. $\text{ }$ $\text{ }$ $\text{ }$ $\text{ }$ $\text{ }$ $\text{ }$

Practice Problem 1 $\displaystyle E(X)=1$ $\displaystyle Var(X)=\frac{53}{2}=26.5$

Practice Problem 2 $\displaystyle E(X)=\frac{10}{7}$ $\displaystyle Var(X)=\frac{75}{49}$ $\text{ }$ $\text{ }$ $\text{ }$ $\copyright$ 2017 – Dan Ma