# Statistics

To calculate the arithmetic mean, just simply add everything then divide by the number of elements: Example: the average of {5, 6, 7, 7, 9} is To calculate the median, first sort all the population from smallest to biggest, then pick the value separating the lower half from the higher half (so the middle one), if the population consist of an even number of elements, average the 2 middle ones.
Example: the median of {5, 6, 7, 7, 9} is 7. The median of {3, 4, 7, 9, 9, 10} is 8, because the average of {7, 9} is 8.

The interquartile range (IQR) describes the difference between the 75th and the 25th percentiles. The best way to find the IQR is to split the data in the middle into 2 sides (if you have an odd population ignore the most middle element), one is the lower half and one is the upper half, now find the median of both sides, the IQR is the difference between the upper median and the lower median.
Example: The IQR of {5, 6, 7, 7, 9} is the median of {7, 9} minus the median of {5, 6} which is 8-5.5=2.5.

The mode of a population is simply the most frequent element.
Example: The mode of {5, 6, 7, 7, 9} is 7.

If you want to calculate the standard deviation, first calculate the mean, then go over every element and add the difference between the elements and the mean squared, then divide that number by the number of elements minus 1, then square root that number. Example: To calculate the standard deviation of {5, 6, 7, 7, 10}, first calculate the mean: then add the difference between the elements and the average squared: Now divide by N-1: and finally square root the number: For a normal distribution: Contains 68.27% of population Contains 95.45% of population Contains 99.73% of population