411 REFERENCE · Wikibooks
Statistics for Sociologists/Chapter 8: Measures of Central Tendency
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Chapter 8: Measures of Central Tendency
If someone asks you "what's typical here?" about a pile of numbers, you have three honest ways to answer, and — this is the part introductory statistics courses sometimes rush past — they are not interchangeable. Choosing the wrong one doesn't just give you a slightly different number. It can give you a number that actively misleads whoever's listening. This chapter is about mean, median, and mode: what each one actually tells you, and the specific circumstances under which each one is the right tool for the job.
Mode: The Most Common Value
The mode is simply the value that occurs most often. It's the only measure of central tendency that works on nominal data — you can find the modal religion, the modal marital status, the modal region, because "most common category" makes sense even when "order" and "distance between values" do not.
Here's a genuinely funny R quirk worth knowing about before it wastes twenty minutes of your life: R has no built-in function called mode() that computes the statistical mode. There is a function called mode() in base R — it exists, it runs, it returns an answer — but it tells you the storage mode of an object (whether something is "numeric", "character", and so on), which has nothing whatsoever to do with the statistic you're looking for. Every introductory R user eventually runs mode(x) expecting a most-common-value and receives, with total and unhelpful confidence, the word "numeric" instead. This isn't a bug. It's just an unfortunate naming collision decades in the making, and the fix is to write your own small function:
get_mode <- function(x) {
x <- x[!is.na(x)]
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
get_mode(gss$MARITAL)
Four lines, and you've built the function the language declined to give you. Welcome to a surprisingly large fraction of applied statistical programming.
Median: The Middle Value
The median is the value that splits an ordered dataset exactly in half — as many cases above it as below. It requires at minimum ordinal data (you need to be able to put values in order), but is typically only applied to interval or ratio variables. It has one enormously useful property: it's resistant to outliers. A single extreme value barely moves the median, because the median only cares about position in the ordered list, not magnitude.
median(gss$EDUC, na.rm = TRUE)
Mean: The Arithmetic Average
The mean is the sum of all values divided by the number of values — the measure most people default to when they hear "average":
It requires interval or ratio data, and it works best when the distribution is roughly symmetric, because unlike the median, the mean is highly sensitive to outliers: every value in the dataset pulls on it, extreme values included, and pulls harder the more extreme they are.
mean(gss$EDUC, na.rm = TRUE)
That na.rm = TRUE should be reflexive by now, from Chapter 5 — leave it off, and one missing value anywhere in the vector silently converts your entire answer to NA.
dplyr, computing several statistics for several variables at once:
library(dplyr)
gss %>%
summarize(
mean_educ = mean(EDUC, na.rm = TRUE),
median_educ = median(EDUC, na.rm = TRUE)
)
When to Use Which: The Chapter 4 Payoff
This is the moment the level-of-measurement typology from Chapter 4 stops being an abstract classification exercise and starts actually deciding what you're allowed to compute:
Nominal data → mode only. A mean or median on unordered categories is nonsense, per Chapter 4's opening joke about the "average religion."
Ordinal data → mode and median are both defensible; mean is common in sociological practice (recall Chapter 4's discussion of treating long ordinal scales as interval) but should be used with awareness that it's a simplification.
Interval/ratio data → all three are available, and the choice between mean and median usually comes down to shape: symmetric distributions, prefer the mean; skewed distributions, prefer the median, or report both.
The Case of Income: Why the Mean and Median Disagree
Here is the clearest illustration of why this choice matters, and it involves one very rich, entirely hypothetical neighbor. Imagine nine people in a room, each earning $40,000 a year. The mean and median both equal $40,000 — no disagreement, nothing interesting happening. Now Jeff Bezos walks into the room. The median barely moves, because Bezos is still just one ordered value at the top of the list. The mean, by contrast, explodes — divide his net worth's influence across ten people and the "average" income in that room is now some meaningless nine-figure number that describes literally none of the ten actual incomes in it, Bezos's included.
This isn't a contrived example designed to be memorable (although it is memorable). It's a structurally accurate description of what real income distributions look like, per Chapter 7's discussion of right-skew. This is precisely why economists and sociologists report median household income rather than mean household income when describing a "typical" household — the mean is dragged upward by a thin tail of very high earners, badly overstating what a typical family actually takes home.
mean(gss$CONRINC, na.rm = TRUE)
median(gss$CONRINC, na.rm = TRUE)
If the mean is noticeably higher than the median for a right-skewed variable like income, that gap is the story — it's a direct, numeric signature of inequality, not a technical inconvenience to smooth over.
alt=A histogram of respondents' income from the 2010 GSS, with the mean and median overlayed on top.|center|thumb|800x800px|A histogram of respondents' income from the 2010 GSS, with the mean and median overlayed on top.
A Brief Note on Weighted Means
The GSS includes a sampling weight variable, typically named something like WTSS, which adjusts for the fact that not every respondent had exactly the same probability of being selected (recall Chapter 3's discussion of probability sampling — the "known, nonzero chance" every adult has of inclusion isn't necessarily an equal chance). A properly weighted analysis uses these weights to correct for that:
weighted.mean(gss$EDUC, w = gss$WTSS, na.rm = TRUE)
This book won't dwell on survey weighting in depth — it's a topic that deserves its own course, honestly — but you should know it exists and know why: an unweighted mean of GSS data is a description of your sample; a properly weighted mean is a better estimate of the population the sample was drawn to represent. For most exercises in this book, unweighted statistics are perfectly fine for learning the underlying concepts. For anything you intend to actually publish, check with your instructor about whether weighting is expected.
Chapter Summary
Mode, median, and mean each answer "what's typical?" differently, and the level of measurement from Chapter 4 determines which are even valid to compute: mode works everywhere, median needs at least ordinal data, and mean needs interval/ratio data (or, in common sociological practice, a sufficiently long ordinal scale treated as interval). R has no built-in statistical mode function — a genuine, mildly infuriating quirk — so you write a short custom function instead (or look for the option with the most observations in a table). The mean is sensitive to extreme values in a way the median is not, which is why the two diverge sharply for skewed variables like income; when they disagree, that gap is itself informative, not a nuisance. GSS analyses that aim to generalize to the U.S. population should also consider the sampling weight (WTSS) via weighted.mean(), though this book mostly works with unweighted statistics for the sake of focusing on the underlying concepts.
Practice Examples
Example 1: Mean and Median of EDUC
The Research Question: What is the "typical" level of education in the sample, and do the mean and median agree?
The Code (base R):
mean(gss$EDUC, na.rm = TRUE)
median(gss$EDUC, na.rm = TRUE)
The Code (dplyr):
library(dplyr)
gss %>%
summarize(mean_educ = mean(EDUC, na.rm = TRUE),
median_educ = median(EDUC, na.rm = TRUE))
The Output:
mean_educ median_educ
13.46 13
The Interpretation: Mean and median are close (13.46 versus 13 years), which suggests EDUC is fairly symmetric without dramatic outliers pulling the mean away from the center — consistent with the fact that years of education is naturally bounded (nobody reports 80 years of schooling the way an income variable can have a genuinely enormous outlier). When mean and median are this close, either is a defensible way to describe the "typical" respondent's education.
Follow-Up Challenge: Compute the mode of EDUC using the get_mode() function above. Does the modal value fall close to the mean and median, or does it diverge? What would explain either answer?
Example 2: Find the Mode of MARITAL
The Research Question: What is the most common marital status in the sample?
The Code:
get_mode <- function(x) {
x <- x[!is.na(x)]
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
get_mode(gss$MARITAL)
table(gss$MARITAL)
The Output:
[1] 1
1 2 3 4 5
891 181 341 65 565
The Interpretation: The modal category is 1 ("married"), the most frequent marital status by a wide margin. Confirming the mode against the full frequency table (rather than trusting the function's output blind) is good practice — it's a quick sanity check that the function found what you think it found, and it shows you the runner-up categories, which a bare mode value would hide entirely.
Follow-Up Challenge: Look up what each numeric code in MARITAL actually represents in the GSS codebook, and write one sentence summarizing the marital-status composition of the sample in plain English.
Example 3: Mean vs. Median for CONRINC
The Research Question: Does the gap between mean and median income reveal something about inequality in the sample?
The Code:
mean(gss$CONRINC, na.rm = TRUE)
median(gss$CONRINC, na.rm = TRUE)
The Output:
[1] 31632.37 # mean
[1] 22082.5 # median
The Interpretation: The mean sits well above the median — a classic signature of right-skewed income data. A relatively small number of high earners are pulling the mean upward without moving the median much at all, exactly as the Bezos thought experiment predicted. Reporting only the mean here would overstate what a "typical" respondent actually earns; reporting only the median would undersell how much income the highest earners actually pull in. Reporting both, and naming the gap explicitly, tells the more honest story.
Follow-Up Challenge: Calculate the size of the gap between the mean and median as a percentage of the median. Would you consider this a small or large amount of skew? What additional information (covered in Chapter 9) would help you judge that more rigorously?
References