Memra

Comparison, distribution, trend, relationship, composition

◈ 9 cards

Classify 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.

Comparisonwhich province sells more per order? Values across categories → a sorted bar (AB 1150, ON 498.75, BC 453.33, QC 161.67). Distributionhow are order amounts spread? One numeric → a histogram (four values under 300, four in 300–600, then 2 · 1 · 1). Trendare monthly sales rising? A numeric over equally spaced periods → a line (1610, 2560, 1970 — up, then down). Relationshipdoes ad spend move sales? Two numerics → a scatter (six stores, Module 13). Compositionwhat 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 kindchart
comparison across categoriessorted bar (or box plot for spreads)
distribution of one numerichistogram
trend over timeline
relationship between two numericsscatter
composition of a whole100 % 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.

question kindexamplechartR callcomparisonwhich provincesells more perorder?sorted barbarplot(sort(mean_by_prov))distributionhow are orderamounts spread?histogramhist(amount)trendare monthly salesrising?lineplot(month, total,type = "l")relationshipdoes ad spend movesales?scatterplot(adspend,sales)compositionwhat share of salesis online?100 % stacked /small piepie(sum_by_channel)mean_by_prov is tapply(orders$amount, orders$prov, mean); sum_by_channel is xtabs(amount ~ channel,orders). Spreads, not just means: boxplot(amount ~ prov, data = orders).
Question kind → chart. The example questions are the ones the lessons in this module already answered; the R calls are the ones Module 11 types against the data frame.
NORMAL ~/memra/learn/afm-112/choosing-the-chart-that-answers-the-question utf-8 LF