Randomizing opportunity cost
As in Chapter 2 Exercise 5, you will permute the data to generate a distribution of differences as if the null hypothesis were true.
In the study, the number of individuals in each of the control and treatment groups is fixed. Additionally, when you assume that the null hypothesis is true—that is, the experiment had no effect on the outcome of buying a DVD—it is reasonable to infer that the number of individuals who would buy a DVD is also fixed. That is, 97 people were going to buy a DVD regardless of which treatment group they were in.
Using the new data and the methods from the previous chapter, create a randomization distribution of the difference in proportions calculated on permuted data.
Este ejercicio forma parte del curso
Foundations of Inference in R
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Calculate the observed difference in purchase rate
diff_obs <- opportunity %>%
# Group by group
___(___) %>%
# Calculate proportion deciding to buy a DVD
___(prop_buy = ___(___)) %>%
# Calculate difference between groups
___(stat = ___) %>%
pull()