Class 9 — Simulation

Part III
Stop describing the one dataset you collected and start generating hundreds of pretend ones — build a simulation in R and compare its distribution of effects to your own real result.
Published

November 3, 2026

PART III · CLASS 9

So far you’ve described the one dataset you actually collected. Today you build a machine that can generate hundreds of pretend datasets, so you can see how much your one real result could have wobbled by chance alone. You’ll simulate two-condition data with rnorm(), repeat it a thousand times with replicate(), visualize the resulting distribution, and then compare that distribution to your own real HW4 result — building informal intuition about power and sample size.

Reading due: Data Skills ch. 15; ch. 13 (optional) · Due today:

What you’ll be able to do

  1. Explain, in your own words, what a simulation is and why psychologists build fake data on purpose.
  2. Write an R script that draws random samples from specified distributions (e.g., rnorm()) for the two conditions of a 1-factor/2-level design.
  3. Run that simulation many times (via replicate() or a loop) and visualize the resulting distribution of effects, building intuition for sampling variability.
  4. Compare a simulated distribution of effects to your own real HW4 summary result, and describe informally what that comparison suggests about power and sample size.
  5. Understand what HW5 asks of you and how it connects your real HW4 data to a simulated dataset for your own design.
Back to top