ComenzarEmpieza gratis

Building two null distributions

To get a sense of the full distribution that the chi-squared test statistic can take under this hypothesis, you need to generate many more datasets.

Do this by first adding onto your work from the previous exercise with the natspac variable, then conduct a second hypothesis test to see if party is independent of natarms. Once you have both null distributions, you can visualize them to see if they're consistent with your observed statistics.

Este ejercicio forma parte del curso

Inference for Categorical Data in R

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Create null
___ <- gss_party %>%
  specify(natspac ~ party) %>%
  hypothesize(null = "independence") %>%
  generate(reps = ___, type = "permute") %>%
  calculate(stat = "Chisq")

# Visualize null
___ +
  # Add density layer
  ___ +
  # Add vertical line at obs stat
  ___
Editar y ejecutar código