When the null is true
In this exercise, you will run an experiment: what happens when you conduct a hypothesis test when you know that the null hypothesis is true? You hope that you will retain the null hypothesis, but there's always a chance that you will make a statistical error.
To begin the experiment, we have created a new explanatory variable called coinflip
that captures the result of a fair coin toss for every subject. With that variable in hand you can pose the following null hypothesis:
$$ H_{0}: p_{heads} - p_{tails} = 0 $$
This claims that there is no difference in the proportions that favor the death penalty between the people that flipped "heads"
and those that flipped "tails"
. Since coinflip
was formed independently of cappun
, we know that this null hypothesis is true. The question is: will your test reject or retain this null hypothesis?
Cet exercice fait partie du cours
Inference for Categorical Data in R
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Inspect coinflip
gssmod %>%
select(coinflip)
# Compute two proportions
___ <- gssmod %>%
group_by(coinflip) %>%
summarize(prop_favor = mean(___ == ___)) %>%
pull()
# See the result
p_hats