3 Describing Data
By the end of this chapter you will be able to:
- Compute mean, median, and mode, and choose which to report for a given distribution.
- Compute and interpret measures of variability (SD, IQR, range).
- Run a first-pass EDA in R using the chapter’s template.
- Choose the right visualization for your variable types.
Before you test anything, look at it.
This sounds obvious, but it is the step beginners skip most often. A test does not tell you what is interesting about your data; it tells you whether one specific number is bigger than expected by chance. The shape of the distribution, the presence of outliers, the way two variables move together — all of that has to come from descriptive statistics and plots, not from a p-value.
This chapter covers two things: the summary numbers you compute for any variable, and the chart you should be looking at while you do it.
Picks up right at the worked example — sample size, mean, median, and range — then gives a genuinely clear, intuitive explanation of why degrees of freedom is \(n - 1\) and how that connects to standard deviation.
You’re responsible for:
- Mean, median, and range as concepts (not the R syntax — that’s this chapter’s job)
- Why the \(n - 1\) denominator makes \(s^2\) an unbiased estimator of the population variance (the chapter states this in the Variability section but points to Chapter 5 for the reasoning — this video is where you get the intuition)
3.1 Central tendency: where the data sit
Three numbers summarize “the middle” of a distribution.
Mean (\(\bar{x}\)) — the arithmetic average. Sensitive to extreme values. Best for roughly symmetric continuous data.
\[ \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i \]
Median — the middle value when observations are sorted. Robust to outliers. Best for skewed data or data with extreme values.
Mode — the most frequent value. The only sensible measure of “center” for nominal data.
For roughly symmetric continuous data: mean, plus standard deviation.
For skewed data (income, reaction times, anything bounded at zero): median, plus interquartile range, and consider whether a transformation (Chapter 12) would let you use the mean instead.
For categorical data: mode, plus a frequency table.

3.2 Variability: how spread out the data are
A mean of 50 with everyone scoring between 48 and 52 is a very different finding from a mean of 50 where scores range from 0 to 100. Variability is at least as important as central tendency, and most inferential tests are really comparisons of one kind of variability to another.

Range — max minus min. Easy to compute, but driven entirely by extreme values.
Interquartile range (IQR) — the spread of the middle 50% of the data (75th percentile minus 25th percentile). Robust to outliers. The standard companion to the median.

Variance (\(s^2\)) — the average squared distance from the mean.
\[ s^2 = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^2 \]
The \(n - 1\) denominator (not \(n\)) makes \(s^2\) an unbiased estimator of the population variance — see Chapter 5 for why.
Standard deviation (\(s\)) — the square root of the variance. In the same units as the original variable, which makes it more interpretable than the variance.
\[ s = \sqrt{s^2} \]
For roughly normal data, the mean ± 1 SD covers about 68% of observations, mean ± 2 SD covers about 95%, and mean ± 3 SD covers about 99.7%. This is the “empirical rule” or “68-95-99.7 rule” and is one of the more useful approximations in statistics.

Open the module to drag one value to an extreme and watch the mean and SD chase it while the median and IQR barely move. It also shows how the gap between the mean and the median tells you which way a distribution is skewed.
3.3 Exploratory data analysis (EDA): the first pass
Before running any test, produce four things and put them on a single page:
- A histogram of each continuous variable (to see shape).
- A boxplot of the same variables, grouped if there are groups (to see outliers and group differences).
- A scatterplot of any pair of continuous variables you might relate (to see association).
- A descriptives table with \(n\), mean, SD, median, min, max for each variable.
If those four things together do not tell you what is going on, the test will not tell you either.
# Quick EDA template — run on any data frame
str(data) # what are the variable types?
summary(data) # numerical summary of every column
hist(data$score) # distribution of one continuous variable
boxplot(score ~ group, data = data) # by-group spread
plot(data$x, data$y) # bivariate scatter
The Baby Dataset — used throughout this book — loads straight from a package, with no file or URL:
library(UsingR)
data(babies)It arrives raw and needs a quick cleanup pass before it’s ready to use — that’s what the first few lines of the demo script below do. You’ll learn exactly how that cleaning works in Chapter 7; for now, the point is that the first pass is where you find both the problems and the interesting patterns — and the patterns are questions the rest of the course answers.
demos/03-first-look-in-R.R runs this first pass on the Baby Dataset: a quick clean, then histograms, a grouped boxplot, and a scatterplot. Every pattern it turns up — is birth weight normal? is the smoking gap real? does gestation predict weight? — is something a later chapter takes up. Descriptive statistics doesn’t answer those questions; it’s how you find the ones worth asking.
Run it in Posit Cloud with source("https://jkoxford-a11y.github.io/awesomesaucestats/demos/03-first-look-in-R.R"), or download it to step through line by line.
Live in class: project the console, run each line, pause on each plot for “what do you notice?” before scrolling to the next.
3.4 Choosing the right visualization
The chart you should use depends on (1) the data types and (2) the question you’re asking. Table 3.1 is the cheat sheet.
Categorical data
| Chart | Best use | Example |
|---|---|---|
| Bar chart | Comparing frequencies across categories | Students in each major |
| Stacked bar | Comparing parts of a whole across categories | Gender breakdown within each job sector |
| Pie chart | Showing proportions of one whole (use sparingly) | Market share among 3–4 brands |
Continuous data
| Chart | Best use | Example |
|---|---|---|
| Histogram | Distribution of one continuous variable | Age distribution in a population |
| Boxplot | Median, spread, and outliers | Income across cities |
| Line chart | Change over time | Monthly sales over a year |
| Scatterplot | Relationship between two continuous variables | Height vs. weight |
Mixed (continuous + categorical)
| Chart | Best use | Example |
|---|---|---|
| Grouped bar | Compare values across categories and subcategories | Average score by subject and grade |
| Boxplot by group | Compare a continuous distribution across categories | Exam scores by gender |
| Scatterplot with color | Show relationships, grouping by category | Hours studied vs. score by class year |
3.4.1 Choosing by goal
Sometimes you know what you want to show before you know what kind of chart it is. Table 3.2 translates goals into chart types.
| Goal | Best chart |
|---|---|
| Show one variable’s distribution | Histogram or boxplot |
| Compare groups | Bar chart, stacked bar, or boxplot |
| Show trends over time | Line chart |
| Explore relationships | Scatterplot |
| Highlight proportions of a whole | Stacked bar (or, sparingly, pie chart) |
3.5 Tips for any chart
- Label everything. Axis titles, chart title, legend, units. The reader should never have to guess.
- Avoid clutter. Use color and 3D effects sparingly. Each visual element should carry information.
- Watch the y-axis. Truncating the y-axis can make trivial differences look enormous. Bar charts always start at zero; dot plots and line charts, which show change or difference, don’t have to (Chapter 8).
- Be wary of pie charts. They are hard to read when you have more than three or four slices, and they hide small differences. A bar chart almost always does the job better.
- Check the data first. A chart is only as good as the data behind it. Spot-check for missing values, weird codings (
99meaning “missing”), and incorrect variable types before plotting.
3.6 The full workflow
Putting central tendency, variability, and visualization together, the EDA stage of a project should look something like this:
- Define your research question. What are you trying to find out?
- Organize your data. Check completeness, fix errors, format columns correctly.
- Explore with visualization. Histograms, scatterplots, boxplots, and a descriptives table on one page.
- Check the shape. Severe skew or outliers may call for a transformation or a nonparametric test later (Parts III and IV); mild departures usually don’t.
- Choose the right analysis (using Table 2.1 in the previous chapter).
- Run the analysis.
- Interpret the results in context — including effect size and practical significance, not just p.
- Visualize the results so they communicate the finding cleanly.
- Report your findings with limitations acknowledged.
The next chapter steps back from procedure and looks at the distributions — Z, t, F — that underlie every inferential test in this book.
Core idea: Before running any test, describe your data. Central tendency, variability, and visualization together give you a complete picture — and often reveal problems that would otherwise silently corrupt your analysis.
You should understand:
- Why the mean and standard deviation are sensitive to outliers, and when the median and IQR are better summaries
- What a histogram, boxplot, and scatterplot each reveal — and what they hide
- Why exploratory data analysis (EDA) is not optional
You should be able to do in R:
- Compute descriptives:
mean(),median(),sd(),IQR(),summary() - Produce a histogram:
hist(x) - Produce a boxplot:
boxplot(y ~ group, data = data)
Plain-language check: A dataset has a mean of 75 and a median of 52. What does that tell you about the shape of the distribution?
The one mistake to avoid: Skipping the visualization and going straight to a test. A statistically significant result from badly distributed or miscoded data is still a wrong result.
Practice: You have reaction time data from 30 participants. Two participants fell asleep during the task and have times of 8,000 ms (everyone else is under 800 ms). How would the mean and median each respond to those two values?
Key terms from this chapter are defined in the Glossary.
Practice the skills from this chapter using real data: Assignment 1 — Descriptive Statistics and Visualization