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
.
This exercise is part of the course
Foundations of Inference in R
Exercise instructions
Calculate the two-sided p-value. This is double the one-sided p-value that you calculated in previous exercises.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate the two-sided p-value
disc_perm %>%
summarize(p_value = ___)