Skip to content

03-02: Exercises — Weighted and Grouped Means

Notes reference: 03-02: Weighted and Grouped Means


Q1: Weighted course grade

A course is graded: homework 20%, midterm 30%, project 15%, final 35%. A student scores 92, 78, 88, 84.

Find the final grade.

Solution

Component x w w·x
Homework 92 0.20 18.40
Midterm 78 0.30 23.40
Project 88 0.15 13.20
Final 84 0.35 29.40
Total 1.00 84.40
Final grade = 84.40 / 1.00 = 84.4

The unweighted average of 92, 78, 88, 84 is 85.5 — too high, because it over-weights the 15% project and under-weights the 35% final.

=SUMPRODUCT(B2:B5, C2:C5)/SUM(C2:C5)      ' 84.4
weighted.mean(c(92,78,88,84), c(.20,.30,.15,.35))
np.average([92,78,88,84], weights=[.20,.30,.15,.35])

Q2: GPA

Course Credits Grade Points
Statistics 4 A 4.0
Chemistry 4 C 2.0
History 3 B 3.0
Seminar 1 A 4.0
PE 2 B 3.0

Solution

Σ(w·x) = 4(4.0) + 4(2.0) + 3(3.0) + 1(4.0) + 2(3.0)
       = 16 + 8 + 9 + 4 + 6
       = 43

Σw     = 4 + 4 + 3 + 1 + 2 = 14

GPA    = 43 / 14 = 3.071

The unweighted mean of the grade points (4, 2, 3, 4, 3) is 3.20 — inflated by the 1-credit seminar counting as much as the 4-credit chemistry course.


Q3: Combining group means

Store n Mean sale ($)
Downtown 120 48.50
Suburb 85 62.30
Airport 45 91.75

Find the overall mean sale.

Solution

Σ(n·x̄) = 120(48.50) + 85(62.30) + 45(91.75)
        = 5,820.00 + 5,295.50 + 4,128.75
        = 15,244.25

Σn     = 120 + 85 + 45 = 250

Overall mean = 15,244.25 / 250 = $60.98

The plain average of the three means is (48.50+62.30+91.75)/3 = $67.52$6.54 too high, because the smallest store has the biggest average sale.

=SUMPRODUCT(B2:B4, C2:C4)/SUM(B2:B4)      ' 60.977

Q4: Mean and standard deviation from a frequency table

Class f
10–19 3
20–29 4
30–39 8
40–49 7
50–59 5
60–69 3

Solution

Class f Xm f·Xm (Xm−x̄) f(Xm−x̄)²
10–19 3 14.5 43.5 −25.333 1925.33
20–29 4 24.5 98.0 −15.333 940.44
30–39 8 34.5 276.0 −5.333 227.56
40–49 7 44.5 311.5 4.667 152.44
50–59 5 54.5 272.5 14.667 1075.56
60–69 3 64.5 193.5 24.667 1825.33
Total 30 1195.0 6146.67
x̄  = 1195.0 / 30 = 39.833

s² = 6146.67 / (30 − 1) = 211.954
s  = √211.954 = 14.559
' lower limits D2:D7, upper limits E2:E7, frequencies F2:F7
=(D2+E2)/2                                        ' G2: Xm
=SUMPRODUCT(F2:F7, G2:G7)/SUM(F2:F7)              ' mean -> 39.833
=SQRT(SUMPRODUCT(F2:F7,(G2:G7-$J$1)^2)/(SUM(F2:F7)-1))   ' s -> 14.559
f  <- c(3, 4, 8, 7, 5, 3)
Xm <- c(14.5, 24.5, 34.5, 44.5, 54.5, 64.5)
n  <- sum(f)
xbar <- sum(f * Xm) / n;                    xbar   # 39.833
s    <- sqrt(sum(f * (Xm - xbar)^2) / (n-1)); s    # 14.559

# Or expand and use the ordinary functions
raw <- rep(Xm, f); mean(raw); sd(raw)

Q5: Grouped median

Using the Q4 table, find the median.

Solution

n/2 = 15

Cumulative f:  3, 7, 15, 22, 27, 30
First class whose cumulative f reaches 15 is 30–39 (cum f = 15)

L  = 29.5   (lower BOUNDARY of the median class)
CF = 7      (cumulative frequency BEFORE the median class)
f  = 8      (frequency of the median class)
w  = 10

                 (15 − 7)
median = 29.5 + ─────────── × 10  =  29.5 + 10.0  =  39.5
                     8

The median (39.5) sits just below the mean (39.83) — mild right skew, consistent with the longer upper tail.


Q6: Grouped mode

Using the Q4 table, find the modal class and the grouped mode.

Solution

Modal class = 30–39   (highest frequency, f = 8)

L  = 29.5
d₁ = 8 − 4 = 4        (modal f − previous f)
d₂ = 8 − 7 = 1        (modal f − next f)
w  = 10

                4
mode = 29.5 + ─────── × 10  =  29.5 + 8.0  =  37.5
               4 + 1
Summary for this distribution:
  mode   = 37.5
  median = 39.5
  mean   = 39.83
  mode < median < mean   →  RIGHT-SKEWED

Q7: Geometric mean for growth

An investment returns +25%, −20%, +30%, −10% over four years.

Find the arithmetic and geometric mean annual return, and say which is honest.

Solution

Growth factors:  1.25,  0.80,  1.30,  0.90

Arithmetic mean of the RETURNS = (25 − 20 + 30 − 10)/4 = 25/4 = +6.25% per year

Geometric mean of the FACTORS  = (1.25 × 0.80 × 1.30 × 0.90)^(1/4)
                               = (1.17)^(0.25)
                               = 1.04005
                               →  +4.01% per year

Verify with the actual ending value:
  $1,000 × 1.25 × 0.80 × 1.30 × 0.90 = $1,170
  $1,000 × (1.04005)^4               = $1,170   ✓
  $1,000 × (1.0625)^4                = $1,274   ✗  (overstates by $104)

The GEOMETRIC mean is the honest figure for growth rates.
=GEOMEAN(B2:B5)-1          ' B2:B5 hold 1.25, 0.80, 1.30, 0.90 -> 0.04005
prod(c(1.25,0.80,1.30,0.90))^(1/4) - 1     # 0.04005
from scipy import stats
stats.gmean([1.25, 0.80, 1.30, 0.90]) - 1   # 0.04005

Q8: Harmonic mean for rates

A driver covers 120 km at 60 km/h, then the same 120 km back at 40 km/h.

What is the average speed for the round trip?

Solution

WRONG:  (60 + 40)/2 = 50 km/h

RIGHT:  total distance / total time
        time out    = 120/60 = 2.0 hours
        time back   = 120/40 = 3.0 hours
        total       = 240 km in 5.0 hours
        average     = 240/5 = 48 km/h

This is exactly the HARMONIC mean:
        H = 2 / (1/60 + 1/40) = 2 / (0.016667 + 0.025) = 2 / 0.041667 = 48
=HARMEAN(60, 40)      ' 48
2 / sum(1/c(60, 40))  # 48

Rule: use the harmonic mean when averaging rates over a fixed quantity (same distance, same workload, same dollar amount).


⬅️ Previous: 03-01: Exercises — Mean, Median and Mode ➡️ Next: 04-01: Exercises — Measures of Variation