Descriptive Statistics
Descriptive Statistics is broken down into Tendency and Variability.
Tendency is about Center Measures:
- The Mean (the average value)
- The Median (the mid point value)
- The Mode (the most common value)
The Mean
The Mean Value is the Average of all values.
This table contains 11 values:
7 | 8 | 8 | 9 | 9 | 9 | 10 | 11 | 14 | 14 | 15 |
To find the Mean Value: Add all values and divide by the number of values.
The Mean Value is:
(7+8+8+9+9+9+10+11+14+14+15)/11 = 10.3636363636.
The Mean is the Sum divided by the Count.
Or use a math library like math.js:
const values = [7,8,8,9,9,9,10,11,14,14,15];
let mean = math.mean(values);
The Median
A list of speed values:
99,86,87,88,111,86,103,87,94,78,77,85,86
The Median is the value in the middle (after the values are sorted):
77,78,85,86,86,86,87,87,88,94,99,103,111
Calculate the median:
const speed = [99,86,87,88,111,86,103,87,94,78,77,85,86];
let median = math.median(speed);
If there are two numbers in the middle, divide the sum of them by two.
77,78,85,86,86,86,87,87,88,94,99,103
(86 + 87) / 2 = 86.5
Calculate the median:
const speed = [99,86,87,88,86,103,87,94,78,77,85,86];
let median = math.median(speed);
The Mode
The Mode Value is the value that appears the most number of times:
99,86,87,88,111,86,103,87,94,78,77,85,86
Calculate the mode:
const speed = [99,86,87,88,86,103,87,94,78,77,85,86];
let mode = math.mode(speed);
Outliers
Outliers are values "outside" the other values:
99,86,87,88,111,86,103,87,94,78,300,85,86
Outliers can change the mean a lot. Sometimes we don't use them (they might be an error), or we use the median or the mode instead.
Calculate the Mean:
const values = [99,86,87,88,111,86,103,87,94,78,300,85,86];
let mean = math.mean(values);