Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Statistics - Mean


The mean is a type of average value, which describes where center of the data is located.


Mean

The mean is usually referred to as 'the average'.

The mean is the sum of all the values in the data divided by the total number of values in the data.

The mean is calculated for numerical variables. A variable is something in the data that can vary, like:

  • Age
  • Height
  • Income

Note: There are are multiple types of mean values. The most common type of mean is the arithmetic mean.

In this tutorial 'mean' refers to the arithmetic mean.


Calculating the Mean

You can calculate the mean for both the population and the sample.

The formulas are the same and uses different symbols to refer to the population mean (\(\mu\)) and sample mean (\(\bar{x}\)).

Calculating the population mean (\(\mu\)) is done with this formula:

\(\displaystyle \mu = \frac{\sum x_{i}}{n}\)

Calculating the sample mean (\(\bar{x}\)) is done with this formula:

\(\displaystyle \bar{x} = \frac{\sum x_{i}}{n}\)

The bottom part of the fraction (\(n\)) is the total number of observations.

\(\sum \) is the symbol for adding together a list of numbers.

\(x_{i}\) is the list of values in the data: \(x_{1}, x_{2}, x_{3}, \ldots \)

The top part of the fraction (\(\sum x_{i}\)) is the sum of \(x_{1}, x_{2}, x_{3}, \ldots \) added together.

So, if a sample has 4 observations with values: 4, 11, 7, 14 the calculation is:

\(\displaystyle \bar{x} = \frac{4 + 11 + 7 + 14}{4} = \frac{36}{4} = \underline{9} \)



Calculation with Programming

The mean can easily be calculated with many programming languages.

Using software and programming to calculate statistics is more common for bigger sets of data, as calculating by hand becomes difficult.

Example

With Python use the NumPy library mean() method to find the mean of the values 4,11,7,14:

import numpy

values = [4,11,7,14]

x = numpy.mean(values)

print(x)
Try it Yourself »

Example

Use the R mean() function to find the mean of the values 4,11,7,14:

values <- c(4,7,11,14)

mean(values)
Try it Yourself »

Statistics Symbol Reference

Symbol Description
\( \mu \) The population mean. Pronounced 'mu'.
\( \bar{x} \) The sample mean. Pronounced 'x-bar'.
\( \sum \) The summation operator, 'capital sigma'.
\( x \) The variable 'x' we are calculating the average for.
\( i \) The index 'i' of the variable 'x'. This identifies each observation for a variable.
\( n \) The number of observations.