Labs

The hands-on resampling and robustness strand

The labs are where the methods become something you do. Four short labs in R and Quarto take a method from the notes and let you build it from the ground up — shuffle the labels yourself, resample with replacement yourself, fit a robust line yourself, and watch a simulation tell you how a method behaves. The code is shown for study and is not executed on this site; you run it in your own R session, where the numbers come alive.

How the labs work

Each lab is the hands-on companion to a specific week’s note, and follows the same shape:

  • Purpose. A short blockquote linking the companion note and stating what you will build.
  • The idea. The method’s logic in plain language — what is being resampled, ranked, or downweighted, and what question the lab answers.
  • Goal, Setup, Steps. A fixed seed (set.seed(45203)), the synthetic dataset, then three or more steps that build the procedure one move at a time, with shown R at each step.
  • Verify. A checklist that reconciles your output against the companion note’s locked numbers — a mismatch is a bug in your code, not a discovery about the world.
  • AI use note. A Tool / Purpose / Verification table, because verification is the load-bearing habit of the course.

The four labs

  1. Lab 4 — Build a randomization test — shuffle the group labels of the wait-time data to build a reference distribution and read a randomization p-value.
  2. Lab 5 — Bootstrap the median — resample with replacement to see the median’s lumpy bootstrap distribution and estimate its standard error.
  3. Lab 11 — Robust regression vs least squares — watch two contaminating points flatten the least-squares line while a robust fit holds.
  4. Lab 13 — A method-comparison simulation — simulate Type I error, power, and coverage for several methods across data-generating processes.

Software

You need only R (via RStudio or Posit Cloud) and, optionally, Quarto to knit a report. The labs use base R plus a small number of widely available functions; where a package is mentioned (for a robust fit, say), the note names it. Every chunk that draws randomness starts with set.seed(45203), so your run reproduces the companion note’s locked numbers.

Public vs. graded

These labs are public and ungraded — study and practice material only. The graded lab deliverables, their rubrics, and their due dates live in Blackboard (the LMS), which is authoritative for submissions and grades. If a lab page and Blackboard ever disagree, follow Blackboard.