Labs
The simulation strand (R + Quarto), in support of probability reasoning
The labs are the course’s simulation strand. They run alongside the notes, not instead of them: where the notes derive a result by hand, a lab lets you watch that result emerge by generating data and counting what happens. Simulation is a check on your reasoning and a way to build intuition — it supports the probability, it does not replace it. There are four labs across the term, each tied to a specific week.
How a lab works
Every lab is built the same way, so you always know where you are:
- Goal. What the simulation is meant to show, stated in one or two sentences and linked back to the companion week.
- Setup. The small bit of preparation you need — the random seed, any quantities to define, and the situation you are modeling.
- Steps. The simulation itself, broken into numbered steps with shown R code. You read the code, understand each piece, then run it yourself.
- Verify. A check that the simulated answer matches the theory from the notes — the moment where computation and reasoning meet.
- AI Use Note. A short record of any AI help, with three parts — Tool, Purpose, and Verification — where verification (how you checked the output yourself) is the load-bearing field.
A note on the code: in these labs the R chunks are shown for study, written in base R with a fixed seed (set.seed(35003)) so they are reproducible. They are not executed on this site — you run them in your own R session. See the R · Quarto setup page to get going.
The labs
The four labs accompany the simulation-heavy weeks:
- Lab 2 — Monte Carlo basics. Estimating a probability by repeated trials and counting. (Accompanies Week 2.)
- Lab 5 — Bayes by simulation. Recovering a posterior probability by simulating the population. (Accompanies Week 5.)
- Lab 9 — Simulating discrete models. Generating draws from binomial and Poisson models and comparing to the formulas. (Accompanies Week 9.)
- Lab 13 — Law of large numbers and CLT. Watching averages settle and sums turn bell-shaped. (Accompanies Week 13.)
Public vs. graded
The labs here are public study material; the graded deliverable, its rubric, and due date live in Blackboard (the LMS) — this page is study and practice only.