R together: is this coin fair?
Everyone in your group edits the same R code. Anyone can press Run; the text output appears for the whole group. R runs in your browser.
Your task
- Run the code. How many heads did you get in 100 flips?
- Change
nto 10, then 10000. What happens to the proportion of heads? - The file
flips.csvholds the class's results: each of 20 students flipped coins A, B and C 100 times. Read it withread.csv("flips.csv")and compare the coins withaggregate(). - Is one coin unfair? Try
binom.test()on its total heads, and draw aboxplot(heads ~ coin, data = flips).
Data file: flips.csv (60 rows)
Plots show for the person who pressed Run. Others can press Run to see them too.
Reflect
In your own words: what does the p-value from binom.test() tell you about coin C, and what doesn't it tell you? Would 20 flips per student have been enough to notice? Why or why not?