LoslegenKostenlos loslegen

Calculating two-sided p-values

What if the original research hypothesis had focused on any difference in promotion rates between men and women instead of focusing on whether men are more likely to be promoted than women? In this case, a difference like the one observed would occur twice as often (by chance) because sometimes the difference would be positive and sometimes it would be negative.

When there is no directionality to the alternative hypothesis, the hypothesis and p-value are considered to be two-sided. In a two-sided setting, the p-value is double the one-sided p-value.

In this exercise, you'll calculate a two-sided p-value given the original randomization distribution and dataset.

The observed difference is stored in diff_orig and the difference in each permutation is the stat column of disc_perm.

Diese Übung ist Teil des Kurses

Foundations of Inference in R

Kurs anzeigen

Anleitung zur Übung

Calculate the two-sided p-value. This is double the one-sided p-value that you calculated in previous exercises.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Calculate the two-sided p-value
disc_perm %>%
  summarize(p_value = ___)
Code bearbeiten und ausführen