\documentclass[a4paper,12pt]{article}

\begin{document}

\parindent=0pt

\newcommand{\var}{\textrm{var}}

\begin{center}

MA120 INTRODUCTION TO PROBABILITY THEORY AND STATISTICS

EXPECTED VALUES

\end{center}

Suppose $N$ observation of a random variable consist of $n_0$
zeroes, $n_1$ ones, $n_2$ twos,\ldots. Then the sample mean, or
average, $\overline{x}$ can be written as

\begin{eqnarray*}
\overline{x}&=&\frac{0n_0+1n_1+2n_2+\ldots}{N}\\
&=&0\left(\frac{n_0}{N}\right)+1\left(\frac{n_1}{N}\right)+2\left(\frac{n_2}{N}\right)+\ldots\\
&=&0p_0+1p_1+2p_2+\ldots=\sum_xxp_x
\end{eqnarray*}

where $p_x=\frac{n_x}{N}$, the observed proportion of $x$'s.

Now let $N\to\infty$. Then $p_x\top(x)$ for all $x$, so that

$$\overline{x}\longrightarrow_{N\to\infty}\sum_xxp(x).$$

\begin{description}

\item[Example 1]

The number of complaints received by a shop in a day follows the
distribution with the probability function

\begin{center}
\begin{tabular}{ccccccc}
\hline $x$&0&1&2&3&4&5\\
$p(4)$&$\frac{2}{20}$&$\frac{4}{20}$&$\frac{7}{20}$&$\frac{4}{20}$&
$\frac{2}{20}$&$\frac{1}{20}$\\ \hline
\end{tabular}
\end{center}

Hence

$$E(X)=\sum_xxp(x)=0\left(\frac{2}{20}\right)+1\left(\frac{4}{20}\right)
+2\left(\frac{7}{20}\right)+\ldots+5\left(\frac{1}{20}\right)=\frac{43}{20}=2.15.$$

\item[Example 2 - Bernoulli distribution]

Suppose $X$ follows the Bernoulli distribution with probability
function

$$p_X(x)=\left\{\begin{array}{ll}
\pi,&x=1,\\1-\pi,&x-0.\end{array}\right.$$

Then

$$E(X)=1(\pi)+0(1-\pi)=\pi.$$

\item[Example 3 - Binomial distribution]

If $X_1,X_2,\ldots,X_n$ is a sequence of Bernoulli trials and
$Y=X_1+X_2+\ldots X_n$, then $Y$ follows a binomial distribution
with probability function

$$p_Y(y)=\left(\begin{array}{c}n\\y\end{array}\right)\pi^y(1-\pi)^{n-y},\
y=0,1,\ldots,n.$$

Consequently,

\begin{eqnarray*}
E(Y)&=&\sum_{y=0}^ny\left(\begin{array}{c}n\\y\end{array}\right)\pi^y(1-\pi)^{n-y}\\
&=&\sum_{y=1}^ny\left(\begin{array}{c}n\\y\end{array}\right)\pi^y(1-\pi)^{n-y}\\
&=&n\sum_{y=1}^n\left(\begin{array}{c}n-1\\y-1\end{array}\right)\pi^y(1-\pi)^{n-y}\\
&=&n\pi\sum_{y'=0}^{n'}\left(\begin{array}{c}n'\\y'\end{array}\right)\pi^{y'}(1-\pi)^{n'-y'},\textrm{
where $y'=y-1$ and $n'=n-1$},\\ &=&n\pi.
\end{eqnarray*}

\item[Expected value of $h(X)$]
Suppose $X$ is a random variable whose distribution we know but
that we wish to know the expected value of $h(X)$, an arbitrary
function of $X$. It would seem that we need to first to derive the
distribution of $Y=h(X)$ and then find $E(Y)$. However, this is
not necessary. It can be proved that

$$E(Y)=E[h(X)]=\sum_xh(x)p_X(x).$$

As a result of the above, we have

$$E(aX+b)=\sum_x(ax+b)p(x)=a\sum_xxp(x)+b\sum_xp(x)=aE(X)+b,$$

where $a$ and $b$ are constants, and generally

$$E[ah(X)+b]=aE[h(X)]+b\textrm{ and
}E\left[\sum_{i=1}^ka_ih_i(X)\right]=\sum_{i=1}^ka_iE[h_i(X)]$$

for arbitrary functions $h_i(X),i=1,2,\ldots,k$ and constants
$a_i,i=1,2,\ldots,k$.

In example 3, we therefore have $E\left(\frac{Y}{n}\right)=\pi$.

\item[Moments]
Let

$$\mu_r'=E(X^r).$$

Then $\mu_r'$ is called the $r$th \textit{moment} of $X$ (about
the origin). In particular, $\mu_1'=E(X)$ is the mean of $X$ and
is usually denoted by $\mu$. It is the most important measure of
location of a distribution.

Now let

$$\mu_r=E[(X-\mu)^r].$$

Then $\mu_1$ is called the $r$th moment of $X$ about the mean, or
the $r$th \textit{central moment} of $X$. Note that $\mu_1=0$.
When $r=2$, we have

$$\mu_2=E[(X-\mu)^2]=\var(X),$$

the \textit{variance} of $X$, which is often denoted by
$\sigma^2$, and is a measure of spread of a distribution. Further,
$\sigma=\sqrt{\var(X)}=\textrm{sd}(X)$ is called the
\textit{standard deviation} of $X$ and is also a measure of spread
but with the same dimension as $X$ itself.

It is sometimes easier to calculate variance using the relation

$$\var(X)=E[(X-\mu)^2]=E(X^2)-\mu^2.$$

For some distributions, however, the easiest second moment to
calculate is $S[X(X-1)]$ (known as the second factorial moment),
from which we may obtain

$$\var(X)=E[X(X-1)]+\mu-\mu^2.$$

\item[Example 1]
For the number of complaints received by the shop,

$$E(X^2)=0^2\left(\frac{2}{20}\right)+1^2\left(\frac{4}{20}\right)+
2^2\left(\frac{7}{20}\right)+\ldots+5^2
\left(\frac{1}{20}\right)=\frac{125}{20}=\frac{25}{4}$$

so that

$$\var(X)=\frac{25}{4}-\left(\frac{43}{20}\right)^2=\frac{651}{400}=1.6275\textrm{
and }$$

$$\textrm{sd}(X)=\sqrt{1.6275}=1.276$$

\item[Example 3]
Here $Y\sim b(n,\pi)$ so that
\begin{eqnarray*}
E[Y(Y-1)]&=&\sum_{y=0}^ny(y-1)\left(\begin{array}{c}n\\y\end{array}\right)\pi^y(1-\pi)^{n-y}\\
&=&n(n-1)\sum_{y=2}^n\left(\begin{array}{c}n-2\\y-2\end{array}\right)\pi^y(1-\pi)^{n-y}=n(n-1)\pi^2.
\end{eqnarray*}

Hence

$$\var(Y)=n(n-1)\pi^2+n\pi-(n\pi)^2=n\pi(1-\pi).$$

\item[Example 2]
When in example 3, we have

$$\var(X)=\pi(1-\pi)$$

for the Bernoulli distribution.

Note that, in general,

\begin{eqnarray*}
\var(aX+b)&=&E\{(aX+b)-[aE(X)+b]\}^2\\
&=&E\{a[X-E(X)]\}^2=a^2\var(X).
\end{eqnarray*}

So, in example 3,
$\var\left(\frac{Y}{n}\right)=\left(\frac{1}{n}\right)\var(Y)=\frac{\pi(1-\pi)}{n}.$

\item[Higher moments]
The third central moment of $X,\ \mu_3=E[(X-\mu)^3]$, or its
standardised form $\displaystyle\frac{\mu_3}{\mu_2^\frac{3}{2}}$,
is often considered to give a measure of skewness of a
distribution. A symmetric distribution has $\mu_3=0$. If
$\mu_3>0$, the distribution is said to be positively skewed and,
if $\mu_3<0$, negatively skewed. Note however that, for a
distribution to be symmetric, it is necessary for all its odd
central moments to be zero.

The fourth central moments of $X,\ \mu_4=E[(X-\mu)^4]$, or its
standardised form $\displaystyle\frac{\mu_4}{\mu_2^2}$, is
sometimes considered to give a measure of \textit{kurtosis} (from
the Greek for Bulging) or peakedness of a distribution. The
standard, or normal, value is taken to be 3.

\end{description}

\end{document}
