Statistics Mean
The mean is the arithmetic average of a dataset, calculated by summing every value and dividing by how many values there are.
What Is the Mean?
The mean, often just called the 'average,' answers the question: if every value in the dataset were replaced by the same number, what would that number have to be so the total stays the same? The formula is simple: add up all the values, then divide by the count of values.
Calculating the Mean by Hand
Suppose six students score 62, 74, 74, 81, 88, and 95 on a quiz. To find the mean, add the scores together: 62 + 74 + 74 + 81 + 88 + 95 = 474. Then divide by the number of students, which is 6: 474 / 6 = 79. The mean quiz score is 79.
Example
scores = [62, 74, 74, 81, 88, 95]
total = 0
for score in scores:
total += score
mean = total / len(scores)
print("Sum:", total)
print("Count:", len(scores))
print("Mean:", mean)
# Sum: 474
# Count: 6
# Mean: 79.0Example
import statistics
scores = [62, 74, 74, 81, 88, 95]
print("Mean:", statistics.mean(scores))
# Mean: 79
scores_with_outlier = [62, 74, 74, 81, 88, 95, 20]
print("Mean with outlier:", statistics.mean(scores_with_outlier))
# Mean with outlier: 70.57142857142857The Mean Is Sensitive to Outliers
Now suppose a seventh student missed most of the quiz and scored only 20. Adding that single low score changes the sum to 494 and the count to 7, giving a mean of about 70.6 - nearly nine points lower than before, even though five of the six original students still scored in the 70s, 80s, or 90s.
When to Use the Mean
- Use the mean when your data is roughly symmetric and does not contain extreme outliers.
- The mean uses every single value in its calculation, which makes it a very informative summary when the data is well-behaved.
- The mean is the foundation for many further statistical techniques, including variance, standard deviation, and hypothesis tests.
- When data is skewed or has outliers (like house prices or income), consider reporting the median alongside or instead of the mean.