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

Week 15 Data Lab: One Line or Three?

Introduction to Statistics Free sample edition

Part 1 — The Big Picture

This week you learned to fit a least-squares line, read its slope and intercept, measure its misses with residuals, judge its fit with r² and a residual plot, and test and estimate its slope. In this lab you do all of it yourself on the real penguin file. First you rebuild the chapter's line for all 342 penguins, check it against the course's values, and draw its residual plot. Then you fit a separate line for each of the three species and compare. The comparison shows something a single line hides: how much of the strong all-penguin pattern comes from comparing species. Then you check a chatbot's answers about the same data.

Time budget: Plan for about 90 minutes.

Part 2 — The Task

Guiding question: How well does one least-squares line predict penguin body mass from flipper length, and what changes when you fit a separate line for each species?

Workshop data: palmer-station-penguins

Get the data: palmer-station-penguins landing page or the direct data file — free, no login required.

Source: Measurements of 344 penguins of three species on three islands of Antarctica's Palmer Archipelago, recorded by field researchers and republished in the palmerpenguins package.

  • Rows: 344 penguins
  • Columns: species, island, bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g, sex, year
  • Missing values: Numeric measurement columns and sex carry missing values for a small number of penguins

Part 3 — Materials & Procedure

Tools and materials

  • Google Sheets (free) or Excel
  • The palmerpenguins CSV file
  • A document or notebook for your written answers

Ways of working

  • interpret-real-data
  • compute-and-plot
  • structured-observation

Procedure

  1. Open a blank sheet and name the first tab Penguins. In cell A1 type =IMPORTDATA("https://raw.githubusercontent.com/allisonhorst/palmerpenguins/main/inst/extdata/penguins.csv"). In Excel, save the file from that address, then use Data, then From Text/CSV, and load it starting in cell A1. Tool: Google Sheets (free) or Excel. Check: Row 1 shows the eight column names, the penguins fill rows 2 through 345, flipper length sits in column E, and body mass sits in column F.
  2. Fit the line for all penguins. In empty cells type =COUNT(E2:E345), =SLOPE(F2:F345,E2:E345), =INTERCEPT(F2:F345,E2:E345), =RSQ(F2:F345,E2:E345), and =STEYX(F2:F345,E2:E345). Put y first and x second. Record the five values in the first scaffold table. Tool: Google Sheets (free) or Excel. Check: The count is 342, and the slope, intercept, r², and residual standard error match the chapter's values to the decimals shown there.
  3. Test and estimate the slope. Type =STEYX(F2:F345,E2:E345)/(STDEV(E2:E345)*SQRT(COUNT(E2:E345)-1)) for the slope's standard error, divide the slope by it for t, and use the conservative critical value 1.976 to build the 95% interval as the slope minus and plus 1.976 times the standard error. Record each value in the first table. Tool: Google Sheets (free) or Excel. Check: The standard error matches the chapter's SE(b₁), t is above 30, and the interval matches the chapter's interval.
  4. Build the residuals. Put the slope in cell L1 and the intercept in cell L2. In cell I2 type =IF(ISNUMBER(E2),F2-($L$2+$L$1*E2),"") and fill it down to I345, so column I holds each bird's residual, observed minus predicted. Tool: Google Sheets (free) or Excel. Check: Column I holds 342 residuals, some positive and some negative; the two rows with NA stay blank.
  5. Draw the residual plot and a histogram. Select columns E and I and insert a Scatter chart, so flipper length runs across the bottom and the residual runs up the side; add a horizontal line at 0 if your tool allows. Then insert a histogram of column I. Describe both in words in the second scaffold table. Tool: Google Sheets (free) or Excel. Check: The residuals scatter above and below 0 across the whole flipper range, and the histogram has one main peak near 0.
  6. Fit a line for each species. Add a tab named Species. For the Gentoo penguins, type =SLOPE(FILTER(Penguins!F2:F345,Penguins!A2:A345="Gentoo",Penguins!F2:F345<>"NA"),FILTER(Penguins!E2:E345,Penguins!A2:A345="Gentoo",Penguins!E2:E345<>"NA")), then the same pattern with INTERCEPT, RSQ, MIN, and MAX of the flipper column. Repeat with "Adelie" and "Chinstrap", and record everything in the third scaffold table. Tool: Google Sheets (free) or Excel. Check: Each species has its own slope, intercept, r², and flipper range, and each species' r² is smaller than the all-penguin r².

Fallback route

When to use it: Use this route if the penguin file will not import or no spreadsheet is available.

Work from the model data below, which reports summaries from the real file for each species and, for the all-penguin line, the average residual in each band of flipper lengths. Fill the first table from the chapter's values and recompute t and the interval by hand. For each species, compute the slope as r times s_y divided by s_x, the intercept as ȳ minus the slope times x̄, and r² as r times r, with a calculator. Describe the residual plot from the band averages: say where the residuals sit above 0 and where below. Answer every analysis question and the critique step from these records, and submit the same items for equal credit.

This route earns the same credit as the primary route.

These summaries from the real file give you every input the species lines need without importing it, plus the average residual of the all-penguin line in five flipper bands.

Fallback model data
Quantity Adelie Chinstrap Gentoo
Count with both measurements, n 151 68 123
Mean flipper length, x̄ (mm) 189.95 195.82 217.19
Flipper standard deviation, s_x (mm) 6.54 7.13 6.48
Mean body mass, ȳ (g) 3,700.66 3,733.09 5,076.02
Body-mass standard deviation, s_y (g) 458.57 384.34 504.12
Correlation, r 0.4682 0.6416 0.7027
Shortest and longest flipper (mm) 172 and 210 178 and 212 203 and 231
Slope, b₁ (g per mm)
All-penguin line: average residual for flippers 172–189 mm, 190–199 mm, 200–209 mm, 210–219 mm, 220–231 mm (g) 94.3, −66.2, −118.7, −8.5, 124.1

Part 4 — The Scaffold

Rebuild the all-penguin line and its inference so you can check your work against the chapter.

Student scaffold table 1
Quantity Your value Chapter value
Count of birds with both measurements, n 342
Slope, b₁ (g per mm) 49.6856
Intercept, b₀ (g) −5,780.8314
Coefficient of determination, r² 0.759
Residual standard error (g) 394.2782
Standard error of the slope, SE(b₁) (g per mm) 1.5184
t statistic, b₁ ⁄ SE(b₁) about 32.72
95% interval for β₁ (g per mm) about 46.69 to 52.69

Describe the residual plot and the histogram of the residuals in words, because each one checks a condition for regression inference.

Student scaffold table 2
Picture What you see, in words Condition it checks
Residual plot: residuals against flipper length
Histogram of the residuals

Fit a separate line for each species so you can see how much of the overall pattern comes from comparing species.

Student scaffold table 3
Quantity Adelie Chinstrap Gentoo
Count with both measurements, n
Slope, b₁ (g per mm)
Intercept, b₀ (g)
Coefficient of determination, r²
Shortest and longest flipper (mm)

Part 5 — Analysis Questions

  1. Report your all-penguin slope, intercept, r², residual standard error, SE(b₁), t, and 95% interval for β₁ from the first table, and say whether each matches the chapter. Then write the slope as a sentence: each additional millimetre of flipper length predicts about how much more body mass?
  2. Describe your residual plot and your histogram of the residuals in words, without relying on color. Is the residual plot a shapeless band, a curve, or a fan? Which conditions for regression inference does each picture support, and does anything in either picture give you pause?
  3. Compare the three species' slopes and r² values with the all-penguin slope and r². Why can one line through all three species have a larger r² than any single species' line? Use the idea of a lurking variable in your answer.
  4. A field team measures a new Gentoo penguin with a 200 mm flipper. Using your third table, is a prediction from the Gentoo line interpolation or extrapolation? Is a prediction from the all-penguin line interpolation or extrapolation? Explain which line you would trust more for this bird and why.
  5. Choose one and answer it in 3–4 sentences. (a) The penguins were observed in a field study, not assigned flipper lengths: what can your slopes say, and not say, about whether a longer flipper makes a penguin heavier? (b) A colleague wants one simple rule for estimating any penguin's mass from its flipper: would you give them the all-penguin line or a species line, and what would you warn them about?

Part 6 — AI-Critique Moment

Choose one equal-credit critique route. Route A: ask an approved AI tool to critique your completed work, then check its response against your own evidence. Route B is the no-AI equivalent printed below.

Approved tools: Claude, Gemini, ChatGPT, Grok, Microsoft Copilot.

Prompt to paste:

I've pasted my completed Week 15 Data Lab tables above. In the lab I used the Palmer penguins file to fit the least-squares line of body mass on flipper length for all 342 measured penguins and then for each species separately. Please do five things. First, give the least-squares line, r-squared, and the slope's t test for the Gentoo penguins alone, and say what the slope means. Second, tell me whether a longer flipper causes a penguin to be heavier. Third, interpret the 95% confidence interval for the slope of the line for all 342 penguins, 46.69 to 52.69 g per mm. Fourth, describe the shape of the body masses of all 342 penguins and name any skew. Fifth, suppose each of two penguins picked at random independently has a 0.25 chance of a flipper longer than 220 mm; give the chance that exactly one of them does.

Test the response for these likely failures:

  • Chatbots often state a Gentoo slope, intercept, or r-squared from memory, or reuse the all-penguin line, 49.6856 g per mm with r-squared 0.759, as if it were the Gentoo line.
  • Chatbots often say that because the slope is so significant, a longer flipper makes a penguin heavier.
  • Chatbots often say there is a 95% probability that the population slope lies in 46.69 to 52.69 g per mm, or that 95% of penguins gain that much per millimetre.
  • Chatbots sometimes call the 342 body masses left-skewed because most penguins are on the lighter side, naming the skew by where the pile is.
  • Chatbots often compute 0.25 × 0.75 = 0.1875 for exactly one long-flippered penguin and stop, forgetting that the long-flippered one could be the first pick or the second.

Write 3–5 sentences naming one thing the chatbot got right and at least two places it went wrong or overreached, quoting its words and correcting each with evidence from your own tables or the course's pinned values.

Equivalent route (no AI required)

No AI account is required for this lab. Instead of the chatbot, critique this flawed analysis, printed here in full: "The least-squares line for the Gentoo penguins is ŷ = −5,000 + 47.5x, with r² = 0.81, so flipper length explains 81% of the Gentoo penguins. Because the slope's p-value is far below 0.001, a longer flipper makes a penguin heavier. There is a 95% probability that the population slope is between 46.69 and 52.69 g per mm, and 95% of penguins gain between 46.69 and 52.69 g for each extra millimetre. The body masses of all 342 penguins are left-skewed, because most of the birds are on the lighter side. If each of two penguins independently has a 0.25 chance of a flipper longer than 220 mm, the chance that exactly one of them does is 0.25 × 0.75 = 0.1875." Mark it up: quote each flawed sentence, name what is wrong (an invented statistic or a line borrowed from the wrong group, r² read as a share of birds, cause read from association, a misread confidence statement, a wrong skew claim, or a dropped number of ways), cite the evidence from your tables or the course's pinned values, and write a corrected sentence beneath it. This route assesses the same objectives (Objective 8 and Objective 3) as the chatbot critique, takes comparable effort (about 30 minutes and 200–300 words), is scored by the same scoring criteria for the same credit, and its own submission artifact is the marked-up flawed analysis, posted in place of the chatbot share link and report.

Part 7 — What to Submit

  • All three completed scaffold tables
  • Your residual plot and residual histogram, as charts or labelled sketches, or written descriptions of them
  • Written answers to all five analysis questions
  • The chatbot critique report with its share link, or the equivalent route's marked-up flawed analysis

Deliverable:

A short Data Lab report on one line versus three: three completed tables (the all-penguin line with its test and interval checked against the chapter, the residual plot and histogram described in words, and a separate line for each species), the residual plot and histogram as charts or labelled sketches or written descriptions, written answers to five analysis questions, and a critique of a chatbot's answers about the same data, or, on the equivalent route, a marked-up correction of the printed flawed analysis. Submit in any accessible file type or as a link; a recorded response may be submitted as audio or video with a transcript, or as text. Choose a written, recorded, or visual form for your answers; every form is graded by the same scoring criteria.

Rubric

The rubric below shows how each submitted part is evaluated; bands are full, partial, or none.

Workshop evaluation criteria
Criterion Full Partial None
Rebuilding and checking the all-penguin line The count, slope, intercept, r², residual standard error, SE(b₁), t, and 95% interval are all recorded from the file or the fallback data, each is checked against the chapter, and the slope is written as a predicted change in grams per millimetre. Most values are present, but one or two are missing or wrong, such as x and y swapped in the slope, n − 1 degrees of freedom, or a slope read as the correlation. No values are recorded, or they are invented rather than computed.
Residual plot, histogram, and conditions The residuals are built as observed minus predicted, the residual plot and histogram are shown or described in words with labelled axes, analysis question 2 names the shape of each and the condition each one checks, and anything that gives pause is named honestly. The pictures are present, but the description is vague, a condition is mismatched to its picture, or the residuals are built as predicted minus observed. No residual plot or histogram is shown or described.
Species lines and what they reveal All three species lines are recorded with slope, intercept, r², and flipper range; analysis question 3 explains the larger all-penguin r² through species as a lurking variable; and analysis question 4 correctly labels the 200 mm Gentoo prediction for each line and justifies which line to trust. The species lines are mostly complete, but the comparison does not mention species as a lurking variable, or the interpolation and extrapolation labels are mixed up. The species table is missing, or analysis questions 3 and 4 do not use the student's own tables.
Critique of the chatbot or of the printed flawed analysis On either route, at least two errors are quoted and corrected with evidence from the student's own tables or the course's pinned values, including the causal claim or the misread confidence statement, and one correct point is acknowledged; both routes earn this band equally. On either route, errors are named but corrected without evidence, or only one error is caught. No critique appears, or pasted output is submitted without any checking.
Reflection on what the lines can and cannot show The chosen reflection option is answered in 3–4 sentences that name a specific limit, such as association rather than cause in observed data or a line that should not be used outside its flipper range or across species. The reflection names a limit in general terms without tying it to this lab's lines. No reflection is submitted.

Quality Gate

  • Every slope, intercept, r², and residual comes from your own formulas or the fallback model data, never from memory or a chatbot.
  • Each residual is observed minus predicted, and the residual plot puts flipper length across the bottom.
  • The slope's test uses n − 2 degrees of freedom, and the interval uses the slope plus and minus 1.976 times its standard error.
  • Every slope is read as a predicted change in grams per millimetre, never as the correlation, and r² is read as a share of variation, never as a share of birds.
  • Every prediction is labelled interpolation or extrapolation by checking the flipper range of the line used.
  • The residual plot, histogram, or description labels each axis in words.
  • No statistic, count, or source is invented anywhere in the submission.
  • The critique quotes the chatbot or the flawed analysis and corrects at least two errors with evidence from your tables or the course's pinned values.

Built with The Course Maker · samples.thecoursemaker.com