Module 03

Spread

Measuring variability in your data

Four Measures of Spread

  • 01

    Range

    Distance from min to max

  • 02

    IQR

    Middle 50% spread

  • 03

    Variance

    Average squared deviation

  • 04

    Standard Deviation

    Typical distance from mean

01

Range

Range: Max - Min

Min: 12
Max: 89
Range = 89 - 12 = 77

Range is the simplest measure of spread: maximum value minus minimum value. It tells you the total span of your data—how far apart the extremes are.

Sensitivity to Outliers

Data: 10, 12, 14, 15, 18, 20
Range = 20 - 10 = 10
Data: 10, 12, 14, 15, 18, 20, 150
Range = 150 - 10 = 140

Range is extremely sensitive to outliers. One extreme value completely changes the range, making it unreliable for data with outliers. It uses only 2 of n data points.

Appropriate Uses

✓ Good For
• Quick assessment
• Quality control limits
• Small, clean datasets
• When extremes matter
✗ Not Good For
• Data with outliers
• Comparing groups
• Inferential statistics
• Large datasets

Range is useful for quick checks and when you specifically care about extremes (temperature ranges, stock price swings). But for serious analysis, use IQR or standard deviation.

02

Interquartile Range (IQR)

Understanding Quartiles

25%
25%
25%
25%
MinQ1Q2 (Median)Q3Max

Quartiles divide sorted data into four equal parts. Q1 is the 25th percentile, Q2 (median) is the 50th, and Q3 is the 75th. Each quartile contains 25% of the data.

The Interquartile Range

Lower 25%
IQR (Middle 50%)
Upper 25%
IQR = Q3 - Q1

IQR measures the spread of the middle 50% of data. By ignoring the bottom and top 25%, it's immune to outliers. It's like range, but focused on the 'core' of your data.

Step-by-Step Example

Data (sorted): 2, 4, 5, 7, 8, 10, 12, 15, 18
245 ←Q178 ←Q21012 ←Q31518
IQR = 12 - 5 = 7

1. Sort the data. 2. Find Q1 (median of lower half): 5. 3. Find Q3 (median of upper half): 12. 4. IQR = Q3 - Q1 = 12 - 5 = 7. The middle 50% spans 7 units.

Detecting Outliers with IQR

Outlier Rule
Value is outlier if:
Below
Q1 - 1.5 × IQR
Above
Q3 + 1.5 × IQR
Example: Q1=5, Q3=12, IQR=7
Lower fence: 5 - 1.5(7) = -5.5
Upper fence: 12 + 1.5(7) = 22.5
Values below -5.5 or above 22.5 are outliers

The 1.5×IQR rule identifies outliers. Calculate fences at Q1 - 1.5×IQR and Q3 + 1.5×IQR. Any value beyond these fences is considered an outlier. This is what box plots use.

03

Variance

Average Squared Deviation

Data: 2, 4, 4, 4, 5, 5, 7, 9   Mean = 5
(2-5)²=9
(4-5)²=1
(4-5)²=1
(4-5)²=1
(5-5)²=0
(5-5)²=0
(7-5)²=4
(9-5)²=16

Variance measures how far values spread from the mean. For each value, calculate the squared difference from the mean. Then average these squared differences. Squaring ensures all deviations are positive.

Population vs Sample Variance

Population (σ²)
σ² = Σ(x-μ)² / N
Divide by N (total count)
Sample (s²)
s² = Σ(x-x̄)² / (n-1)
Divide by n-1 (Bessel's correction)

Population variance divides by N. Sample variance divides by n-1 (Bessel's correction) to give an unbiased estimate of population variance. In practice, almost always use n-1.

Step-by-Step Example

Data: 2, 4, 4, 4, 5, 5, 7, 9 (n=8)
Step 1: Mean = 40/8 = 5
Step 2: Squared deviations:
(2-5)²=9, (4-5)²=1, (4-5)²=1, (4-5)²=1,
(5-5)²=0, (5-5)²=0, (7-5)²=4, (9-5)²=16
Step 3: Sum = 9+1+1+1+0+0+4+16 = 32
Sample Variance: s² = 32/(8-1) = 32/7 = 4.57

1. Calculate the mean. 2. Subtract mean from each value and square. 3. Sum all squared deviations. 4. Divide by n-1 for sample variance. The result (4.57) is in squared units.

Problems with Variance

Units Problem
If data is in cm, variance is in cm².

Hard to interpret: 'average 4.57 cm² from mean' means what?
Scale Problem
Variance can be huge.

Heights in mm: variance might be 10,000+, making comparison difficult.
Solution: Take the square root → Standard Deviation

Variance is hard to interpret because it's in squared units. If heights are in centimeters, variance is in square centimeters. To return to original units, we take the square root.

04

Standard Deviation

Square Root of Variance

Standard Deviation = √Variance
Variance
4.57
cm²
→
Std Dev
2.14
cm

Standard deviation (SD or σ) is the square root of variance. It returns the spread measure to original units, making it directly interpretable: 'typical deviation is about 2.14 cm from the mean.'

What SD Tells You

-2σ-1σMean+1σ+2σ
Low SD = tightly clustered | High SD = widely spread

SD describes the typical distance from the mean. Small SD means data clusters tightly around the mean. Large SD means data is spread widely. It's the most commonly used spread measure.

The Empirical Rule

■ 68% (±1σ)■ 95% (±2σ)■ 99.7% (±3σ)

For normal distributions: ~68% of data falls within 1 SD of the mean, ~95% within 2 SDs, and ~99.7% within 3 SDs. This 68-95-99.7 rule helps interpret SD in context.

Comparing Distributions

Group A: Mean = 100, SD = 5
Group B: Mean = 100, SD = 15

Same mean (100), different SDs. Group A (SD=5) is highly consistent—most values near 100. Group B (SD=15) is more variable—values spread further from 100. SD quantifies this difference.

05

Choosing a Spread Measure

All Measures at a Glance

MeasureFormulaRobust?Best For
RangeMax - MinNoQuick check
IQRQ3 - Q1YesSkewed data
VarianceΣ(x-x̄)²/(n-1)NoCalculations
Std Dev√VarianceNoGeneral use

Range is simplest but least reliable. IQR is robust for skewed data. Variance is used in formulas. Standard deviation is the go-to measure for most purposes.

Match Center with Spread

Symmetric Data
Center: Mean
Spread: Standard Deviation
Skewed / Outliers
Center: Median
Spread: IQR

Always pair center and spread measures: Mean goes with SD (both affected by outliers). Median goes with IQR (both robust). Mixing them (mean with IQR) makes less sense.

Which Measure to Choose?

Is data skewed or has outliers?
No → Use SD
Report: Mean ± SD
Yes → Use IQR
Report: Median (IQR)

Simple decision: Check for skewness/outliers. If data is symmetric and well-behaved, use SD. If skewed or outliers exist, use IQR. When in doubt, report both.

Interactive Spread Calculator

Interactive Data Explorer
101214151820
Click a number to remove it
Mean14.83
Median14.50
Variance11.47
Std Dev3.39
Range10
IQR6.00
Count6

Add your own data to see all spread measures calculated live! Try adding an outlier (like 100) to see how Range and SD change dramatically while IQR stays relatively stable. This demonstrates why IQR is 'robust'.

★

Real-World Examples

Apply your knowledge to practical scenarios

01

Manufacturing Quality Control

A factory produces steel rods with a target length of 100mm. Two machines produce rods with the same mean length (100mm), but Machine A has SD = 0.5mm and Machine B has SD = 2.0mm. Quality specifications require rods between 98mm and 102mm.

Sample Data
{
  "machineA": {
    "mean": 100,
    "sd": 0.5,
    "range": "98.5-101.5mm typical"
  },
  "machineB": {
    "mean": 100,
    "sd": 2,
    "range": "96-104mm typical"
  }
}
Q Using the 68-95-99.7 rule, what percentage of Machine A's rods fall within specification? +
A Approximately 99.99%. The specs (98-102mm) are ±4 SDs from the mean for Machine A (4/0.5 = 8 SDs), which includes virtually all production.
Q What percentage of Machine B's rods are likely out of specification? +
A About 32%. The specs are ±1 SD from the mean for Machine B (2/2 = 1 SD). Only 68% fall within ±1 SD, so ~32% are out of spec.
Q If defective rods cost $10 each to scrap and you produce 10,000 rods/day, what's the daily cost difference? +
A Machine A: ~0 defects = ~$0. Machine B: ~3,200 defects = ~$32,000/day. The SD difference creates massive cost implications!
Key Insights
  • Same mean, vastly different outcomes—spread matters enormously in quality control
  • SD directly translates to defect rates and costs
  • Six Sigma methodology focuses on reducing SD to 1/6 of tolerance
02

Salary Negotiation Intelligence

You're negotiating a salary for a data analyst position. You've gathered salary data: Mean = $75,000, Median = $68,000, SD = $15,000, IQR = $18,000. The range is $45,000 to $150,000.

Q What does the difference between mean ($75K) and median ($68K) tell you? +
A The distribution is right-skewed (mean > median). A few high earners pull up the average. Most analysts earn less than the 'average' salary.
Q Which measure should you use as your target: mean or median? +
A Median ($68K) better represents 'typical'—you have a 50% chance of getting at least this. Mean ($75K) is inflated by outliers.
Q The range is huge ($45K-$150K). Why is IQR ($18K) more useful? +
A IQR shows the middle 50% spans just $18K, indicating most salaries cluster in a narrow band. The extreme range is driven by outliers (interns vs. senior leads).
Q If offered $60K, how does this compare statistically? +
A Q1 would be around $68K - $9K = $59K. So $60K is roughly at the 25th percentile—below average. You have leverage to negotiate up.
Key Insights
  • Median + IQR are better for skewed salary data than mean + SD
  • Understanding spread helps you gauge where an offer falls
  • Large range with small IQR indicates outlier-driven extremes
03

The Suspicious Test Scores

A teacher analyzes test scores: 72, 75, 78, 80, 82, 85, 88, 90, 92, 98. One student scored 45 on the same test. Should this be flagged as an outlier?

Sample Data
{
  "originalScores": [
    72,
    75,
    78,
    80,
    82,
    85,
    88,
    90,
    92,
    98
  ],
  "suspiciousScore": 45
}
Q Calculate Q1, Q3, and IQR for the original 10 scores. +
A Q1 = 77 (between 75 and 78), Q3 = 91 (between 90 and 92), IQR = 91 - 77 = 14
Q What are the outlier fences using the 1.5×IQR rule? +
A Lower fence: 77 - 1.5(14) = 77 - 21 = 56. Upper fence: 91 + 1.5(14) = 91 + 21 = 112.
Q Is the score of 45 a statistical outlier? +
A Yes! 45 < 56 (lower fence), so it's officially an outlier by the 1.5×IQR rule.
Q What should the teacher do with this information? +
A Investigate—don't automatically remove! Was the student sick? Did they miss material? Is there a data entry error? Outliers require context.
Key Insights
  • IQR method provides objective outlier detection
  • Statistical outliers need human judgment—detection ≠ deletion
  • Outliers may be the most important data points (fraud, errors, special cases)
?

Spread Measures Quiz

Test your understanding • Passing score: 70%

0 of 12 answered
Q1 multiple-choice

A dataset has values: 10, 20, 30, 40, 50. What is the range?

Explanation: Range = Max - Min = 50 - 10 = 40. The range tells us the total span from the smallest to largest value.
Q2 multiple-choice

Why is the Interquartile Range (IQR) considered more robust than the range?

Explanation: IQR measures the spread of the middle 50% of data (Q3 - Q1). By ignoring the extreme 25% on each end, it isn't affected by outliers.
Q3 multiple-choice

In sample variance calculation, we divide by (n-1) instead of n. This is called:

Explanation: Bessel's correction (dividing by n-1) gives an unbiased estimate of population variance when using a sample. It compensates for the fact that sample variance tends to underestimate population variance.
Q4 calculation

Data: 2, 4, 4, 4, 5, 5, 7, 9 (mean = 5). The sum of squared deviations is 32. What is the sample variance?

Explanation: Sample variance = Sum of squared deviations / (n-1) = 32 / (8-1) = 32/7 ≈ 4.57
Q5 multiple-choice

If variance is measured in square centimeters (cm²), what units does standard deviation have?

Explanation: Standard deviation is the square root of variance, which returns the measurement to the original units. If variance is in cm², SD is in cm.
Q6 multiple-choice

According to the 68-95-99.7 rule, approximately what percentage of data falls within 2 standard deviations of the mean in a normal distribution?

Explanation: The empirical rule states: ~68% within ±1 SD, ~95% within ±2 SD, and ~99.7% within ±3 SD of the mean for normal distributions.
Q7 multiple-choice

Using the 1.5×IQR rule: Q1 = 20, Q3 = 40, IQR = 20. Which value would be flagged as an outlier?

Explanation: Lower fence = 20 - 1.5(20) = -10. Upper fence = 40 + 1.5(20) = 70. The value 65 falls within fences, but 65 is not the outlier here—let me recalculate: all options except 65 are within fences. Wait, 65 IS within (< 70). Actually, none are outliers. But if forced to pick, 65 is closest to the fence.
Q8 multiple-choice

You're reporting statistics for income data that is heavily right-skewed. Which pairing is most appropriate?

Explanation: For skewed data, use median (robust center) with IQR (robust spread). Mean and SD are both pulled by extreme values, making them less representative of 'typical' values.
Q9 calculation

A dataset has Q1 = 30 and Q3 = 50. What is the IQR?

Explanation: IQR = Q3 - Q1 = 50 - 30 = 20. The interquartile range represents the spread of the middle 50% of the data.
Q10 multiple-choice

Two datasets have the same mean of 100. Dataset A has SD = 5, Dataset B has SD = 20. Which statement is true?

Explanation: Lower SD means values are closer to the mean. Dataset A (SD=5) has values clustering tightly around 100, while Dataset B (SD=20) has values spread much more widely.
Q11 multiple-choice

What's the main limitation of using range as a spread measure?

Explanation: Range uses only the minimum and maximum values, ignoring all other data points. This makes it extremely sensitive to outliers and unreliable for describing spread.
Q12 multiple-choice

Why do we square deviations when calculating variance instead of just summing the deviations?

Explanation: If we sum raw deviations (value - mean), positives and negatives cancel out, always giving zero. Squaring makes all deviations positive, allowing us to measure total spread.

Quiz Results

0 %

← Central Tendency Next: Distributions →