Estimates of Location
Arithmetic Mean
What it is: The sum of all values divided by the number of observations:
Why Mean: It answers the question: “What single value represents the fair, balanced center?”.
Data: API response times (in milliseconds) recorded from five stable production servers during a typical weekday: [140, 150, 152, 148, 155]. These measurements reflect normal traffic with no spikes or failures.
Report example: “Average system response time is 149 ms—sufficient headroom exists to handle 10× traffic growth without immediate upgrades.”
Python:
import numpy as np
data = [140, 150, 152, 148, 155]
print(np.mean(data)) # 149.0
R:
data <- c(140, 150, 152, 148, 155)
mean(data) # 149
Median
What it is: The middle value once the data is sorted (50 % of values lie below it, 50 % above).
Why median: It answers the question: “What single value splits my entire dataset exactly in half, with half the points above it and half below, no matter how loud a few extremes get?”
Data: Sale prices (in USD) of 5 homes sold last month in a mixed suburban neighborhood: [300000, 320000, 350000, 380000, 5000000]. The $5 M sale was a waterfront mansion; the rest were standard family homes.
Report example: “The typical home sold for $350,000—the middle-class segment of the market remains stable and predictable.”
Python:
import numpy as np
print(np.median([300000, 320000, 350000, 380000, 5000000])) # 350000.0
R:
median(c(300000, 320000, 350000, 380000, 5000000)) # 350000
Mode
What it is: The value that appears most frequently.
Why mode: It answers the question: “Which single value shows up more often than any other and therefore represents the most common experience in my data?”
Data: HTTP status codes logged by a web server over an 8-hour period: [200, 404, 404, 500, 404, 200, 429, 404].
Report example: “404 errors are the most frequent (4 out of 8 occurrences)—routing and URL configuration should be the top debugging priority.”
Python:
from scipy import stats
print(stats.mode([200, 404, 404, 500, 404, 200, 429, 404]).mode) # 404
R:
names(sort(table(c(200,404,404,500,404,200,429,404)), decreasing=TRUE))[1] # 404
Weighted Mean
What it is: Each value multiplied by its weight, then divided by the total weight:
Data: Final exam scores for two courses—Database Systems (90 points, 4 credits) and an elective (75 points, 2 credits).
Why this estimator: It answers the question: “What is the true center when certain observations deserve more influence because they carry greater importance or size?”
Report example: “Credit-weighted GPA is 86.0—reflects the real workload emphasis on core technical courses.”
Python:
import numpy as np
print(np.average([90, 75], weights=[4, 2])) # 86.0
R:
weighted.mean(c(90, 75), c(4, 2)) # 86
Weighted Median
What it is: The value where half the total weight lies above it and half below it (after sorting).
Data: Customer satisfaction scores (1–10 scale) from three client segments, weighted by annual revenue: scores [8, 6, 9] with revenues [100000, 50000, 1000000].
Why this estimator: It answers the question: “Where is the exact middle once I’ve given heavier observations the extra pull they deserve, without letting any single point completely take over?”
Report example: “Revenue-weighted client satisfaction is 9/10—VIP feedback is strong; smaller accounts are pulling the unweighted score lower.”
Python: (using pandas for illustration; production code often uses a dedicated weighted-median package)
import pandas as pd
s = pd.Series([8, 6, 9], index=[100, 50, 1000])
print(s.median()) # 8.0 (for simple demo; use weightedmedian library for full weighting)
R:
library(weightedmedian)
w.median(c(8, 6, 9), c(100, 50, 1000)) # 9
Percentile / Quantile
What it is: The value below which P % of the observations fall.
Data: End-user page-load times (ms): [100, 150, 200, 300, 2000]. The 2000 ms result came from one user on a very slow mobile connection.
Why this estimator: It answers the question: “What value sits at the exact point where P % of my data falls below it — letting me see the world from the perspective of the top (or bottom) slice of experiences?”
Report example: “The 99th-percentile response time reaches 2000 ms—tail latency is harming perceived performance.”
Python:
import numpy as np
print(np.percentile([100, 150, 200, 300, 2000], 99)) # 2000.0
R:
quantile(c(100, 150, 200, 300, 2000), 0.99) # 2000
Trimmed Mean
What it is: The mean calculated after removing the top and bottom α % of the data.
Data: Monthly rainfall totals (mm) for a city over five months: [20, 25, 30, 35, 500]. The 500 mm value was an extreme monsoon event.
Why this estimator: It answers the question: “What would the ordinary average look like if I simply ignored the most unusual extremes on both ends and focused only on the typical middle bulk of my data?”
Report example: “Trimmed-mean monthly rainfall is 27.5 mm—stable baseline for infrastructure sizing.”
Python:
from scipy import stats
print(stats.trim_mean([20, 25, 30, 35, 500], 0.2)) # 27.5
R:
mean(c(20, 25, 30, 35, 500), trim = 0.2) # 27.5
Midrange
What it is: The average of the minimum and maximum values:
Data: Measured lengths (cm) of bolts produced in a single manufacturing run under tight tolerances: [9.8, 10.0, 10.1, 10.2].
Why this estimator: It answers the question: “Exactly halfway between the smallest and largest possible values in my set — where is the simple center of the entire range my data can possibly occupy?”
Report example: “Machine target is centered at 10.0 cm—well within tolerance limits.”
Python:
import numpy as np
data = [9.8, 10.0, 10.1, 10.2]
print((np.min(data) + np.max(data)) / 2) # 10.0
R:
data <- c(9.8, 10.0, 10.1, 10.2)
(mean(range(data))) # 10
Geometric Mean
What it is: The nth root of the product of n values:
Data: Monthly growth factors for a startup’s user base: [1.1, 0.9, 1.2] (i.e., +10 %, –10 %, +20 %).
Why this estimator: It answers the question: “What single constant rate, when multiplied repeatedly across all periods, would produce exactly the same overall change I actually observed?”
Report example: “Monthly compound growth rate is 5 %—projects roughly 1.8× user growth over the year.”
Python:
import numpy as np
print(np.prod([1.1, 0.9, 1.2]) ** (1/3)) # ≈1.05
R:
exp(mean(log(c(1.1,0.9,1.2)))) # 1.05
Harmonic Mean
What it is: The reciprocal of the arithmetic mean of the reciprocals:
Data: Average speeds (km/h) for two equal-distance legs of a 200 km round trip: [60, 40].
Why this estimator: It answers the question: “What single rate would let me cover the total distance in exactly the same total time that my varying rates actually required?”
Report example: “True average speed for the round trip is 48 km/h—total travel time will be 2.5 hours.”
Python:
import numpy as np
print(1 / np.mean(1 / np.array([60, 40]))) # 48.0
R:
1 / mean(1 / c(60, 40)) # 48
Hodges-Lehmann Estimator (Robust)
What it is: The median of all possible pairwise averages of the data points.
Data: Blood-pressure readings (mmHg) taken during a clinical study: [120, 125, 130, 200, 80]. The 200 and 80 values were likely measurement or recording errors.
Why this estimator: It answers the question: “What typical value emerges when I look at the middle of every possible pair-average I can form — automatically softening the effect of any stray outliers without throwing data away?”
Report example: “Robust central reading is approximately 125 mmHg—outliers have been neutralized without discarding data.”
Python:
from itertools import combinations
import numpy as np
from scipy.stats import median
data = [120, 125, 130, 200, 80]
pair_avgs = [np.mean(pair) for pair in combinations(data, 2)]
print(median(pair_avgs)) # ≈125
R:
library(robustbase)
location.Mh(c(120, 125, 130, 200, 80)) # ~125Did I make a mistake? Please considerSend Email With Subject