Back to the Introduction to Statistics outline The Course Maker
Introduction to Statistics outline
Week 16 · Data Lab

Week 16 — Data Lab · "Species, Islands, and One Giant Chi-Square"

Introduction to Statistics Generic evergreen edition

Course: Introduction to Statistics (18-week generic edition)
Objective: Objective 9 — test of independence on a real two-way table (expected counts, df, conditions, contributions) · SLO A (reason quantitatively from data)
Worth 50 points · Data labs group = 15% of the grade · Data Lab 16 · Due: end of Week 16
Format: a hands-on data lab — real research data, a spreadsheet, and a full chi-square test of independence built cell by cell; then you catch the AI's mistakes when it interprets your work.

This is the course's signature weekly component. Every instructional week has a Data Lab: real, free, linked public data — nothing to buy, download from a store, or sign up for — worked in your spreadsheet, finished with an AI-critique step. Plan on 60–90 minutes.


Part 1 — The Big Picture

Way back in Data Lab 1 you met the 344 Palmer Station penguins and built your first frequency tables. In Week 4 you learned to describe a two-way table. This week those two threads finally meet the inference machine: you'll build the penguins' species × island two-way table yourself, straight from the raw data, and run a full chi-square test of independence on it.

Here's what makes today special: most textbook chi-square examples produce polite statistics like 7 or 12. The penguins will hand you a chi-square near 300 — the largest you will compute in this course — because species and island are about as far from independent as nature gets. Your job isn't just to compute it; it's to read it: which cells drive it, why four observed zeros don't break the test, and what a gigantic χ² does — and does not — let you conclude.


Part 2 — The Task

The guiding question: If species and island were unrelated, each island would host each species in proportion to its size. How far does reality drift from that — and is the drift luck, or structure?

The dataset (both links are free, no login — the same dataset from Data Lab 1):
- About the data — palmerpenguins documentation
🔗 https://allisonhorst.github.io/palmerpenguins/
- The data itself (CSV file, opens as plain text)
🔗 https://raw.githubusercontent.com/allisonhorst/palmerpenguins/main/inst/extdata/penguins.csv


Part 3 — Materials & Procedure

You need: a web browser and a spreadsheet — Google Sheets (free) or Excel. Nothing else.

Warm-up (5 min, no dataset needed). A wildlife tour guide claims sightings on her route split equally across three islands. Her logbook's last 60 sightings: 26 / 18 / 16. By hand: expected counts (60 ÷ 3 = 20 each), the three contributions ((O − E)² ⁄ E), the χ² total, df, and the 5% verdict from the chapter's mini table (df = 2 → 5.991). Write your answer down — you'll check it against the key's method later.

Now the real data:

  1. Import the dataset. Open the CSV link above in your browser, select all (Ctrl/Cmd-A), copy, paste into cell A1 of a blank sheet, then Data ▸ Split text to columns if needed. (Excel alternative: Data ▸ From Web, paste the CSV URL.) You should end with 8 columns and a header row: species, island, bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g, sex, year — species is column A, island is column B.
  2. Count your rows. In J1 type =COUNTA(A2:A400) — it should return 344. (Species and island have no NA gaps, so the whole 344 counts — a contrast with the body-mass work of earlier labs.) If it differs, re-import before continuing.
  3. Build the observed table with =COUNTIFS. Type the three species names down K2:K4 (Adelie, Chinstrap, Gentoo) and the three island names across L1:N1 (Biscoe, Dream, Torgersen). In L2:
    =COUNTIFS($A$2:$A$345,$K2,$B$2:$B$345,L$1)
    and fill it across L2:N4. Nine formulas — your whole observed table. (A pivot table — Insert ▸ Pivot table, species as rows, island as columns, COUNTA of species as values — is an equivalent route.)
  4. Add the margins and cross-check. Row totals in O2:O4 (=SUM(L2:N2) filled down); column totals in L5:N5 (=SUM(L2:L4) filled across); grand total in O5 (=SUM(O2:O4)). O5 must equal 344 — if it doesn't, a species or island name is misspelled in your COUNTIFS labels. Fix before continuing.
  5. Build the expected table. In L9 (a parallel 3 × 3 block, same layout):
    =$O2*L$5/$O$5
    filled across L9:N11 — that's (row total × column total) ⁄ grand total for every cell. Round mentally to 2 decimals when you copy them into the scaffold; leave the cells un-rounded.
  6. Check the expected-count condition. Find the smallest expected cell. Is it at least 5? Note it — Part 5 asks about it.
  7. Build the contribution table. In L14 (a third 3 × 3 block):
    =(L2-L9)^2/L9
    filled across L14:N16 — each cell's (O − E)² ⁄ E.
  8. Total the statistic and get the verdict. In L18: =SUM(L14:N16) — your χ². df = (3 − 1)(3 − 1) = 4; the 5% critical value from the chapter's mini table is 9.488. In L19, let technology double-check the tail: =CHISQ.DIST.RT(L18, 4) — with a statistic this size the sheet shows a p-value in scientific notation so close to zero it may display as 0.
  9. Fill in the scaffold tables in Part 4, then answer Part 5.

Fallback (no import available): if you can't get the CSV into a spreadsheet, start from the observed table below (verified against the linked CSV) and do steps 4–8 with a calculator — margins, expected counts, contributions, χ², verdict. State in your submission that you used the fallback.

The fallback table gives the observed species × island counts.

Observed Biscoe Dream Torgersen
Adelie 44 56 52
Chinstrap 0 68 0
Gentoo 124 0 0

Part 4 — The Scaffold (complete both tables)

Table 1 captures your observed table with margins, and the two headline checks.

Quantity Value
Rows of data (=COUNTA) ______
Observed counts, Adelie row (Biscoe / Dream / Torgersen) __ / _ / ___
Observed counts, Chinstrap row __ / _ / ___
Observed counts, Gentoo row __ / _ / ___
Row totals (Adelie / Chinstrap / Gentoo) __ / _ / ___
Column totals (Biscoe / Dream / Torgersen) __ / _ / ___
Grand total (must be 344) ______

Table 2 captures the test itself.

Quantity Value
Expected count, Adelie–Biscoe (show the formula's numbers) ______
Smallest expected count in the table (which cell, and is it ≥ 5?) ______
Largest two contributions (which cells, what values) ______
χ² (the sum of all 9 contributions) ______
df ______
5% critical value (mini table) ______
Verdict (reject / fail to reject) + one careful sentence ______

Part 5 — Analysis Questions

Answer in 1–3 sentences each:

  1. State the hypotheses you tested, in plain words — and explain why this calls for the test of independence rather than a goodness-of-fit test. (How many categorical variables are in play? Who supplied a "claimed" distribution?)
  2. Your observed table contains four zeros, yet the test is still valid. Explain why, naming the exact condition — and the smallest expected count in your table.
  3. Read your contribution table: name the two largest contributions and translate each into a plain-English sentence about penguin geography (what does each cell's observed count do relative to what independence predicted?).
  4. Error hunt: name one specific way this analysis could quietly go wrong in the spreadsheet — a misspelled species name in a =COUNTIFS label, expected cells built from the wrong row/column totals, or ranges that miss row 345 — and say exactly which cross-check in the procedure would catch your chosen error.
  5. The guardrail + the arc: your χ² is enormous and the association is real — yet "Biscoe causes Gentoos" (or "species choose islands at random except when they don't") would still be sloppy science. Write the careful conclusion, note who these 344 penguins are (Week 1: measured at study sites near one research station — representativeness matters), and say in one line where this tool now sits in your Weeks 11–16 toolkit as you head into the Week 17 synthesis.

Part 6 — AI-Critique Moment (required — the BYOAI step)

Now bring in your chatbot and be the analyst who checks its work.

  1. Paste your completed observed table with margins (from Table 1) into your chatbot and ask: "Compute the expected counts and the chi-square statistic for a test of independence, state the degrees of freedom and the 5% critical value, and give the conclusion."
  2. Check everything it says against your own spreadsheet:
    - Did it get df = 4? (Chatbots love df = 8 — cells minus one — for a 3 × 3 table.)
    - Did its expected counts match yours? Recompute one by hand ((row × column) ⁄ 344) — mis-multiplied expected tables and mis-added margins are the classic failures.
    - Did it quote the critical value from memory? Spot-check against the chapter's mini table (df 4 → 9.488).
    - Did it claim the observed zeros are a problem? (They aren't — the ≥ 5 condition is about expected counts, and your smallest expected cell clears it.)
    - Did it slide into causal language ("islands determine species") — or dismiss your χ² as "too large to be right"? (Near-300 is correct here; verify against your sheet's sum.)
  3. Write 2–3 sentences reporting what the AI got right and at least one thing you had to correct, question, or verify. If it happened to get everything right, say how you verified each claim — that's the skill.

The habit all term: the tool drafts, you judge. A chatbot will confidently botch a df, mis-multiply an expected count, or upgrade an association into a cause — catching it is the point.


Part 7 — What to Submit

One document or text entry containing: your warm-up test (all steps), your completed Table 1 and Table 2, your Part 5 answers (1–5), and your Part 6 AI-critique paragraph. Due at the end of Week 16 · 50 points (rubric below the key).


Instructor answer key & model values — REMOVE BEFORE PUBLISHING TO STUDENTS

Students all work the same fixed dataset this week, so the values below are checkable — but grade the analysis and the careful language, not decimal-matching: rounding differences in expected counts and contributions are fine. Every number below was pre-computed from the linked CSV (row-by-row transcription cross-checked in-session against the dataset's published totals and Week 8's independently verified transcription) and re-verified by script (tools/checks/w16_math.py).

Warm-up (fixed — every student should match): E = 20 each; contributions (26−20)²⁄20 = 1.8, (18−20)²⁄20 = 0.2, (16−20)²⁄20 = 0.8; χ² = 2.8, df = 2, critical value 5.991 → 2.8 < 5.991 → fail to reject: the log is consistent with an equal split (careful words required — not "proven equal"). ✓

Dataset facts (verified against the linked CSV): 8 columns with headers exactly species, island, bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g, sex, year; 344 data rows; species and island columns have no NA values (all 344 rows usable — the two NA body masses are irrelevant here); species totals Adelie 152 · Chinstrap 68 · Gentoo 124; island totals Biscoe 168 · Dream 124 · Torgersen 52; first data row is an Adelie from Torgersen.

Table 1 model values (observed, fixed): Adelie 44 / 56 / 52 · Chinstrap 0 / 68 / 0 · Gentoo 124 / 0 / 0 (Biscoe / Dream / Torgersen order); row totals 152 / 68 / 124; column totals 168 / 124 / 52; grand total 344.

Table 2 model values:

The table below gives the verified expected counts and contributions (2 decimals).

Cell Expected Contribution
Adelie–Biscoe 74.23 12.31
Adelie–Dream 54.79 0.03
Adelie–Torgersen 22.98 36.66
Chinstrap–Biscoe 33.21 33.21
Chinstrap–Dream 24.51 77.16
Chinstrap–Torgersen 10.28 10.28
Gentoo–Biscoe 60.56 66.46
Gentoo–Dream 44.70 44.70
Gentoo–Torgersen 18.74 18.74

Expected-count example shown in full: Adelie–Biscoe = (152 × 168) ⁄ 344 = 74.23. Smallest expected count: Chinstrap–Torgersen, 10.28 ≥ 5 → condition met despite four observed zeros. χ² ≈ 299.6 (un-rounded 299.55; sums of 2-decimal cells land on 299.55 — accept anything in 299–300). df = 4, critical value 9.488reject H₀ overwhelmingly (=CHISQ.DIST.RT returns a value in scientific notation, effectively 0). Largest two contributions: Chinstrap–Dream 77.16 and Gentoo–Biscoe 66.46.

Part 5 expected answers:
1. H₀: species and island are independent (each island hosts each species in proportion to island size); Hₐ: they are associated. Two categorical variables recorded per penguin and no external claimed mix → test of independence (expected counts come from the margins, not from a label).
2. The ≥ 5 condition polices expected counts, and the smallest expected count is 10.28 — every expected cell clears 5, so the observed zeros are legal data, not a violation.
3. Chinstrap–Dream (77.16): all 68 Chinstraps sit on Dream vs. ≈ 24.5 expected — massively over. Gentoo–Biscoe (66.46): all 124 Gentoos on Biscoe vs. ≈ 60.6 expected... credit requires reading O vs. E, e.g., "Gentoos pile onto Biscoe far beyond their independence share (124 observed vs. 60.56 expected)." Accept any two of the top cells read correctly against their expected counts (Adelie–Torgersen 36.66 — Torgersen is effectively an Adelie-only island — is also acceptable if ranked among their top two by their own sheet; the true top two are as stated).
4. Any concrete, checkable error + its catch: a misspelled Gentoo in a COUNTIFS label (caught by the grand-total-must-equal-344 margin check); expected cells referencing the wrong row/col totals (caught by recomputing Adelie–Biscoe by hand); ranges stopping at row 344 (caught by =COUNTA = 344 vs. table sum). Full credit requires both the error and the specific catch.
5. Careful conclusion: species and island are strongly associated in these data — the distribution of species differs by island — but the test convicts the table, not a cause (geography, colony history, and researchers' site choices all lurk; these 344 penguins are the ones measured at study sites near one station, so generalizing beyond them needs care — Week 1). Toolkit line: means → t, proportions → z, categorical tables → χ²; Week 17 adds regression and the choosing-the-tool synthesis.

AI-critique full credit: names a specific claim checked or corrected — most commonly df = 8 instead of 4, a mis-multiplied expected count or margin, a memory-quoted critical value that misses 9.488, a false "zeros invalidate the test" claim, causal phrasing, or disbelief at χ² ≈ 300 — OR documents verification of each claim. Zero credit for "the AI agreed with everything" with no evidence of checking.

Grading rubric — 50 points

The rubric below maps each part to its points; bands are full / partial / none.

Criterion Full Partial None
Warm-up + import — warm-up χ² = 2.8 with correct verdict language; 344 rows confirmed (5) 5 3 0–1
Observed table + margins — COUNTIFS/pivot table correct (44/56/52 · 0/68/0 · 124/0/0); margins cross-checked to 344 (10) 10 5–8 0–4
The test — expected counts by formula (one shown by hand), condition checked via smallest expected cell, contributions, χ² ≈ 299.6, df 4, verdict vs. 9.488 (15) 15 8–12 0–6
Analysis questions — Q1–Q5 hit the expected ideas, especially the expected-vs-observed condition (Q2) and the careful conclusion (Q5) (15) 15 8–12 0–6
AI-critique — specific catch or verification reported in 2–3 sentences (5) 5 3 0–2

Quality gate (self-checked): warm-up arithmetic re-verified (1.8 + 0.2 + 0.8 = 2.8 < 5.991); dataset links live and free (documentation page + raw CSV both fetched and confirmed this build); row count, column names, species totals (152/68/124), island totals (168/124/52), the full observed table, every expected count, every contribution, χ² = 299.55, df, and the critical values all re-verified in tools/checks/w16_math.py against a row-by-row transcription of the fetched CSV (cross-checked token-for-token against Week 8's independently validated transcription); no numeric claim in the key depends on an unverified dataset-wide value; no graded-item leakage (no quiz/assignment/practice item uses the penguins data); rubric sums 5 + 10 + 15 + 15 + 5 = 50. ✓