3.2.1 - Expected Value and Variance of a Discrete Random Variable

3.2.1 - Expected Value and Variance of a Discrete Random Variable

By continuing with example 3-1, what value should we expect to get?  What would be the average value?  
 
We can answer this question by finding the expected value (or mean).

Expected Value (or mean) of a Discrete Random Variable

For a discrete random variable, the expected value, usually denoted as \(\mu\) or \(E(X)\), is calculated using:

\(\mu=E(X)=\sum x_if(x_i)\)

The formula means that we multiply each value, \(x\), in the support by its respective probability, \(f(x)\), and then add them all together. It can be seen as an average value but weighted by the likelihood of the value.

Example 3-2: Expected Value

In Example 3-1 we were given the following discrete probability distribution:

\(x\) 0 1 2 3 4
\(f(x)\) 1/5 1/5 1/5 1/5 1/5

What is the expected value?

Answer

\begin{align} \mu=E(X)=\sum xf(x)&=0\left(\frac{1}{5}\right)+1\left(\frac{1}{5}\right)+2\left(\frac{1}{5}\right)+3\left(\frac{1}{5}\right)+4\left(\frac{1}{5}\right)\\&=2\end{align}

For this example, the expected value was equal to a possible value of X. This may not always be the case. For example, if we flip a fair coin 9 times, how many heads should we expect? We will explain how to find this later but we should expect 4.5 heads. The expected value in this case is not a valid number of heads.

Now that we can find what value we should expect, (i.e. the expected value), it is also of interest to give a measure of the variability.

Variance of a Discrete Random Variable

The variance of a discrete random variable is given by:

\(\sigma^2=\text{Var}(X)=\sum (x_i-\mu)^2f(x_i)\)

The formula means that we take each value of x, subtract the expected value, square that value and multiply that value by its probability. Then sum all of those values.

There is an easier form of this formula we can use.

\(\sigma^2=\text{Var}(X)=\sum x_i^2f(x_i)-E(X)^2=\sum x_i^2f(x_i)-\mu^2\)

The formula means that first, we sum the square of each value times its probability then subtract the square of the mean. We will use this form of the formula in all of our examples.

Standard Deviation of a Discrete Random Variable

The standard deviation of a random variable, $X$, is the square root of the variance.

\(\sigma=\text{SD}(X)=\sqrt{\text{Var}}(X)=\sqrt{\sigma^2}\)

Example 3-3: Standard Deviation

Consider the first example where we had the values 0, 1, 2, 3, 4. The PMF in tabular form was:

\(x\) 0 1 2 3 4
\(f(x)\) 1/5 1/5 1/5 1/5 1/5

Find the variance and the standard deviation of X.

Answer

\(\text{Var}(X)=\left[0^2\left(\dfrac{1}{5}\right)+1^2\left(\dfrac{1}{5}\right)+2^2\left(\dfrac{1}{5}\right)+3^2\left(\dfrac{1}{5}\right)+4^2\left(\dfrac{1}{5}\right)\right]-2^2=6-4=2\)

\(\text{SD}(X)=\sqrt{2}\approx 1.4142\)

Example 3-4: Prior Convictions

Click on the tab headings to see how to find the expected value, standard deviation, and variance. The last tab is a chance for you to try it.

Barbed wire

 

Let X = number of prior convictions for prisoners at a state prison at which there are 500 prisoners. (\(x = 0,1,2,3,4\))

\(X=x\) 0 1 2 3 4
\(Number\ of\ Prisoners\) 80 265 100 40 15
\(f(x) = P(X=x)\) 80/500 265/500 100/500 40/500 15/500
\(f(x)=P(X=x)\) 0.16 0.53 0.2 0.08 0.03

What is the expected value for number of prior convictions?

\(X=x\) 0 1 2 3 4
\(Number\ of\ Prisoners\) 80 265 100 40 15
\(f(x) = P(X=x)\) 80/500 265/500 100/500 40/500 15/500
\(f(x)=P(X=x)\) 0.16 0.53 0.2 0.08 0.03

Answer

For this we need a weighted average since not all the outcomes have equal chance of happening (i.e. they are not equally weighted). So, we need to find our expected value of \(X\), or mean of \(X\), or \(E(X) = \Sigma f(x_i)(x_i)\). When we write this out it follows:

\(=(0.16)(0)+(0.53)(1)+(0.2)(2)+(0.08)(3)+(0.03)(4)=1.29\)

Stop and think! Does the expected value of 1.29 make sense?

Calculate the variance and the standard deviation for the Prior Convictions example:

\(X=x\) 0 1 2 3 4
\(Number\ of\ Prisoners\) 80 265 100 40 15
\(f(x) = P(X=x)\) 80/500 265/500 100/500 40/500 15/500
\(f(x)=P(X=x)\) 0.16 0.53 0.2 0.08 0.03

Answer

Using the data in our example we find that...

\begin{align} \text{Var}(X) &=[0^2(0.16)+1^2(0.53)+2^2(0.2)+3^2(0.08)+4^2(0.03)]–(1.29)^2\\ &=2.53–1.66\\ &=0.87\\ \text{SD}(X) &=\sqrt(0.87)\\ &=0.93 \end{align}

Note! If variance falls between 0 and 1, the SD will be larger than the variance.

What is the expected number of prior convictions? Below is the probability distribution table for the prior conviction data. Use this table to answer the questions that follow.

\(X=x\) 0 1 2 3 4
\(f(x)=P(X=x)\) 0.16 0.53 0.2 0.08 0.03
a. What is the probability a randomly selected inmate has exactly 2 priors?
\(P(X=2) = 100/500 = 0.2\)
b. What is the probability a randomly selected inmate has < 2 priors?
\(P(X<2)=P(X=0\ or\ 1)=P(X=0)+P(X=1)=0.16+0.53=0.69\)
c. What is the probability a randomly selected inmate has 2 or fewer priors?
\(P(X≤2)=(X=0)+P(X=1)+P(X=2)=0.16+0.53+0.2=0.89\)
d. What is the probability a randomly selected inmate has more than 2 priors?
\(P(X>2)=P(X=3\ or\ 4)=P(X=3)+P(X=4)\ or\ 1−P(X≤2)=0.11\)
e. Finally, which of a, b, c, and d above are complements?
c. and d. are complements

Legend
[1]Link
Has Tooltip/Popover
 Toggleable Visibility