Hypothesis tests and confidence intervals
As was mentioned at the very beginning of this chapter, there is a close link between hypothesis tests and confidence intervals. The former explores whether a particular hypothesis about the world is consistent with your data. The latter has no hypothesis, it simply quantifies your uncertainty in your point estimate by adding and subtracting the margin of error.
In this exercise you will explore the duality by forming a confidence interval around the difference in proportions, d_hat
. To get you started, here is the code that you used to form the null distribution:
# Reference code for null distribution
null <- gss2016 %>%
specify(cappun ~ sex, success = "FAVOR") %>%
hypothesize(null = "independence") %>%
generate(reps = 500, type = "permute") %>%
calculate(stat = "diff in props", order = c("FEMALE", "MALE"))`
Este ejercicio forma parte del curso
Inference for Categorical Data in R
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Create the bootstrap distribution
___ <- gss2016 %>%
# Specify the variables and success
___ %>%
# Generate 500 bootstrap reps
___ %>%
# Calculate statistics
___