Understanding Mean, Median and Mode: Measures of Central Tendency

When analyzing a dataset, one of the first things you‘ll want to understand is its central tendency – in other words, what is a "typical" or average value that represents the center of the data distribution. The three most common measures of central tendency are the mean, median, and mode.

While they all aim to identify the central or most representative value in a dataset, these measures are calculated differently and can give quite different results, especially for skewed distributions. Understanding the distinctions between the mean, median and mode, and when it‘s most appropriate to use each one, is a fundamental skill in statistics and data analysis.

In this article, we‘ll take an in-depth look at these three measures of central tendency, with explanations and examples of how to calculate each one, their key characteristics, and the types of data and distributions each is suited for. We‘ll also explore some related concepts like weighted means and trimmed means. Finally, we‘ll walk through some examples in Python to demonstrate calculating the mean, median and mode programmatically.

What Is Central Tendency?

Before diving into the specific measures, let‘s start by defining what we mean by central tendency. Essentially, a measure of central tendency aims to summarize a dataset by identifying a single, most representative or "average" value at the center of the data distribution.

Measures of central tendency give us a sense of a dataset‘s typical or middle values around which the rest of the data points tend to cluster or gravitate. They help us get an overview of a dataset and understand where most of the values lie, even without looking at the full data.

Central tendency is usually reported along with a measure of variability or dispersion (like standard deviation or variance), which describes how far away or spread out data points tend to be from the central value. Together, measures of central tendency and variability give a quick snapshot of both the center and spread of a distribution.

The Mean

The mean, or average, is likely the measure of central tendency that you‘re most familiar with. To calculate the mean, you simply add up all the values in a dataset and then divide by the total number of values. In mathematical terms, if we have a dataset with n values x1, x2, …, xn, then the mean is:

mean = (x1 + x2 + … + xn) / n

For example, let‘s say we have the following dataset showing the number of pets owned by 10 different households:

2, 4, 0, 1, 2, 0, 3, 2, 1, 3

To calculate the mean, we sum up all the values (18) and divide by the total number of data points (10):

mean = (2+4+0+1+2+0+3+2+1+3) / 10 = 18/10 = 1.8

So in this case, the mean or average number of pets per household is 1.8. Notice that while we can calculate a decimal mean, it may not always be a sensible answer, since it‘s not possible to have 1.8 pets in reality. When interpreting the mean, it‘s important to consider the context of the data and whether a decimal average makes practical sense.

One of the most useful properties of the mean is that it incorporates every value in the dataset via addition. This makes it a good representation of the entire dataset. However, this property is also one of the mean‘s biggest weaknesses – it makes the mean highly sensitive to outliers and extreme values.

For instance, if we change the 2nd data point in our example from 4 to 40, we get:

2, 40, 0, 1, 2, 0, 3, 2, 1, 3

The new mean with this extreme value is:

mean = (2+40+0+1+2+0+3+2+1+3) / 10 = 54/10 = 5.4

The single value of 40 pets drastically increases the mean, even though the rest of the dataset remains the same. When there are extreme outliers like this, the mean may no longer be an ideal measure of central tendency, since the outliers can substantially skew the mean away from the center of the bulk of the data.

The Median

The median is the middle value in a dataset when the values are arranged in order from smallest to largest. For an odd number of data points, the median is simply the value in the direct middle of the sorted list. For an even number of data points, the median is the average of the two middle values.

To find the median, first sort the values in ascending order. Then locate the value in the center. If there‘s an odd number of data points, we can find the location of the median using the formula (n+1)/2, where n is the number of points. If there‘s an even number of points, the median will be the average of the nth/2 and (n/2)+1 values.

For example, using our original pets dataset:

2, 4, 0, 1, 2, 0, 3, 2, 1, 3

First, let‘s sort the numbers in ascending order:

0, 0, 1, 1, 2, 2, 2, 3, 3, 4

Since we have an even number (10) of data points, the median will be the average of the 5th and 6th values (10/2=5). So we locate the 5th and 6th numbers in our sorted list, which are both 2. The median is therefore (2+2)/2 = 2.

The median is less affected by extreme values or skewness in the data compared to the mean. In our modified example with an outlier of 40, the sorted dataset would be:

0, 0, 1, 1, 2, 2, 2, 3, 3, 40

Following the same steps, the 5th and 6th values are still 2, so the median remains at 2, unaffected by the extreme value of 40. This shows how the median can be a more robust measure of central tendency for skewed distributions or data with outliers.

However, one drawback of the median is that it doesn‘t use all information in the dataset – it only considers the middle values. The median also doesn‘t have the nice mathematical properties that the mean does. For instance, medians can‘t be simply added together to get the combined median of two datasets like means can.

The Mode

The mode is the value that appears most frequently in a dataset. Unlike the mean and median, the mode is most appropriate for categorical or discrete data where we simply want to know the most common value.

To find the mode, look for the value or values that occur with the highest frequency in the dataset. There may be no mode if no value repeats, one mode if a single value appears the most, or multiple modes if more than one value occurs with the same maximum frequency.

Using our original pets data again:

2, 4, 0, 1, 2, 0, 3, 2, 1, 3

The value 2 appears three times, more than any other value, so 2 is the mode here. Note that the mode doesn‘t require sorting the data or any calculation – we simply keep track of the frequency or count of each distinct value.

For categorical data without a sensible numeric scale or order, like favorite colors in a survey, the mode is the only measure of central tendency that makes sense to report. The mean and median can‘t be calculated at all for purely categorical data.

The mode is simple to interpret and not at all influenced by extreme values. However, it gives no information about the magnitude or variability of the data values other than the most common one. Many real-world datasets don‘t have a mode at all if no value repeats.

Choosing the Best Measure

With three different measures of central tendency to choose from, you may be wondering when to use each one. There are a few key factors to consider:

  • Type of data (numeric vs categorical)
  • Shape of the distribution (symmetric vs skewed)
  • Presence of outliers

For purely categorical or discrete data without numeric values, the mode is the only option. For numeric data, consider these general guidelines:

  • For fairly symmetric distributions with no extreme outliers, the mean is usually the preferred measure of central tendency. The mean incorporates all values and has useful mathematical properties.

  • For skewed distributions or data with outliers, the median is often a better choice than the mean, since it is robust to extreme values and won‘t be pulled toward outliers. However, the median may not be ideal if the center of the distribution is the primary interest rather than the middle value.

  • The mode can be useful to report along with the mean and median, but is rarely used as the primary measure of central tendency. It emphasizes the most frequent value but ignores the overall magnitude of the data.

In practice, it‘s often helpful to report the mean, median and mode together to give a more complete picture of the central tendency and distribution of a dataset. Comparing the three measures can reveal useful information. For instance, in a symmetric distribution, the mean and median will be similar. But if there‘s a large skew or outliers, the mean and median may be quite different.

Other Types of Means

In addition to the standard arithmetic mean we‘ve focused on, there are a few other variants of the mean that are useful in certain situations:

  • Weighted Mean: The weighted mean is used when some data points are more "important" or should have a higher influence on the average than others. Each value is multiplied by a predefined weight before summing and dividing by the sum of the weights.

  • Trimmed Mean: To calculate a trimmed mean, you remove a certain percentage of the smallest and largest values before calculating the standard mean. This makes the mean more robust to outliers and extreme values. For example, a 10% trimmed mean would remove the bottom and top 10% of values.

  • Geometric Mean: The geometric mean is calculated by multiplying all the values together, then taking the nth root of the product (where n is the number of values). It is often used for values that have different scales or for data that is naturally skewed.

Calculating Mean, Median and Mode in Python

Most programming languages and data analysis tools have built-in functions for calculating the mean, median and mode. Here‘s how we could calculate each measure for our example pets dataset in Python using NumPy:

import numpy as np

pets = [2, 4, 0, 1, 2, 0, 3, 2, 1, 3]

mean = np.mean(pets)
print(f"Mean: {mean}")

median = np.median(pets)
print(f"Median: {median}")  

mode = np.mod(pets)
print(f"Mode: {mode[0]}")

This would output:

Mean: 1.8
Median: 2.0
Mode: 2

Conclusion

In summary, the mean, median and mode are the three primary measures of central tendency used in statistics and data analysis. Each one has its strengths and weaknesses:

  • The mean is the arithmetic average of all values. It incorporates every data point but is sensitive to outliers and skewed distributions.

  • The median is the middle value when the data is sorted. It is robust to outliers and skewed data but doesn‘t use all information in the dataset.

  • The mode is the most frequently occurring value. It is simple to interpret and good for categorical data but doesn‘t give information about magnitude or variability of the data.

Choosing the most appropriate measure depends on the type of data, the shape of the distribution, and the presence of any outliers or extreme values. Often, it‘s best to consider and compare all three to get a complete understanding of the dataset‘s central tendency.

By understanding how to properly calculate and interpret these foundational summary statistics, you‘ll be well-equipped to explore and analyze a wide variety of datasets. With their unique strengths and uses, the mean, median and mode are indispensable tools in any data analyst‘s toolkit.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Similar Posts