LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Inference for Categorical Data in R

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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
  ___
Code bearbeiten und ausführen