Precept Week 01

Software Setup and Randomization Tests


Have you knit an R Markdown document?

Have you customized R and RStudio?

All set-up? Analyze Chapter 1: Creativity study

Exercise: Assess whether observed difference in means is extreme with a randomization test

Question: Does the mean level of creativity differ between the intrinsic treatment group and the control group?

  1. With Base R t.test(), calculate whether there is a significant difference-in-means

  2. Randomize treatment assignment and calculate a new difference-in-means. See Chapter 1 supplement at

  3. Now, repeat Step 2 ten times. How do these results compare to observed difference-in-means?

  4. Randomize treatment assignment and calculate difference-in-means 1,000 times, plot histogram of differences

  5. With infer calculate randomization distribution and plot histogram of differences. For more about infer, see

Coding help: load packages & data

# load packages

# load data
creativity <- Sleuth2::case0101 %>% # chapter 01, case 01

# view data
creativity %>% head(2)