Statistics - Mode
The mode is a type of average value, which describes where most of the data is located.
Mode
The mode is the value(s) that are the most common in the data.
A dataset can have multiple values that are modes.
A distribution of values with only one mode is called unimodal.
A distribution of values with two modes is called bimodal. In general, a distribution with more than one mode is called multimodal.
Mode can be found for both categorical and numerical data.
Finding the Mode
Here is a numerical example:
4, 7, 3, 8, 11, 7, 10, 19, 6, 9, 12, 12
Both 7 and 12 appears two times each, and the other values only once. The modes of this data is 7 and 12.
Here is a categorical example with names:
Alice, John, Bob, Maria, John, Julia, Carol
John appears two times, and the other values only once. The mode of this data is John.
Finding the Mode with Programming
The mode can easily be found with many programming languages.
Using software and programming to calculate statistics is more common for bigger sets of data, as calculating manually becomes difficult.
Example
With Python use the statistics library multimode()
method to find the modes of the values 4,7,3,8,11,7,10,19,6,9,12,12:
from statistics import multimode
values = [4,7,3,8,11,7,10,19,6,9,12,12]
x = multimode(values)
print(x)
Try it Yourself »
Example
Using R with a user-defined function to find the modes of the values 4,7,3,8,11,7,10,19,6,9,12,12:
mode <- function(x) {
unique_values <- unique(x)
table <- tabulate(match(x, unique_values))
unique_values[table == max(table)]
}
values <- c(4,7,3,8,11,7,10,19,6,9,12,12)
mode(values)
Try it Yourself »
Note: R has no built-in function to find the mode.