Class 10 — Simulating Data

Part III
Quiz 2 opens the class, then Part III begins. You’ll simulate a whole sample of hypothetical participants and compare the resulting distribution of study-level effects to your own HW3 result.
Published

November 17, 2026

Part II ended with your pilot study written up start to finish. Today Part III begins with the tool your final project’s data will come from: simulation. Quiz 2 (covering classes 6–9) opens the class. Then you’ll build a machine that generates what a whole different sample of participants running your study might have looked like: simulate condition means for N hypothetical participants with rnorm(), using the pooled between-subject SD computed from the whole class’s HW3 results, repeat that a thousand times with replicate() to build a distribution of study-level effects, and compare that distribution to your own real HW3 result, thus building informal intuition about power and sample size.

Reading due: Data Skills ch. 10 · Due today: — (HW5 was due Mon 11/9, in the no-class week, so nothing is ever due the same day as a quiz) · Quiz 2 at the start of class

What you’ll be able to do

  1. Recall and apply RStudio/tidyverse fundamentals (including the Git pane), dplyr wrangling, ggplot2 visualization, and reproducible-reporting concepts from Classes 6–9 (Quiz 2).
  2. Explain, in your own words, what a simulation is and why psychologists build fake data on purpose.
  3. Explain why within-subject variability (how noisy one person is, trial to trial) and between-subject variability (how different people’s averages are from each other) are genuinely different things.
  4. Write an R script that draws random samples from specified distributions (rnorm()) to simulate N hypothetical participants’ condition means for a 1-factor/2-level design.
  5. Run that simulation many times (via replicate()) to generate a distribution of study-level effects, and visualize it with ggplot2.
  6. Compare that simulated distribution to your own real HW3 summary result, and describe informally what that comparison suggests about power and sample size.
Back to top