T1.3 Two variables: crosstabs and scatter diagrams Start ★ 0
T1.3Playlist 1, episode 3

Same tables, two percents

Two columns side by side raise a new question: do they move together? Guess first: you will see your answer again later.

Builds on: T1.1, T1.2Leads to: T1.7, T2.2, T8.1
0Tag, Ruler and the dot crowd

Do they move together?

Three everyday pairs. Labels with labels go into a grid. Amounts with amounts become dots, the dot crowd of T1.2 with a second number. Press each button.

Two columns about the same people or days can be read together. Look for a pattern: more of one, more (or less) of the other.
1Two labels

One cup, two questions

For each of her 40 Saturday cups, Lina wrote two labels: the flavor, and who bought it.

A crosstab counts every pair of labels: one variable in the rows, the other in the columns.
In French: tableau croisé (tableau de contingence)
Invented data: Lina’s Saturday from T1.2, with one more label.
1Two labels

Read the crosstab

Tap any number inside the table. Its row and its column light up.

The totals on the edges are the one-variable tables from T1.2. The inside shows how the two variables go together.
In French: totaux marginaux

2Row or column %

Which 100%?

Real data: the 244 restaurant tables from T1.2. Rows: the day. Columns: was there a smoker at the table?

Row %: each row is 100%. Column %: each column is 100%.
In French: pourcentages en ligne, pourcentages en colonne
Tap a cell to read it.

2Row or column %

“Of whom?” finds the 100%

Read the question and find the group after “of” or “among”. That group is your whole, your 100%.

“Of Friday tables…”: each day is 100%, so row %. “Of smokers’ tables…”: each smoker group is 100%, so column %.

Tables by day and smoker (counts)

3Simpson’s paradox

Better in every group, worse overall?

Lina’s two delivery helpers, Sam and Kai, made 120 deliveries each last month (invented numbers). Who is on time more often?

Simpson’s paradox: a comparison that holds in every group can flip when the groups are added together.
In French: paradoxe de Simpson

3Simpson’s paradox

Why it flips

Rain makes every delivery harder, and Kai did most of the rainy ones. Move the slider to change how many of Kai’s 120 deliveries were in the rain.

An overall % is a mix of the group %s. A different mix can flip the comparison. Ask: is a hidden variable mixed in differently?
In French: variable cachée, facteur de confusion

Real case. In a 1986 study of kidney-stone treatments, open surgery did better for small stones (93% vs 87%) and for large stones (73% vs 69%), yet worse overall (78% vs 83%). It had mostly been used on the large, harder stones (Charig et al., 1986).
4Two amounts

One dot per day

For 10 summer days Lina wrote the top temperature and the cups she sold (invented). Each day becomes one dot: across for temperature, up for cups.

A scatter diagram puts one variable on each axis and draws one dot per element, here one per day.
In French: diagramme de dispersion (nuage de points)
Instrument: Dot crowd. From T1.2, now with two numbers per dot. Back in T1.4 to T1.6 and T8.5.
4Two amounts

Drag the dots

Grab any dot and move it, with a finger, a mouse, or the arrow keys. The trendline is redrawn each time.

A trendline shows the general direction of the cloud. One far-away dot can pull it.
In French: droite de tendance

The line is fitted by least squares. You will build it yourself in T8.1.

5Reading a scatter

Which way, and how tight?

Slide from one end to the other. Watch the cloud tilt, then tighten.

Direction: up (positive), down (negative) or neither. Strength: how closely the dots hug a line.
In French: relation positive, négative ; intensité de la relation
down ◂ slide ▸ up
5Reading a scatter

Straight or curved?

Direction is not the whole story. Some clouds bend. Pick a cloud, then lay a straight line on it.

Form: the dots may follow a straight line or a curve. A straight trendline can miss a curve completely.
In French: relation linéaire, non linéaire

5Reading a scatter

Read a real scatter

The 244 restaurant tables again: total bill across, tip up. Read it in four steps.

Read every scatter in the same order: direction, form, strength, then outliers.
In French: valeur aberrante
!The trap

Together is not because

On 12 summer days, Lina’s cups and the sunburn cases at the beach clinic rose together (invented). Does bubble tea cause sunburn?

A pattern in a scatter diagram shows association, not causation. A hidden variable can drive both. This trap returns in T1.7 and T8.3.

Cups sold and sunburn cases, one dot per day

Real case. Across 23 countries, those eating more chocolate per person had more Nobel laureates per person (Messerli, 2012). The scatter cannot say why. A third factor, such as a country’s wealth, could push both up.
6Name it

Name what you did

Each card is something your hand already did on this page. Tap a card, then tap its name.

0 of 6
The names come last, as labels on what you already know how to do.
7Which picture?

Which picture for two variables?

Pick two columns. Follow the path to their picture.

Two labels: crosstab. Two amounts: scatter diagram. One of each: make classes for the amount, then a crosstab.
8Practice

Practice arcade

Six levels, a boss where you build the cloud, and a scatter lab.

9Remember

Six things to remember, and one trap

Sources and textbook links

Crosstabulation, row and column percentages, Simpson’s paradox, and the scatter diagram with a trendline follow chapter 2 of the course textbook. Reading a scatter by direction, form, strength and outliers follows Moore, Notz and Fligner, chapter 4. The 244 restaurant tables are real data. Lina’s cups, delivery helpers, summer days and sunburn figures, the practice clouds (typing speed, home energy use) and the generated dot clouds are invented for teaching. The kidney-stone and chocolate figures are real and come from the cited papers. “In French” labels give common French statistical vocabulary, not quotations from the book.

  1. Anderson, D. R., Sweeney, D. J., Williams, T. A., Camm, J. D., & Cochran, J. J. (2015). Statistiques pour l’économie et la gestion (5e éd., traduction de la 7e édition américaine d’Essentials of Statistics for Business and Economics par C. Borsenberger). De Boeck Supérieur. Chapitre 2.
  2. Bryant, P. G., & Smith, M. (1995). Practical data analysis: Case studies in business statistics. Irwin. Dataset “tips” (244 tables), as distributed with the R package reshape2 and the seaborn-data repository: https://github.com/mwaskom/seaborn-data
  3. Charig, C. R., Webb, D. R., Payne, S. R., & Wickham, J. E. (1986). Comparison of treatment of renal calculi by open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave lithotripsy. British Medical Journal (Clinical Research Ed.), 292(6524), 879–882. https://doi.org/10.1136/bmj.292.6524.879
  4. Julious, S. A., & Mullee, M. A. (1994). Confounding and Simpson’s paradox. BMJ, 309(6967), 1480–1481. https://doi.org/10.1136/bmj.309.6967.1480
  5. Messerli, F. H. (2012). Chocolate consumption, cognitive function, and Nobel laureates. New England Journal of Medicine, 367(16), 1562–1564. https://doi.org/10.1056/NEJMon1211064
  6. Moore, D. S., Notz, W. I., & Fligner, M. A. (2013). The basic practice of statistics (6th ed.). W. H. Freeman. Chapter 4, Scatterplots and correlation.
  7. Simpson, E. H. (1951). The interpretation of interaction in contingency tables. Journal of the Royal Statistical Society, Series B, 13(2), 238–241.