CommencerCommencer gratuitement

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"))`

Cet exercice fait partie du cours

Inference for Categorical Data in R

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Create the bootstrap distribution
___ <- gss2016 %>%
  # Specify the variables and success
  ___ %>%
  # Generate 500 bootstrap reps
  ___ %>%
  # Calculate statistics
  ___
Modifier et exécuter le code