# Moments

The **mean** is an another name for the average. You can think of the mean as a typical representative value of all the observations in a set. The **standard deviation** is a measure of the “spread” of the data. For example, if in a set of observations, the data was not concentrated around the mean, then that dataset would have a high standard deviation. If all the data, was concentrated around some single value, then that dataset would have a low standard deviation. The standard deviation squared is the variance. Another name for these measurements are **moments**.

The following are formal methods of computing the sample mean and sample variance, respectively

\[\bar{x}=\frac{x_1\,+\,x_2\,+\,\cdot\cdot\cdot\,+x_n}{n} \\ s^2=\displaystyle \frac{1}{n-1} \sum_{i=0}^n(x_i\,-\,\bar{x})^2\]It should be noted that these calculutions are for a sample. If the entire population is used to compute these values then these equations would look like this:

$$\mu=\frac{x_1\,+\,x_2\,+\,\cdot\cdot\cdot\,+x_N}{N} \\ \sigma^2=\displaystyle \frac{1}{N} \sum_{i=0}^N (x_i\,-\,\mu)^2$$

Note that the greek letters have replaced the symbols for sample mean and sample variance; the population size, $N$ has replaced the sample size, $n$ to symbolize we are talking about population parameters. We do not subtract unity because we are no longer estimating.

Use the R summary widget to compute the first moment for sample datasets. A standard deviation widget is used to compute the second moment.