Quartiles in statistics are often used to measure the distribution of data. In this tutorial, we will introduce what it is and how to calculate it for statistics beginners.
What are quartiles?
Quartiles contains three values: Q1, Q2 and Q3. These three values will divide our data into three parts, each part contains 25% data, these parts describe the distribution and variance of data.
How to calculate quartiles?
There are some methods to calculate quartiles, we will introduce two methods
Firstly, you should sort your data from smallest to biggest.
Then we will start to calculate.
If our data is:
X= [x1, x2, x3, …, xn]
where xi > xi-1 ; i > 1
To calculate quartiles, we should be sure the position of Q1, Q2 and Q3 in X.
Q1 = (n+1) × 0.25
Q2 = (n+1) × 0.5 or Q2 = Q3 – Q1
Q3 = (n+1)× 0.75
where n is the number of X, n > 0.
As to Q1, the value of it is:
As to Q2,the value of it is equivalent to medium in statistics.
As to Q3, its value is:
Here is an example:
if X = [7,15,36,39,40,41], n = 6
The postion of Q1, Q2 and Q3 in X is:
Q1 = (6+1)/4 = 1.75
Q3 = 3*(6+1)/4 = 5.25
Q2 = 5.25 – 1.75 = 3.5
As to Q1, its value is:
i = integer(1.75) = 1
d = decimal(1.75) = 0.75
Q1 = x1 * (1-0.75) + x2 * 0.75 = 7 * 0.25 + 15 * 0.75 = 13
As to Q3, its value is:
i = integer(5.25) = 5
d = decimal(5.25) = 0.25
Q3 = x5 * 0.75 + x6 * 0.25= 40 * 0.75 + 41 * 0.25 = 40.25
As to Q2, its value is
Q2 = (36 + 39) / 2 = 37.5