Week 3: Measures of Center & Spread

3182 words
16 min read
2026-09-12T00:00:00.000Z
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

Mean, median, mode, quartiles, IQR, five-number summary, box plots, variance, standard deviation, and the empirical rule. # Statistics for Data Science I — Week 3: Measures of Center & Spread IITM’s Week 3 moves into **numerical data, measures of central tendency, quartiles, and numerical summaries**.

Statistics for Data Science I — Week 3: Measures of Center & Spread

IITM’s Week 3 moves into numerical data, measures of central tendency, quartiles, and numerical summaries.

TL;DR

For numerical data, the main questions become:
Where is the data centered?\boxed{ \text{Where is the data centered?} }
and
How spread out is it?\boxed{ \text{How spread out is it?} }
The highest-value ideas are:
  • mean
  • median
  • mode
  • range
  • quartiles
  • interquartile range
  • five-number summary
  • outliers
  • box plots
  • choosing the right summary for symmetric vs skewed data

1. Numerical data recap

Numerical data represents quantities.
Examples:
  • height
  • age
  • income
  • marks
  • number of purchases
  • time taken
Two major types:
DiscreteandContinuous\boxed{ \text{Discrete} \quad\text{and}\quad \text{Continuous} }

2. Why numerical data needs different summaries

For categorical data, counting categories is natural.
For numerical data, there may be many distinct values.
Example:
61,68,72,72,75,81,95.61,68,72,72,75,81,95.
Listing frequencies alone does not immediately tell us:
  • typical value
  • spread
  • skew
  • unusual observations
So we summarize the numerical distribution.

3. Measures of central tendency

A measure of central tendency tries to answer:
What value represents the center or typical location of the data?
The three classic measures are:
Mean, Median, Mode\boxed{ \text{Mean, Median, Mode} }

4. Arithmetic mean

For observations:
x1,x2,…,xn,x_1,x_2,\dots,x_n,
the sample mean is:
xˉ=x1+x2+⋯+xnn\boxed{ \bar{x} = \frac{x_1+x_2+\cdots+x_n}{n} }
or:
xˉ=1n∑i=1nxi\boxed{ \bar{x} = \frac1n\sum_{i=1}^n x_i }

5. Example: mean

Data:
4,6,8,10,12.4,6,8,10,12.
Then:
xˉ=4+6+8+10+125=405=8.\bar{x} = \frac{4+6+8+10+12}{5} = \frac{40}{5} = 8.
So:
xˉ=8\boxed{\bar{x}=8}

6. Mean as a balance point

The mean has a useful interpretation as the balance point of the data.
If deviations from the mean are:
xi−xˉ,x_i-\bar{x},
then:
∑i=1n(xi−xˉ)=0\boxed{ \sum_{i=1}^n(x_i-\bar{x})=0 }
Positive and negative deviations exactly balance.

7. Why?

Since:
xˉ=1n∑xi,\bar{x} = \frac1n\sum x_i,
we have:
nxˉ=∑xi.n\bar{x}=\sum x_i.
Therefore:
∑(xi−xˉ)=∑xi−nxˉ=0.\sum(x_i-\bar{x}) = \sum x_i-n\bar{x} = 0.
This property becomes important when variance is introduced.

8. Weighted mean

Sometimes observations do not contribute equally.
Weighted mean:
xˉw=∑iwixi∑iwi\boxed{ \bar{x}_w = \frac{\sum_i w_i x_i} {\sum_i w_i} }
where:
wiw_i
is the weight attached to value xix_i.

9. Example: weighted mean

Suppose:
  • Quiz score = 8080, weight 20%20\%
  • Exam score = 9090, weight 80%80\%
Then:
xˉw=0.2(80)+0.8(90).\bar{x}_w = 0.2(80)+0.8(90).
So:
=16+72=88.=16+72 =88.
Thus:
88\boxed{88}

10. Mean from a frequency table

Suppose value xix_i occurs fif_i times.
Then:
xˉ=∑ifixi∑ifi\boxed{ \bar{x} = \frac{\sum_i f_i x_i} {\sum_i f_i} }
This is just a weighted mean where frequency acts as weight.

11. Example

xxFrequency
12
23
31
Total observations:
n=2+3+1=6.n=2+3+1=6.
Mean:
xˉ=1(2)+2(3)+3(1)6\bar{x} = \frac{1(2)+2(3)+3(1)}{6} =2+6+36=116.= \frac{2+6+3}{6} = \frac{11}{6}.

12. Median

The median is the middle value after arranging the data in increasing order.
This ordering step is essential.

13. Odd number of observations

If:
nn
is odd, the median is the value at position:
n+12\boxed{ \frac{n+1}{2} }
Example:
2,4,7,9,12.2,4,7,9,12.
Here:
n=5.n=5.
Middle position:
5+12=3.\frac{5+1}{2}=3.
So median:
7\boxed{7}

14. Even number of observations

If nn is even, median is the average of the two middle values.
Example:
2,4,7,9.2,4,7,9.
Middle values:
4,7.4,\quad7.
Median:
4+72=5.5\boxed{ \frac{4+7}{2}=5.5 }

15. Median as a positional measure

Unlike the mean, the median depends primarily on order, not the exact magnitudes of every value.
This makes it resistant to extreme observations.

16. Example: effect of an outlier

Dataset A:
10,11,12,13,14.10,11,12,13,14.
Mean:
12.12.
Median:
12.12.
Now replace 1414 with:
1000.1000.
Dataset B:
10,11,12,13,1000.10,11,12,13,1000.
Median remains:
12.12.
Mean becomes:
10465=209.2.\frac{1046}{5}=209.2.
So:
Mean is sensitive to extreme values; median is resistant.\boxed{ \text{Mean is sensitive to extreme values; median is resistant.} }

17. Mode

The mode is the most frequently occurring value.
Example:
2,3,3,3,5,7.2,3,3,3,5,7.
Mode:
3\boxed{3}

18. Multiple modes

Data can have:
  • no unique mode
  • one mode
  • multiple modes
Example:
1,1,2,2,31,1,2,2,3
has modes:
1,2.1,\quad2.

19. Mean vs median vs mode

Mean

Uses every numerical value.

Median

Uses ordered position.

Mode

Uses frequency.
They answer slightly different versions of "typical."

20. When mean is useful

Mean works especially well when the data are roughly symmetric and do not contain severe outliers.
Example:
48,49,50,51,52.48,49,50,51,52.
Mean and median are both around:
50.50.

21. When median is useful

Median is often preferable for strongly skewed data or data with extreme outliers.
Examples:
  • household income
  • house prices
  • waiting times
A few enormous values can pull the mean upward.

22. Symmetric distributions

For a symmetric unimodal distribution:
Mean≈Median≈Mode\boxed{ \text{Mean}\approx\text{Median}\approx\text{Mode} }
In perfectly symmetric idealized cases, they may coincide exactly.

23. Right-skewed distribution

Right skew means a long tail toward larger values.
Typical relationship:
Mean>Median\boxed{ \text{Mean}>\text{Median} }
because large observations pull the mean to the right.
Example:
income data.

24. Left-skewed distribution

Left skew means a long tail toward smaller values.
Typical relationship:
Mean<Median\boxed{ \text{Mean}<\text{Median} }
because small observations pull the mean leftward.

25. Range

The simplest measure of spread is:
Range=Maximum−Minimum\boxed{ \text{Range} = \text{Maximum}-\text{Minimum} }
Example:
2,5,8,13.2,5,8,13.
Range:
13−2=11.13-2=11.

26. Weakness of range

Range depends only on two observations:
  • minimum
  • maximum
So a single extreme value can change it dramatically.
Example:
2,5,8,132,5,8,13
has range:
11.11.
Replace 1313 with 10001000:
Range=998.\text{Range}=998.

27. Percentiles

A percentile indicates a position relative to the distribution.
Informally, the ppth percentile is a value such that approximately:
p%p\%
of observations lie at or below it.
Examples:
  • 25th percentile
  • 50th percentile
  • 75th percentile
These are central to quartiles.

28. Quartiles

Quartiles divide ordered data into approximately four parts.
They are:
Q1,Q2,Q3\boxed{ Q_1,\quad Q_2,\quad Q_3 }
where:
Q1=first quartileQ_1=\text{first quartile} Q2=second quartileQ_2=\text{second quartile} Q3=third quartileQ_3=\text{third quartile}

29. Interpretation

Q1Q_1
is around the 25th percentile.
Q2Q_2
is the 50th percentile:
Q2=Median\boxed{ Q_2=\text{Median} } Q3Q_3
is around the 75th percentile.

30. Important convention warning

There are multiple legitimate conventions for computing quartiles in finite datasets.
Different textbooks/software may differ slightly.
For IITM questions, follow the convention taught in the course/question statement.
The conceptual interpretation remains the same.

31. Simple quartile method

For a basic ordered dataset:
  1. find median
  2. lower half → find its median → Q1Q_1
  3. upper half → find its median → Q3Q_3
Whether the overall median is included in the halves when nn is odd depends on convention.
Again, use IITM's specified method when given.

32. Example

Ordered data:
1,2,3,4,5,6,7,8.1,2,3,4,5,6,7,8.
Median:
Q2=4+52=4.5.Q_2= \frac{4+5}{2}=4.5.
Lower half:
1,2,3,4.1,2,3,4.
So:
Q1=2+32=2.5.Q_1= \frac{2+3}{2}=2.5.
Upper half:
5,6,7,8.5,6,7,8.
So:
Q3=6+72=6.5.Q_3= \frac{6+7}{2}=6.5.

33. Interquartile range

The interquartile range measures the spread of the middle 50% of data:
IQR=Q3−Q1\boxed{ IQR=Q_3-Q_1 }
For the previous example:
IQR=6.5−2.5=4.IQR=6.5-2.5=4.

34. Why IQR is useful

Unlike the range, IQR ignores the most extreme quarter of observations on each side.
So it is more resistant to outliers.
Thus:
Median + IQR\boxed{ \text{Median + IQR} }
is often a strong pair for skewed data.

35. Five-number summary

The five-number summary consists of:
Minimum, Q1, Median, Q3, Maximum\boxed{ \text{Minimum},\ Q_1,\ \text{Median},\ Q_3,\ \text{Maximum} }
This provides a compact view of:
  • center
  • spread
  • asymmetry
  • extremes

36. Example five-number summary

Suppose:
1,2,3,4,5,6,7,8.1,2,3,4,5,6,7,8.
Using the quartiles above:
(1, 2.5, 4.5, 6.5, 8)\boxed{ (1,\ 2.5,\ 4.5,\ 6.5,\ 8) }

37. Box plot

A box plot visually represents the quartile structure.
Conceptually:
text
min      Q1      median      Q3       max
 |--------[---------|---------]---------|
The box spans:
Q1→Q3.Q_1\to Q_3.
Its width represents:
IQR.IQR.
The line inside the box marks the median.

38. Outlier rule using IQR

A common descriptive rule identifies potential outliers using fences.
Lower fence:
Q1−1.5(IQR)\boxed{ Q_1-1.5(IQR) }
Upper fence:
Q3+1.5(IQR)\boxed{ Q_3+1.5(IQR) }
Observations outside these fences are often flagged as potential outliers.

39. Example

Suppose:
Q1=10,Q3=20.Q_1=10, \qquad Q_3=20.
Then:
IQR=10.IQR=10.
Lower fence:
10−1.5(10)=−5.10-1.5(10) = -5.
Upper fence:
20+1.5(10)=35.20+1.5(10) = 35.
So a value:
4040
would be flagged as a potential outlier.

40. "Outlier" does not mean "wrong"

An outlier can be:
  • genuine rare observation
  • measurement error
  • data-entry error
  • member of another population
  • important scientific signal
So do not automatically delete outliers.
The statistical question is:
Why is this value unusual?

41. Shape of a distribution

When describing numerical data, think about:
  • center
  • spread
  • shape
  • outliers
A compact framework is:
Center + Spread + Shape + Unusual values\boxed{ \text{Center + Spread + Shape + Unusual values} }

42. Symmetry

A distribution is roughly symmetric if its left and right sides are mirror-like around the center.
In such cases, mean and median tend to be similar.

43. Skewness

Right-skewed

Longer tail to the right.

Left-skewed

Longer tail to the left.
Important:
skew is named after the tail direction, not where most observations lie.

44. Example: right skew

Data:
1,2,2,3,3,4,20.1,2,2,3,3,4,20.
Most values are small.
But the tail extends to:
20.20.
So the data are right-skewed.
The mean is pulled upward.

45. Example: left skew

Data:
1,17,18,18,19,20,20.1,17,18,18,19,20,20.
Most observations are large, but there is a low extreme tail toward:
1.1.
So it is left-skewed.

46. Mean and transformations

Suppose every observation is increased by constant cc.
Original:
xi.x_i.
New:
yi=xi+c.y_i=x_i+c.
Then:
yˉ=xˉ+c\boxed{ \bar y=\bar x+c }

47. Scaling the mean

If:
yi=axi,y_i=ax_i,
then:
yˉ=axˉ\boxed{ \bar y=a\bar x }
More generally:
yi=axi+by_i=ax_i+b
gives:
yˉ=axˉ+b\boxed{ \bar y=a\bar x+b }

48. Median under transformations

For positive scaling:
y=ax+b,a>0,y=ax+b,\qquad a>0,
the median transforms similarly:
Median(Y)=aMedian(X)+b\boxed{ \text{Median}(Y) = a\text{Median}(X)+b }
This is useful for unit conversions.

49. Example: Celsius to Fahrenheit

Transformation:
F=95C+32.F=\frac95C+32.
If mean Celsius temperature is:
20∘C,20^\circ C,
then mean Fahrenheit:
95(20)+32=68∘F.\frac95(20)+32 = 68^\circ F.
Same linear transformation works on the mean.

50. Combined mean

Suppose Group 1 has:
n1n_1
observations with mean:
xˉ1.\bar{x}_1.
Group 2 has:
n2n_2
observations with mean:
xˉ2.\bar{x}_2.
Combined mean:
xˉ=n1xˉ1+n2xˉ2n1+n2\boxed{ \bar{x} = \frac{ n_1\bar{x}_1+n_2\bar{x}_2 }{ n_1+n_2 } }
It is a weighted mean.

51. Example

Class A:
n1=20,xˉ1=70.n_1=20,\qquad\bar{x}_1=70.
Class B:
n2=30,xˉ2=80.n_2=30,\qquad\bar{x}_2=80.
Combined:
xˉ=20(70)+30(80)50.\bar{x} = \frac{20(70)+30(80)}{50}.
So:
=1400+240050=76.= \frac{1400+2400}{50} = 76.
Thus:
76\boxed{76}
Not:
7575
because the classes have different sizes.

52. Mean from deviations

Because:
∑(xi−xˉ)=0,\sum(x_i-\bar{x})=0,
if you know all but one deviation from the mean, you can recover the missing one.
Example deviations:
−4,−2,1,3,?-4,-2,1,3,?
Their sum must be zero:
−4−2+1+3+d=0.-4-2+1+3+d=0.
Thus:
d=2.d=2.

53. Why spread matters

Two datasets can have the same mean but behave very differently.
Dataset A:
49,50,50,50,51.49,50,50,50,51.
Dataset B:
0,25,50,75,100.0,25,50,75,100.
Both have mean:
50.50.
But B is vastly more spread out.
So a measure of center alone is insufficient.

54. Range comparison

Dataset A:
49→5149\to51
Range:
2.2.
Dataset B:
0→1000\to100
Range:
100.100.
This immediately reveals very different variation.
More sophisticated spread measures come later.

55. Robust/resistant statistics

A statistic is called resistant if extreme values have relatively little effect on it.
Median:
resistant\boxed{\text{resistant}}
IQR:
resistant\boxed{\text{resistant}}
Mean:
not resistant\boxed{\text{not resistant}}
Range:
not resistant\boxed{\text{not resistant}}
This pairing is important.

56. Matching center and spread

For roughly symmetric data without severe outliers:
Mean + standard deviation\boxed{ \text{Mean + standard deviation} }
is often useful.
For skewed data or data with outliers:
Median + IQR\boxed{ \text{Median + IQR} }
is usually more informative.
Standard deviation comes into fuller focus later, but remember this pairing.

57. Histogram intuition

For numerical data, observations can be grouped into intervals called bins.
Example:
text
Marks
0–20    ██
20–40   ████
40–60   ███████
60–80   █████
80–100  ██
A histogram shows the shape of a numerical distribution.
Unlike bar charts, adjacent numerical intervals are continuous, so bars usually touch.

58. Bar chart vs histogram

This distinction is extremely important.
Bar chartHistogram
categorical datanumerical data
separate categoriesnumerical intervals/bins
bars usually separatedbars usually touch
order may be arbitrary for nominal datanumerical order is fixed
Do not confuse them.

59. Bin width matters

Changing histogram bins can make the same data look different.
Too wide:
  • hides structure
Too narrow:
  • shows excessive noise
So visual summaries depend partly on representation choices.

60. Dot plot intuition

For small numerical datasets, a dot plot may display each observation directly.
Example:
text
1: •
2: •••
3: ••
4: •
This retains more detail than a heavily binned histogram.

Common mistake: finding median without sorting
Data:
8,1,10,3,5.8,1,10,3,5.
Do not choose:
1010
just because it is physically in the middle of the written list.
Sort:
1,3,5,8,10.1,3,5,8,10.
Median:
5\boxed{5}
Common mistake: average always means mean
In ordinary speech, "average" may refer to:
  • mean
  • median
  • sometimes mode
In mathematics/statistics, identify which measure is intended.
If a problem specifically says arithmetic mean, use the formula for mean.

Common mistake: mean must be an observed value
No.
For:
1,2,1,2,
mean:
1.5.1.5.
There need not be an observation equal to the mean.

Common mistake: median must be an observed value
For even nn, median may be the average of two middle observations.
So it also need not appear in the dataset.
Example:
1,2,10,121,2,10,12
median:
2+102=6.\frac{2+10}{2}=6.
Common mistake: mode only works for categorical data
Mode also applies to numerical data.
Example:
1,1,1,3,5.1,1,1,3,5.
Mode:
1.1.
But mean and median often carry more numerical information.

Common mistake: range describes most observations
No.
Range only looks at:
min⁡,max⁡.\min,\max.
It tells nothing directly about how the interior values are distributed.

Common mistake: outlier detection is absolute
The:
1.5×IQR1.5\times IQR
rule is a conventional screening rule.
It does not prove that a value is erroneous or from another population.
It flags observations for closer inspection.

Common mistake: mean is always best
Consider salaries:
30k, 31k, 33k, 35k, 10,000k.30k,\ 31k,\ 33k,\ 35k,\ 10,000k.
The mean may represent almost nobody.
Median gives a more representative center for the typical observation.
Choose summaries based on distribution shape.

Common mistake: skew direction
If the long tail points right:
right-skewed\boxed{\text{right-skewed}}
even though most observations may be concentrated on the left.
Name the tail, not the cluster.

70. Numerical-data workflow

For a dataset:
text
1. Sort / inspect values
2. Identify center
   ├── mean
   └── median
3. Identify spread
   ├── range
   └── IQR
4. Identify quartiles
5. Look for outliers
6. Describe shape
   ├── symmetric
   ├── right-skewed
   └── left-skewed
7. Choose appropriate summary

71. Formula sheet

Mean

xˉ=1n∑i=1nxi\boxed{ \bar{x} = \frac1n\sum_{i=1}^n x_i }

Weighted mean

xˉw=∑wixi∑wi\boxed{ \bar{x}_w = \frac{\sum w_ix_i}{\sum w_i} }

Frequency-table mean

xˉ=∑fixi∑fi\boxed{ \bar{x} = \frac{\sum f_ix_i}{\sum f_i} }

Range

max⁡−min⁡\boxed{ \max-\min }

Median position for odd nn

n+12\boxed{ \frac{n+1}{2} }

Interquartile range

IQR=Q3−Q1\boxed{ IQR=Q_3-Q_1 }

Outlier fences

Q1−1.5IQR\boxed{ Q_1-1.5IQR } Q3+1.5IQR\boxed{ Q_3+1.5IQR }

72. Five-number-summary sheet

Always remember the order:
min⁡<Q1<Q2<Q3<max⁡\boxed{ \min < Q_1 < Q_2 < Q_3 < \max }
where:
Q2=median.Q_2=\text{median}.
Equalities can occur if the dataset contains repeated values.

73. Week 2 → Week 3 connection

Week 2 categorical data:
categories→counts/proportions\text{categories} \rightarrow \text{counts/proportions}
Week 3 numerical data:
numbers→center/spread/shape\text{numbers} \rightarrow \text{center/spread/shape}
So the type of variable determines the appropriate statistical summary.
That is the major theme from Weeks 1–3.

74. What you should actually master

By the end of Stats 1 Week 3, you should be able to:
  1. Calculate arithmetic mean.
  2. Calculate weighted mean.
  3. Calculate mean from a frequency table.
  4. Find median for odd/even sample sizes.
  5. Find mode.
  6. Explain how an outlier affects mean vs median.
  7. Calculate range.
  8. Interpret percentiles and quartiles.
  9. Calculate Q1,Q2,Q3Q_1,Q_2,Q_3 using the course convention.
  10. Calculate IQR.
  11. Write a five-number summary.
  12. Use the 1.5IQR1.5IQR rule for potential outliers.
  13. Distinguish symmetric, right-skewed, and left-skewed distributions.
  14. Choose mean vs median appropriately.
  15. Distinguish a histogram from a categorical bar chart.
If those are comfortable, Stats 1 Week 3 is under control.

Quick Recall & Flashcards

Test your active recall before proceeding to practice problems. Format:
Question :: Answer.
  • Week 3 Diagnostic: For the dataset [3, 7, 8, 5, 12, 14, 21, 13, 18], what is the median? :: Answer: 12 — Sorted dataset: [3, 5, 7, 8, 12, 13, 14, 18, 21]. With n = 9, the median is the 5th element: 12.
  • Week 3 Diagnostic: If a distribution has a third quartile Q3 = 45 and a first quartile Q1 = 25, what is the Interquartile Range (IQR)? :: Answer: 20 — IQR = Q3 - Q1 = 45 - 25 = 20.

Practice & Self-Check

Attempt these diagnostic questions to verify your operational understanding.
1

Question 1

For the dataset [3, 7, 8, 5, 12, 14, 21, 13, 18], what is the median?
NAT
3 Unit Assessment
2

Question 2

If a distribution has a third quartile Q3 = 45 and a first quartile Q1 = 25, what is the Interquartile Range (IQR)?
NAT
3 Unit Assessment

Active Recall Session

Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.