### Explain and calculate expected value, mode, median, percentile and higher moments

The expected value of a discrete random variable is the sum of all the values the variable can take times the probability of that value occurring as in the formula shown below:

$$E\left( X \right) =\sum { xp\left( x \right) }$$

Example

Given the experiment of rolling a single die, calculate the expected value.

$$E\left(X \right) = 1\ast ({1}/{6})+2\ast ({1}/{6})+3\ast ({1}/{6})+4\ast ({1}/{6})+5\ast ({1}/{6})+6\ast ({1}/{6}) = 3.5$$

The expected value of a continuous random variable is shown in the formula below:

$$E\left( X \right) =\int _{ -\infty }^{ \infty }{ xf\left( x \right)dx }$$

Where $$f(x)$$ is the probability density function of $$x$$.

Example

Given the following probability density function of a continuous random variable:

$$f\left( x \right) =\begin{cases} \cfrac { x }{ 2 } , & 0< x < 2 \\ 0, & otherwise \end{cases}$$

Calculate $$E(X)$$.

$$E\left( X \right) =\int _{ -\infty }^{ \infty }{ xf\left( x \right) dx } =\int _{ 0 }^{ 2 }{ x\ast \frac { x }{ 2 } \ast dx={ \left[ \frac { { x }^{ 3 } }{ 6 } \right] }_{ x=0 }^{ x=2 }=\frac { 8 }{ 6 } =\frac { 4 }{ 3 } }$$

The mode of a discrete random variable is the value that is most likely to occur.

Example

Given the experiment of rolling two dice simultaneously, what is the mode of the probability distribution of the sum of the two dice.

As shown in the table below, the most likely value is 7 with a probability of {6/36 so the mode = 7.

$$\begin{array}{|c|c|} \hline {\bf x} & {\bf p(x)} \\ \hline 2 & {1}/{36} \\ \hline 3 & {2}/{36} \\ \hline 4 & {3}/{36} \\ \hline 5 & {4}/{36} \\ \hline 6 & {5}/{36} \\ \hline 7 & {6}/{36} \\ \hline 8 & {5}/{36} \\ \hline 9 & {4}/{36} \\ \hline 10 & {3}/{36} \\ \hline 11 & {2}/{36} \\ \hline 12 & {1}/{36} \\ \hline \end{array}$$

The mode of a continuous random variable is the value at which the probability density function, $$f(x)$$, is at a maximum.

Example

Given the following probability density function of a continuous random variable, find the mode of the distribution.
$$f\left( x \right) =\begin{cases} -{ x }^{ 2 }+2x-\cfrac { 1 }{ 6 } , & 0 < x < 2 \\ 0, & otherwise \end{cases}$$
To find the maximum of $$f(x)$$, find the first derivative and set that value equal to zero as shown below:

$${f}^{‘} (x)= -2x+2=0$$

Then solve for $$x$$.

$$-2x = -2$$

$$x = 1$$

So, the mode of the distribution is 1.

The median of a discrete distribution is the value of $$X$$ for which $$P(X ≤ x)$$ is greater than or equal to 0.5 and $$P(X ≥ x)$$ is greater than or equal to 0.5.

Example

Given the following probability density function of a discrete random variable, calculate the median of the distribution:
$$f\left( x \right) =\begin{cases} .2, & x=1,4 \\ .3, & x=3,4 \end{cases}$$

The median of the distribution above is 2 because

$$P(X ≤ 2) = P(X=1)+P(X=2) = .2+.3 = .5$$

and,

$$P(X ≥ 2) = P(X=2)+P(X=3)+P(X=4) = .3+.3+.2 = .8.$$

The median of a continuous distribution can be defined by the value $$c$$ in the formula shown below:

$$\int _{ -\infty }^{ c }{ f\left( x \right)dx=.5 }$$

That is, it is the value for which the area under the curve from negative infinity to $$c$$ is equal to .50. The median is also referred to as the 50th percentile.

Example

Given the following probability density function of a continuous random variable, find the median of the distribution.

\begin{align*} f\left( x \right) & =\begin{cases} -{ x }^{ 2 }+2x-\cfrac { 1 }{ 6 } , & 0 < x < 2 \\ 0, & otherwise \end{cases} \\ & \int _{ 0 }^{ c }{ \left( -{ x }^{ 2 }+2x-\cfrac { 1 }{ 6 } \right) dx=.5 } \\ & { \left[ -\frac { { x }^{ 3 } }{ 3 } +{ x }^{ 2 }-\frac { 1 }{ 6 } x \right] }_{ x=0 }^{ x=c }=.5 \\ & -\frac { { c }^{ 3 } }{ 3 } +{ c }^{ 2 }-\frac { 1 }{ 6 } \ast c=.5 \\ & C=1 \\ \end{align*}

In general, the pth percentile of a discrete distribution is the value of $$x$$ for which $$P(X ≤ x)$$ is greater than or equal to $${p}/{100}$$ and $$P(X ≥ x)$$ is greater than or equal to $$1-{p}/{100}$$.

Example

Given the following probability density function of a discrete random variable, calculate the 75th percentile of the distribution:

$$f\left( x \right) =\begin{cases} .2, & x=1,4 \\ .3, & x=3,4 \end{cases}$$

$$P \left(X ≤ x \right)=.75$$

$$P \left(X ≤ 3 \right) = P \left(X=1 \right) + P \left(X=2 \right) + P \left(X=3 \right) = .2 + .3 + .2 = .7 < .75$$

$$P \left(X ≤ 4 \right) = P \left(X=1 \right) + P \left(X=2 \right) + P \left(X=3 \right) + P \left(X=4 \right) = .2 + .3 + .2 + .3 = 1.0 > .75$$

$$P \left(X ≥ 4 \right) = P \left(X=4 \right) = .2 < .25 = 1-\left({75}/{100} \right)$$

So, the 75th percentile of the distribution is 4.

In general, the pth percentile of a continuous distribution can be defined as the value of $$c$$ for which,

$$\int _{ -\infty }^{ c }{ f\left( x \right)dx={ p }/{ 100 } }$$

Example

Given the following probability density function of a continuous random variable, find the 25th percentile:

\begin{align*} f\left( x \right) & =\begin{cases} -{ x }^{ 2 }+2x-\cfrac { 1 }{ 6 } , & 0 < x < 2 \\ 0, & otherwise \end{cases} \\ & \int _{ 0 }^{ c }{ \left( -{ x }^{ 2 }+2x-\cfrac { 1 }{ 6 } \right) dx={\frac {25}{100}}=.25 } \\ & \int _{ 0 }^{ c }{ \left( -{ x }^{ 2 }+2x-\cfrac { 1 }{ 6 } \right) dx=.25 } \\ & { \left[ -\frac { { x }^{ 3 } }{ 3 } +{ x }^{ 2 }-\frac { 1 }{ 6 } x \right] }_{ x=0 }^{ x=c }=.25 \\ & -\frac { { c }^{ 3 } }{ 3 } +{ c }^{ 2 }-\frac { 1 }{ 6 } \ast c=.25 \\ & C=.69 \\ \end{align*}

Learning Outcome

Topic 2.c: Univariate Random Variables – Explain and calculate expected value, mode, median, percentile and higher moments.