Precept Week 01

Software Setup and Randomization Tests

POL346
2021-04-19

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 http://pol346.com/chapter1.html

  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 https://moderndive.com

Coding help: load packages & data

# load packages
suppressMessages(library(dplyr))
suppressMessages(library(janitor))
library(infer)

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

# view data
creativity %>% head(2)