2.8 – Expected Value, Variance, Standard Deviation

Previous: 2.7 – A Geometric Problem

Next: 2.9 – Example



Analogous to the discrete case, we can define the expected value, variance, and standard deviation of a continuous random variable. These quantities have the same interpretation as in the discrete setting. The expectation of a random variable is a measure of the centre of the distribution, its mean value. The variance and standard deviation are measures of the horizontal spread or dispersion of the random variable.

Definition: Expected Value, Variance, and Standard Deviation of a Continuous Random Variable
The expected value of a continuous random variable X, with probability density function f(x), is the number given by

\mathbb{E}(X) = \int_{-\infty}^{\infty} x f(x) dx

The variance of X is:

\text{Var}(X) = \int_{-\infty}^{\infty} \big(x - \mathbb{E}(X)\big)^2 f(x) dx

As in the discrete case, the standard deviation, σ, is the positive square root of the variance:

\sigma(X) = \sqrt{\text{Var}(X)}

Animation

The following animation encapsulates the concepts of the CDF, PDF, expected value, and standard deviation of a normal random variable. When viewing the animation, it may help to remember that

  • the "mean" is another term for expected value
  • the standard deviation is equal to the positive square root of the variance
  • the CDF (lower plot) is an antiderivative of the PDF (upper plot)

Connecting the CDF and the PDF (requires the Wolfram "CDF Player")

Simple Example

The random variable X is given by the following PDF. Check that this is a valid PDF and calculate the standard deviation of X.

f(x) = \begin{cases}<br />
2 (1 - x) & \text{if } 0 \le x \le 1,\\<br />
0 & \text{otherwise}<br />
\end{cases}<br />

Solution

Part 1

To verify that f(x) is a valid PDF, we must check that it is everywhere nonnegative and that it integrates to 1.

We see that 2(1-x) = 2 - 2x ≥ 0 precisely when x ≤ 1; thus f(x) is everywhere nonnegative.

To check that f(x) has unit area under its graph, we calculate

\begin{align}<br />
\int_{-\infty}^{\infty} f(x) dx = 2 \int_{0}^{1} (1 - x) dx =2 \Big( x - \frac{x^2}{2} \Big) \Big|_0^1=1<br />
\end{align}

So f(x) is indeed a valid PDF.

Part 2

To calculate the standard deviation of X, we must first find its variance. Calculating the variance of X requires its expected value:

\begin{align}<br />
\mathbb{E}(X) &= \int_{-\infty}^{\infty} x f(x) dx \\<br />
&= \int_{0}^{1} x \Big[ 2 (1 - x) \Big] dx \\<br />
&= 2 \int_{0}^{1} \Big( x - x^2 \Big) dx \\<br />
&= 2 \Big( \frac{x^2}{2} - \frac{x^3}{3} \Big) \Big|_0^1 \\<br />
&= 1/3<br />
\end{align}

Using this value, we compute the variance of X as follows

\begin{align}<br />
\text{Var}(X) &= \int_{-\infty}^{\infty} \big(x - \mathbb{E}(X)\big)^2 f(x) dx \\<br />
&= \int_0^1 \big( x - 1/3\big)^2\cdot 2(1-x) dx \\<br />
&= 2 \int_0^1\big( x^2 -\frac{2}{3} x + \frac{1}{9} \big) (1-x) dx \\<br />
&= 2 \int_0^1\big( -x^3 + \frac{5}{3}x^2 -\frac{7}{9} x +\frac{1}{9} \big) dx \\<br />
&= 2 \big( -\frac{1}{4}x^4 + \frac{5}{9}x^3 -\frac{7}{18} x^2 +\frac{1}{9}x \big)\Big|_0^1 \\<br />
&= 2 \big( -\frac{1}{4} + \frac{5}{9} -\frac{7}{18} +\frac{1}{9} \big)  \\<br />
&= \frac{1}{18}<br />
\end{align}

Therefore, the standard deviation of X is

\begin{align}<br />
\sigma &= \sqrt{\text{Var}(X)}\\<br />
&= \frac 1{3\sqrt{2}}<br />
\end{align}

An Alternative Formula for Variance

There is an alternative formula for the variance of a random variable that is less tedious than the above definition.

Alternate Formula for the Variance of a Continuous Random Variable
The variance of a continuous random variable X with PDF f(x) is the number given by

\begin{align}<br />
\text{Var}(X) &= \mathbb{E}(X^2) - [\mathbb{E}(X)]^2<br />
\end{align}

The derivation of this formula is a simple exercise and has been relegated to the exercises. We should note that a completely analogous formula holds for the variance of a discrete random variable, with the integral signs replaced by sums.

Simple Example Revisited

We can use this alternate formula for variance to find the standard deviation of the random variable X defined above.

Remembering that E(X) was found to be 1/3, we compute the variance of X as follows:

\begin{align}<br />
\text{Var}(X) &= \mathbb{E}(X^2) - [\mathbb{E}(X)]^2\\<br />
&= \int_{-\infty}^{\infty}  x^2 f(x) dx - \left(\frac 13\right)^2 \\<br />
&= 2 \int_0^1 x^2 (1-x) dx  - \frac{1}{9}\\<br />
&= 2 \int_0^1\big( x^2 - x^3 \big) dx- \frac{1}{9} \\<br />
&= 2 \big( \frac{1}{3}x^3 - \frac{1}{4}x^4 \big) \big|_0^1 - \frac{1}{9} \\<br />
&= 2 \big( \frac{1}{3}  - \frac{1}{4} \big) - \frac{1}{9} \\<br />
&= \frac{1}{18}<br />
\end{align}

In the exercises, you will compute the expectations, variances and standard deviations of many of the random variables we have introduced in this chapter, as well as those of many new ones.


source: http://wiki.ubc.ca/Science:MATH105_Probability/Lesson_2_CRV/2.10_Expected_Value,_Variance,_Standard_Deviation

Previous: 2.7 – A Geometric Problem

Next: 2.9 – Example