Comparison, distribution, trend, relationship, composition
◈ 9 cardsClassify the business question first — comparison, distribution, trend, relationship, composition — and the chart follows: sorted bar, histogram, line, scatter, 100 % stacked or a small pie. A box plot is the comparison chart for spread by group: boxplot(amount ~ prov, data = orders).
Five kinds of question
Lesson 8.2 chose the chart from the variable types. The midterm asks the question the other way round: it states a business question and asks which chart answers it. Every such question is one of five kinds, and each kind has a chart.
Comparison — which province sells more per order? Values across categories → a sorted bar (AB 1150, ON 498.75, BC 453.33, QC 161.67). Distribution — how are order amounts spread? One numeric → a histogram (four values under 300, four in 300–600, then 2 · 1 · 1). Trend — are monthly sales rising? A numeric over equally spaced periods → a line (1610, 2560, 1970 — up, then down). Relationship — does ad spend move sales? Two numerics → a scatter (six stores, Module 13). Composition — what share of sales is online? Parts of one whole → a 100 % stacked column (or a small pie for two slices: 49.8 % / 50.2 %).
The standing confusion is comparison versus distribution. "How do the provinces compare on amount?" is comparison — one number per province, a bar. "How is amount distributed?" is distribution — all twelve values, a histogram. The word distribution points at one numeric; the word compare points at categories.
The box plot: comparison of spreads
A bar compares one summary per group. When the question is how do the groups' whole distributions compare — medians, spread, outliers — the chart is a box plot per group, side by side. Module 4 built one box for amount; this draws four:
> boxplot(amount ~ prov, data = orders, main = "Order amount by province")
The formula reads as aggregate()'s does — the numeric, split by the categorical — and one box appears per province: ON's box spans its four orders, AB's two-value box is tall and narrow, QC's sits low. A box plot answers comparison of medians and spreads; it is not a time-series chart and it does not relate two numerics.
The taxonomy as a checklist
| question kind | chart |
|---|---|
| comparison across categories | sorted bar (or box plot for spreads) |
| distribution of one numeric | histogram |
| trend over time | line |
| relationship between two numerics | scatter |
| composition of a whole | 100 % stacked, or a small pie |
Read the question, name the kind, name the chart. The distractors on the paper are always the charts for the adjacent kinds.
Type the box-plot call, then classify six questions
Type the boxplot line. The questions each state a business question and offer the five charts; one asks what a box plot compares.
CRISP-DM: naming the question kind is business understanding; the chart that answers it is data understanding → explore data. The midterm window closes here — the note below says what comes next.