π Example 1: Odd number of observations
Find the median of: 23, 18, 45, 12, 31, 27, 38
Unit II Β· Lectures 11β12 of 40 Β· B.Sc. Data Science, 1st Year, Semester II
The median is the middle value of a dataset when the observations are arranged in ascending (or descending) order. It divides the data into two equal halves β exactly 50% of observations fall below the median and 50% fall above it. It is a positional average, denoted by M or Me.
Imagine 7 students standing in a line, arranged by height (shortest to tallest). The student standing in the 4th position (the middle) represents the median height. Three students are shorter and three are taller β the median person perfectly splits the group in half.
Find the median of: 23, 18, 45, 12, 31, 27, 38
Step 1: Arrange in ascending order:
12, 18, 23, 27, 31, 38, 45
Step 2: Count: n = 7 (odd)
Step 3: Position of median = (n+1)/2 = (7+1)/2 = 4th value
Step 4: The 4th value in the ordered list is 27.
β΄ Median = 27
Values below 27: 12, 18, 23 β 3 values (left half) β
Values above 27: 31, 38, 45 β 3 values (right half) β
Equal halves confirmed. The median is correct.
Find the median of: 15, 22, 38, 27, 41, 33
Step 1: Arrange in ascending order:
15, 22, 27, 33, 38, 41
Step 2: Count: n = 6 (even)
Step 3: Positions = n/2 = 3rd and n/2 + 1 = 4th
Step 4: 3rd value = 27, 4th value = 33
Step 5: Median = (27 + 33) / 2 = 60 / 2 = 30
β΄ Median = 30 (Note: 30 is not an actual observation!)
Select Odd or Even n, then click "Find Median":
For grouped data, we do not know individual observations. We know that N/2 observations lie below the median. The median lies in the class where the cumulative frequency first reaches or exceeds N/2. This class is called the median class.
Imagine rows of seats (classes) with people (frequency). You are person number N/2. You count people row by row (cumulative frequency). When you find the row where you belong β that is your median class. Your exact seat within that row is the median value.
Find the median from the following distribution:
| Class | 10β20 | 20β30 | 30β40 | 40β50 | 50β60 | 60β70 |
|---|---|---|---|---|---|---|
| f | 5 | 8 | 12 | 10 | 7 | 3 |
Step 1: Calculate N = Ξ£f = 5+8+12+10+7+3 = 45
Step 2: N/2 = 45/2 = 22.5
Step 3: Build the cumulative frequency (Less Than type):
| Class | f | CF (Less Than) |
|---|---|---|
| 10β20 | 5 | 5 |
| 20β30 | 8 | 13 |
| 30β40 | 12 | 25 β first CF β₯ 22.5 |
| 40β50 | 10 | 35 |
| 50β60 | 7 | 42 |
| 60β70 | 3 | 45 |
Step 4: Identify the median class: 30β40 (first class where CF β₯ 22.5)
Step 5: Identify the values:
L = 30 (lower limit of median class)
CF = 13 (CF of the class before the median class, i.e., 20β30)
f = 12 (frequency of the median class)
h = 10 (class width)
Step 6: Apply the formula:
Median = L + [(N/2 β CF) / f] Γ h
Median = 30 + [(22.5 β 13) / 12] Γ 10
Median = 30 + [9.5 / 12] Γ 10
Median = 30 + 0.7917 Γ 10
Median = 30 + 7.917
Median = 37.92
Click "Find Median" to see the median class identified and the value calculated on a number line:
1. Not affected by extreme values β robust against outliers.
2. Can be used for open-end distributions β only needs position, not exact values.
3. Can be determined graphically β from the ogive (at N/2 on Y-axis).
4. Suitable for qualitative data β can find median of ordinal data (e.g., rating: Low, Medium, High).
5. Easy to understand β the "middle value" concept is intuitive.
1. Does not use all observations β only the middle value matters; extreme values are ignored.
2. Not algebraically tractable β cannot be used in further calculations like variance.
3. Not unique for grouped data β depends on the interpolation assumption.
4. Requires ordering β data must be arranged in order first (tedious for large datasets).
5. Affected by sampling fluctuations β the median varies more across samples than the mean.
β Lecture 12 β
The mode is the value that occurs most frequently in a dataset β the observation with the highest frequency. It is the value around which the data tends to cluster most densely. Denoted by Z or Mo.
If a class votes for their favourite colour and the results are: Red (8), Blue (12), Green (5), Yellow (3) β Blue is the mode because it was chosen most often (12 times). The mode tells you what is most popular or most common.
Unimodal: One mode. E.g., 2, 3, 3, 5, 7 β Mode = 3
Bimodal: Two modes. E.g., 2, 3, 3, 5, 5, 7 β Modes = 3, 5
Trimodal: Three modes.
No mode: All values occur equally. E.g., 1, 2, 3, 4, 5 β No mode
β’ Most common shoe size sold in a shop
β’ Most frequent daily temperature in a month
β’ Most popular product in a store
β’ Peak traffic hour on a road
β’ Most common blood group in a population
For ungrouped data, the mode is found by inspection β simply count the frequency of each value and pick the one that occurs most often. No formula is needed.
Data: 4, 6, 2, 6, 8, 6, 3, 5, 6, 7
| Value | Frequency |
|---|---|
| 2 | 1 |
| 3 | 1 |
| 4 | 1 |
| 5 | 1 |
| 6 | 4 |
| 7 | 1 |
| 8 | 1 |
β΄ Mode = 6 (occurs 4 times β highest frequency)
Data: 3, 5, 3, 7, 5, 8, 3, 5, 9
| Value | Frequency |
|---|---|
| 3 | 3 |
| 5 | 3 |
| 7 | 1 |
| 8 | 1 |
| 9 | 1 |
β΄ Modes = 3 and 5 (bimodal β both occur 3 times)
For grouped data, the modal class is the class interval with the highest frequency. The mode is then estimated by interpolation within this class.
Imagine the frequency distribution as a landscape of hills. The modal class is the tallest hill. The mode formula finds the exact peak of that hill by looking at how steeply the hill rises from the left (fβ) and falls to the right (fβ).
Find the mode from the following distribution:
| Class | 0β10 | 10β20 | 20β30 | 30β40 | 40β50 | 50β60 |
|---|---|---|---|---|---|---|
| f | 5 | 8 | 15 | 12 | 7 | 3 |
Step 1: Identify the class with the highest frequency:
20β30 has f = 15 (highest) β Modal class = 20β30
Step 2: Identify the values:
L = 20 (lower limit of modal class)
fβ = 15 (frequency of modal class)
fβ = 8 (frequency of the class before modal class, i.e., 10β20)
fβ = 12 (frequency of the class after modal class, i.e., 30β40)
h = 10 (class width)
Step 3: Apply the formula:
Mode = L + [(fβ β fβ) / (2fβ β fβ β fβ)] Γ h
Mode = 20 + [(15 β 8) / (2Γ15 β 8 β 12)] Γ 10
Mode = 20 + [7 / (30 β 20)] Γ 10
Mode = 20 + [7 / 10] Γ 10
Mode = 20 + 7
Mode = 27
Click "Find Mode" to see the modal class identified and the mode value calculated:
1. Easy to understand β "most frequent value" is intuitive.
2. Not affected by extreme values β outliers don't shift the mode.
3. Can be used for qualitative data β can find mode of nominal data (favourite colour, most common name).
4. Can be determined by inspection for ungrouped data.
5. Represents the "typical" value well in highly skewed distributions (e.g., most common income).
1. Not always defined β no mode if all values occur equally, or ambiguous if multiple modes exist.
2. Not based on all observations β only the most frequent value matters.
3. Not algebraically tractable β cannot be used in further calculations.
4. Not unique β a dataset can have multiple modes.
5. Affected by class width β for grouped data, changing the class intervals can change the modal class.
For a moderately skewed distribution (not too far from bell-shaped), Karl Pearson discovered an approximate relationship between the three measures of central tendency:
In a perfectly symmetric (bell-shaped) distribution, Mean = Median = Mode. When the distribution becomes skewed, the three values separate in a predictable way. This formula captures that predictable separation.
Click each type to see the relative positions of Mean, Median, and Mode:
For a moderately skewed distribution:
Mean = 40, Median = 35
Find the Mode using the empirical formula.
Mode = 3 Γ Median β 2 Γ Mean
Mode = 3 Γ 35 β 2 Γ 40
Mode = 105 β 80
Mode = 25
Check: Mean (40) > Median (35) > Mode (25) β Right-skewed β
For a moderately skewed distribution:
Mean = 50, Mode = 62
Find the Median.
Using: Mean β Mode = 3(Mean β Median)
50 β 62 = 3(50 β Median)
β12 = 150 β 3 Γ Median
3 Γ Median = 162
Median = 54
Check: Mode (62) > Median (54) > Mean (50) β Left-skewed β
Enter any two values and the third will be calculated automatically:
| Feature | Mean (xΜ) | Median (M) | Mode (Z) |
|---|---|---|---|
| Definition | Sum Γ· Count | Middle value | Most frequent value |
| Type | Mathematical average | Positional average | Positional average |
| Based on | All observations | Middle position only | Frequency only |
| Affected by outliers? | Yes β highly sensitive | No β robust | No β robust |
| Qualitative data? | No | Yes (ordinal only) | Yes (nominal too) |
| Open-end classes? | Cannot be calculated | Can be estimated | Can be estimated |
| Algebraic treatment? | Yes (variance, regression) | Limited | No |
| Unique? | Always unique | Always unique | May not exist or may have multiple |
| Graphical determination? | Not directly | From ogive | From histogram (highest bar) |
| Sampling stability | Most stable | Moderate | Least stable |
| Best for | Symmetric data | Skewed data | Most common value needed |
β’ Data is symmetric with no outliers
β’ You need further algebraic calculations
β’ Every observation matters
β’ Computing average marks, income, temperature
β’ Data is skewed (income, house prices)
β’ There are extreme outliers
β’ Distribution has open-end classes
β’ You want the centre of a ranked dataset
β’ Data is qualitative/nominal
β’ You need the most typical or common value
β’ Finding peak demand (busiest hour, best-selling size)
β’ Data has no numerical meaning
Q1: The median of 8, 12, 15, 20, 25, 30, 35 is:
Q2: The median of 10, 20, 30, 40 is:
Q3: In a grouped frequency distribution, the median class is identified by:
Q4: The data {Red, Blue, Red, Green, Red, Blue} has mode:
Q5: If Mean = 50 and Median = 45, the Mode (using empirical formula) is approximately:
Q6: In a right-skewed distribution, the correct order is:
Q7: Which average can be found for qualitative (nominal) data?
Q8: If the modal class has fβ=20, the preceding class has fβ=12, and the succeeding class has fβ=15, with L=30 and h=10, the mode is:
Q9: The empirical formula Mean β Mode = 3(Mean β Median) was given by:
Q10: The median is NOT affected by:
1. Find the median of: (a) 14, 28, 35, 42, 56, 63, 71 (b) 12, 18, 25, 30, 38, 44
2. Find the median from the following grouped data:
| Class | 0β10 | 10β20 | 20β30 | 30β40 | 40β50 |
|---|---|---|---|---|---|
| f | 6 | 10 | 14 | 12 | 8 |
| Class | 5β15 | 15β25 | 25β35 | 35β45 | 45β55 |
|---|---|---|---|---|---|
| f | 4 | 8 | 16 | 11 | 6 |
Questions? Let's discuss!
Lecture 13β14: Partition Values β Quartiles, Deciles, Percentiles
Lecture 15: Unit II Review & Problem-Solving
Unit II Β· Lectures 11β12 Β· BDS113 Introduction to Statistics Β· B.Sc. Data Science, Semester II