PSY1004 Session 04
PSY1004 Session 04
Session 4
1
Interquartile range (IQR)
The IQR is the difference between the first and the third
quartiles (a.k.a. the 25th and the 75th percentiles), and
conceptually represents the range of the middle 50% of a
set of scores.
Example:
1 1 1 2 2 2 2 2 2
2 2 2 3 3 3 3 3 3
3 3 3 3 4 4 4 4 4
4 5 5 6 7 9 10 20 33
Range = 32
IQR = 2
2
Interquartile range (IQR)
There are many different algorithms to compute the
quartiles / percentiles of a sample of data.
Examples:
SPSS
R/
JAMOVI
3
Tukey’s hinges
• Quartile location = (median location + 1 ) / 2
• If the median location is a fractional value, the
fraction should first be dropped from the numerator.
e.g., 2, 3, 5, 6, 7, 8, 12, 15, 18, 20, 27, 28, 29, 33, 34, 55, 57, 60, 61, 61, 70
• N = 21 , and so the median position = (21 + 1)/2 = 11, i.e., median = 27
• The quartile position = (11 + 1)/2 = 6, i.e., the 1st quartile = 8 (the 6th
number from the bottom); the 3rd quartile = 55 (the 6th number from the
top)
e.g., 3, 5, 6, 7, 8, 12, 15, 18, 20, 27, 28, 29, 33, 34, 55, 57, 60, 61, 61, 70
• N = 20, and so the median position = (20 + 1)/2 = 10.5, i.e., median = 27.5
• The quartile position = (10 + 1)/2 = 5.5, i.e., the 1st quartile = (8 + 12)/2 =
10; the 3rd quartile = (55 + 57)/2 = 56
4
Boxplot
• A boxplot visually depicts in a fairly compact way the median, IQR, and
range, of a set of data. The boxplot can also display the outlier(s), if exist(s)
• Outlier: a score very different from the rest of the data – a precise criterion for
identifying outliers will be discussed below.
75th percentile
25th percentile
C D
6
Boxplot
A symmetrical distribution
Right-skewed distribution
(positive skew)
Left-skewed distribution
(negative skew)
7
Boxplot (example)
Data
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
Median 50
1st quartile 45
3rd quartile 55
IQR = 55 - 45 = 10
8
Data Identifying outliers
60 Upper fence (usually
59 not shown in computer
58
57
The whiskers go out to output)
56 the most extreme data
55
54 points that do not
53
52
exceed the “fences”, Whiskers
51 whose values are 1.5
50
49
times the IQR
48 above/below the
47
46 75th/25th percentile
45
44
respectively. Any score
43 falling outside of this
42
41
range is an outlier.
40 Whiskers
Median 50
1st quartile 45
3rd quartile 55
IQR = 55 - 45 10
Lower fence = 45 - 10 x 1.5 30 Lower fence (usually
Upper fence = 55 + 10 x 1.5 70
Minimum (before the lower fence) 40
not shown in computer
Maximum (before the upper fence) 60 output)
9
Data
75
Identifying outliers
60
59
58
57 The whiskers go out to
56
55
the most extreme data
54 points that do not Upper fence (usually not
53
52 exceed the “fences”, shown in computer output)
51
50 whose values are 1.5
49
48
times the IQR Whiskers
47 above/below the
46
45 75th/25th percentile
44
43
respectively. Any score
42 falling outside of this Whiskers
41
40 range is an outlier.
25
Median 50
1st quartile 44.5 Lower fence (usually not
3rd quartile 55.5 shown in computer output)
IQR 11
Lower fence 28.0
Upper fence 72.0
Minimum (before the lower fence) 40
Maximum (before the upper fence) 60 10