The Horror Movie Shuffle

Lab 2E

Directions: Follow along with the slides and answer the questions in red font in your journal.

Playing with permutations

Initial thoughts…

Tally whoa … !

tally(gender ~ survival, data = slasher, margin = TRUE)
tally(survival ~ gender, data = slasher, margin = TRUE)
tally(survival ~ gender, format = "percent", data = slasher, margin = TRUE)
##           gender
## survival      Female      Male
##   Dies      77.47748  86.69202
##   Survives  22.52252  13.30798
##   Total    100.00000 100.00000

Examining differences

Do the shuffle!

tally(survival ~ gender, data = slasher)
tally(shuffle(survival) ~ gender, 
      data = slasher)

Let’s compare …

Detecting differences

Run the following lines of code:

set.seed(7)
shuffled_outcomes <- do(10) * tally(shuffle(survival) ~ gender, format = "percent", 
                                    data = slasher)
View(shuffled_outcomes)

Now what?

shuffled_survivors <- mutate(shuffled_survivors, 
            diff = ____ - ____)

Time to decide

add_line(vline = 22.52252 - 13.30798)

Summary

On your own