Solved Exercises on Range and Interquartile Range (IQR)

Master measures of spread: range and IQR through these 5 detailed exercises covering calculation, interpretation, and application of variability measures.

Solution: Exercises 1 to 3
1 Basic Range and IQR Calculation
Exercise 1
Calculate the range and IQR for the following dataset representing test scores: 72, 78, 82, 85, 88, 90, 92, 95, 98, 100
Definition:

Range: The difference between the maximum and minimum values in a dataset.

Interquartile Range (IQR): The difference between the third quartile (Q3) and first quartile (Q1), representing the spread of the middle 50% of data.

Quartiles: Values that divide ordered data into four equal parts (Q1 = 25th percentile, Q2 = 50th percentile/median, Q3 = 75th percentile).

Calculation methods:
  1. Range: Maximum value - Minimum value
  2. Quartiles: Q1 = median of lower half, Q3 = median of upper half
  3. IQR: Q3 - Q1
Step 1: Identify min and max values

Data is already sorted: 72, 78, 82, 85, 88, 90, 92, 95, 98, 100

Minimum = 72, Maximum = 100

Step 2: Calculate the range

Range = Maximum - Minimum = 100 - 72 = 28

Step 3: Find Q1 (first quartile)

With 10 values (even), split into two halves: 72, 78, 82, 85, 88 and 90, 92, 95, 98, 100

Lower half: 72, 78, 82, 85, 88

Q1 = median of lower half = 82

Step 4: Find Q3 (third quartile)

Upper half: 90, 92, 95, 98, 100

Q3 = median of upper half = 95

Step 5: Calculate IQR

IQR = Q3 - Q1 = 95 - 82 = 13

Range = 28, IQR = 13
Final answer:

Range = 28, IQR = 13. The range shows the total spread from lowest to highest score, while the IQR shows the spread of the middle 50% of scores (between 82 and 95).

Applied rules:

• Range formula: Max - Min

• Quartile calculation: Q1 = median of lower half, Q3 = median of upper half

• IQR formula: Q3 - Q1

2 Comparing Range and IQR Sensitivity
Exercise 2
Compare the range and IQR for two datasets: A) 60, 70, 80, 90, 100 and B) 60, 70, 80, 90, 150. Explain which measure better represents the typical spread of the data.
Definition:

Robust measure: A measure that is not significantly affected by outliers or extreme values.

Outlier sensitivity: How much a measure changes when extreme values are present.

Step 1: Calculate for Dataset A (60, 70, 80, 90, 100)

Range = 100 - 60 = 40

Q1 = 65 (average of 60 and 70), Q3 = 95 (average of 90 and 100)

IQR = 95 - 65 = 30

Step 2: Calculate for Dataset B (60, 70, 80, 90, 150)

Range = 150 - 60 = 90

Q1 = 65 (average of 60 and 70), Q3 = 95 (average of 90 and 150)

IQR = 95 - 65 = 30

Step 3: Compare the measures

Range: Dataset A = 40, Dataset B = 90 (increased by 50)

IQR: Dataset A = 30, Dataset B = 30 (no change)

Step 4: Identify the outlier

The value 150 in Dataset B is an outlier compared to the other values

This affects the range but not the IQR

Step 5: Determine which measure is more representative

The IQR (30) better represents the typical spread because it's not affected by the outlier

The range is inflated by the extreme value

Range: A=40, B=90; IQR: A=30, B=30; IQR is more robust
Final answer:

Dataset A: Range = 40, IQR = 30; Dataset B: Range = 90, IQR = 30. The IQR better represents the typical spread because it's not affected by the outlier (150). The range increases significantly due to the outlier.

Applied rules:

• Range sensitivity: Affected by all values, especially outliers

• IQR robustness: Only affected by middle 50% of data

• Outlier impact: Range is more sensitive to extreme values

3 IQR and Data Distribution
Exercise 3
For the dataset: 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, calculate the range, IQR, and determine what percentage of data falls within the IQR.
Definition:

Percentile: A value below which a certain percentage of data falls.

Quartile range: The interval between Q1 and Q3 containing 50% of the data.

Step 1: Identify min and max values

Data is sorted: 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70

Minimum = 15, Maximum = 70

Step 2: Calculate the range

Range = 70 - 15 = 55

Step 3: Find Q1 (first quartile)

With 12 values, split into two halves: 15, 20, 25, 30, 35, 40 and 45, 50, 55, 60, 65, 70

Lower half: 15, 20, 25, 30, 35, 40

Q1 = median of lower half = (25 + 30) ÷ 2 = 27.5

Step 4: Find Q3 (third quartile)

Upper half: 45, 50, 55, 60, 65, 70

Q3 = median of upper half = (55 + 60) ÷ 2 = 57.5

Step 5: Calculate IQR and percentage

IQR = Q3 - Q1 = 57.5 - 27.5 = 30

Number of values in IQR range (27.5 to 57.5): 30, 35, 40, 45, 50, 55 → 6 values

Percentage = (6 ÷ 12) × 100% = 50%

Range = 55, IQR = 30, 50% of data in IQR
Final answer:

Range = 55, IQR = 30. Exactly 50% of the data (6 out of 12 values) falls within the IQR. This confirms that the IQR always contains the middle 50% of the data.

Applied rules:

• IQR definition: Always contains middle 50% of data

• Quartile calculation: Q1 = 25th percentile, Q3 = 75th percentile

• Percentile interpretation: 50% of data between Q1 and Q3

Range and IQR Comparison
\text{Range} = \text{Maximum} - \text{Minimum}
Range Formula
Range
Max - Min
Full Spread
Affected by outliers
IQR
Q3 - Q1
Middle 50%
Robust to outliers
Quartiles
Q1 = 25th %
Q3 = 75th %
Divide data in 4 parts
Key definitions:

Measures of spread: Statistical measures that describe how data values are distributed or dispersed.

Range: The simplest measure of spread, calculated as the difference between maximum and minimum values.

Interquartile Range (IQR): The range of the middle 50% of data, calculated as Q3 - Q1.

When to use each measure:
  1. Range: For a quick overview of total spread, when outliers are not present
  2. IQR: When you want to measure spread of the central data, when outliers are present
Tip 1: Always sort data before finding quartiles.
Tip 2: IQR is robust to outliers, unlike the range.
Tip 3: IQR always contains the middle 50% of data.
Tip 4: Range uses only two values, IQR uses the middle half.
Range Properties: Simple to calculate, affected by outliers, uses only min/max values, sensitive to data changes.
IQR Properties: Robust to outliers, represents middle 50%, less sensitive to extreme values, focuses on central data.
Key principles:

• Range sensitivity: Affected by all values, especially outliers

• IQR robustness: Only affected by middle 50% of data

• Quartile division: Q1 (25%), Q2 (50%), Q3 (75%) percentiles

Solution: Exercises 4 to 5
4 Transformation Effects on Spread
Exercise 4
If a dataset has a range of 40 and an IQR of 15, what are the new range and IQR if we add 10 to each value? What if we multiply each value by 3?
Definition:

Linear transformation: Adding or subtracting a constant to each value in a dataset.

Scaling transformation: Multiplying or dividing each value in a dataset by a constant.

Step 1: Understand the original measures

Original range = 40, IQR = 15

Let's say min = x, max = x + 40, so range = (x + 40) - x = 40

Let's say Q1 = y, Q3 = y + 15, so IQR = (y + 15) - y = 15

Step 2: Apply linear transformation (add 10 to each value)

New min = x + 10, New max = (x + 40) + 10 = x + 50

New range = (x + 50) - (x + 10) = 40 (unchanged)

New Q1 = y + 10, New Q3 = (y + 15) + 10 = y + 25

New IQR = (y + 25) - (y + 10) = 15 (unchanged)

Step 3: Apply scaling transformation (multiply each value by 3)

New min = 3x, New max = 3(x + 40) = 3x + 120

New range = (3x + 120) - 3x = 120 (multiplied by 3)

New Q1 = 3y, New Q3 = 3(y + 15) = 3y + 45

New IQR = (3y + 45) - 3y = 45 (multiplied by 3)

Step 4: State the general rules

For linear transformation (adding constant c):

• Range_new = Range_original

• IQR_new = IQR_original

For scaling transformation (multiplying by constant c):

• Range_new = Range_original × c

• IQR_new = IQR_original × c

Step 5: Verify with original values

Adding 10: Range stays 40, IQR stays 15

Multiplying by 3: Range becomes 40×3 = 120, IQR becomes 15×3 = 45

Adding 10: Range=40, IQR=15; Multiplying by 3: Range=120, IQR=45
Final answer:

Adding 10 to each value: Range = 40, IQR = 15 (both unchanged). Multiplying each value by 3: Range = 120, IQR = 45 (both multiplied by 3). Linear transformations don't affect spread measures, but scaling transformations do.

Applied rules:

• Linear transformation: Spread measures remain unchanged

• Scaling transformation: Spread measures scale by the same factor

• Translation invariance: Adding constants doesn't change spread

5 Real-World Application
Exercise 5
A company tracks daily sales (in thousands of dollars) over 12 days: 18, 22, 25, 28, 30, 32, 35, 38, 40, 42, 45, 120. The last day was Black Friday. Calculate range and IQR. Which better represents typical daily sales variation?
Definition:

Business context: Applying statistical measures to practical business situations.

Typical variation: The usual range of fluctuations in business metrics.

Step 1: Calculate the range

Data is sorted: 18, 22, 25, 28, 30, 32, 35, 38, 40, 42, 45, 120

Minimum = 18, Maximum = 120

Range = 120 - 18 = 102 thousand dollars

Step 2: Calculate Q1 and Q3

Split into two halves: 18, 22, 25, 28, 30, 32 and 35, 38, 40, 42, 45, 120

Lower half: 18, 22, 25, 28, 30, 32

Q1 = (25 + 28) ÷ 2 = 26.5

Upper half: 35, 38, 40, 42, 45, 120

Q3 = (40 + 42) ÷ 2 = 41

Step 3: Calculate IQR

IQR = Q3 - Q1 = 41 - 26.5 = 14.5 thousand dollars

Step 4: Identify the outlier

The value 120 is significantly higher than other values

This represents the Black Friday sales spike

Step 5: Determine which measure is more representative

Range = 102 (heavily influenced by the outlier)

IQR = 14.5 (focuses on regular business days)

The IQR better represents typical daily variation

Range = 102k, IQR = 14.5k; IQR better represents typical variation
Final answer:

Range = $102,000, IQR = $14,500. The IQR better represents typical daily sales variation because it excludes the outlier (Black Friday sales). The range is inflated by the extreme value and doesn't reflect regular business patterns.

Applied rules:

• Outlier impact: Range is highly sensitive to extreme values

• IQR robustness: Not affected by outliers in tails

• Business decision-making: Choose measures that reflect typical conditions

Comprehensive Guide to Range and IQR
\text{IQR} = Q3 - Q1
IQR Formula
Key definitions:

Range: The difference between the maximum and minimum values in a dataset. Simplest measure of spread.

Interquartile Range (IQR): The difference between the third quartile (Q3) and first quartile (Q1), representing the spread of the middle 50% of data.

Quartiles: Values that divide ordered data into four equal parts: Q1 (25th percentile), Q2 (50th percentile/median), Q3 (75th percentile).

Measures of spread: Statistical measures that describe how data values are distributed or dispersed around the center.

Calculation procedures:
  1. Range calculation: Find maximum and minimum values, subtract minimum from maximum
  2. Quartile calculation: Arrange data in order, find Q1 (median of lower half) and Q3 (median of upper half)
  3. IQR calculation: Subtract Q1 from Q3
Tip 1: Always arrange data in ascending order before finding quartiles.
Tip 2: IQR is resistant to outliers, making it more robust than range.
Tip 3: IQR always contains exactly 50% of the data values.
Tip 4: Range only uses two data points, while IQR uses the middle half.
Tip 5: For symmetric distributions, Q1 and Q3 are equidistant from the median.
Tip 6: IQR is fundamental for identifying outliers (values beyond Q1-1.5×IQR or Q3+1.5×IQR).
Range Properties: Simple to calculate, affected by all values, sensitive to outliers, uses only min/max values, gives total spread of data.
IQR Properties: Robust to outliers, represents middle 50% of data, less sensitive to extreme values, focuses on central dispersion, commonly used in box plots.
Quartile Properties: Divide data into four equal parts, Q2 is the median, Q1 and Q3 mark boundaries of middle 50%, useful for identifying data distribution shape.
Transformation and comparison rules:

• Linear transformation (adding constant c): Range_new = Range_orig, IQR_new = IQR_orig

• Scaling transformation (multiplying by constant c): Range_new = Range_orig × c, IQR_new = IQR_orig × c

• Outlier sensitivity: Range is highly sensitive to outliers, IQR is robust to outliers

• Data usage: Range uses 2 values, IQR uses 50% of data values

Range and IQR Visualization
Understanding Spread Measures
Key characteristics of spread measures:
Range: Total spread, affected by outliers
IQR: Middle 50% spread, robust to outliers
Quartiles: Divide data into 4 equal parts
Choose based on data characteristics and purpose

Analysis: Different measures of spread provide different perspectives on data variability.

  • Range: Total spread from min to max, sensitive to outliers
  • IQR: Middle 50% of data, robust to extreme values
  • Quartiles: Boundary values for data quarters
  • Selection: Depends on distribution shape and analysis goals

Questions & Answers

Question: How do I decide whether to use range or IQR to describe the spread of my data? What factors should I consider?

Answer: The choice depends on several key factors:

  • Data distribution: Use IQR for skewed data or when outliers are present
  • Presence of outliers: Use IQR when outliers are present (range gets inflated)
  • Analysis purpose: Use range for a quick overview, IQR for detailed analysis
  • Data size: For small datasets, range might be sufficient; for larger datasets, IQR is more informative

Decision framework:

  • If data is symmetric with no outliers → Either range or IQR is acceptable
  • If data is skewed or has outliers → IQR is better
  • If you need a quick measure → Range is simplest
  • If you want robust measure → IQR is more reliable

For example, salary data often has high earners that inflate the range, so IQR provides a better measure of typical salary variation.

Question: What happens to range and IQR when I transform my data? Do they change in the same way?

Answer: Range and IQR respond differently to transformations:

  • Linear transformation (adding/subtracting constant c): Both range and IQR remain unchanged
  • Scaling transformation (multiplying/dividing by constant c): Both range and IQR are multiplied by the same factor c

Example: Original data has range = 20, IQR = 8

After adding 5 to each value: New range = 20, IQR = 8 (unchanged)

After multiplying each value by 2: New range = 40, IQR = 16 (both doubled)

Both measures are affected similarly by scaling transformations but not by linear transformations.

Question: How do I find quartiles when the dataset has an even number of values? Is the process different from odd numbers?

Answer: The process is similar but with slight differences:

  • Odd number of values: The median is the actual middle value; split the data into two halves excluding the median
  • Even number of values: The median is the average of the two middle values; split the data into two equal halves including both middle values

Example with odd n=7: 10, 20, 30, 40, 50, 60, 70

Median = 40, Lower half: 10, 20, 30 → Q1 = 20, Upper half: 50, 60, 70 → Q3 = 60

Example with even n=8: 10, 20, 30, 40, 50, 60, 70, 80

Lower half: 10, 20, 30, 40 → Q1 = (20+30)/2 = 25, Upper half: 50, 60, 70, 80 → Q3 = (60+70)/2 = 65

The key is to always divide the ordered data into two equal halves to find Q1 and Q3.

Question: Why is IQR considered more robust than range? Can you explain this concept?

Answer: IQR is more robust because it only considers the middle 50% of data:

  • Range uses: Only the two extreme values (minimum and maximum)
  • IQR uses: The middle 50% of data between Q1 and Q3
  • Outlier impact: Range is heavily influenced by outliers, IQR ignores them

Example: Dataset A: 10, 15, 20, 25, 30 (range = 20, IQR = 10)

Dataset B: 10, 15, 20, 25, 100 (range = 90, IQR = 10)

The outlier (100) dramatically increases the range but doesn't affect the IQR.

Robustness benefits:

  • IQR provides a more stable measure of spread
  • Less affected by data entry errors
  • Better represents the typical variation in the data
  • More reliable for comparing different datasets

Question: Should I report just one measure of spread or multiple measures when presenting my findings?

Answer: Best practice is to report multiple measures when they provide different insights:

  • Report both range and IQR: This gives readers information about total spread and central spread
  • Include context: Explain what each measure tells about your data
  • Highlight differences: If range >> IQR, mention potential outliers

Example reporting: "The data ranged from $15,000 to $85,000 (range = $70,000), with the middle 50% of values falling between $30,000 and $50,000 (IQR = $20,000)."

Benefits of multiple measures:

  • Readers can assess the presence of outliers
  • More complete picture of data distribution
  • Allows for different interpretations
  • Highlights differences between total and central spread

However, always prioritize the measure that best serves your research question or analysis purpose.