1. Learn
  2. /
  3. Courses
  4. /
  5. Case Studies in Statistical Thinking

Connected

Exercise

Hypothesis test: Do women swim the same way in semis and finals?

Test the hypothesis that performance in the finals and semifinals are identical using the mean of the fractional improvement as your test statistic. The test statistic under the null hypothesis is considered to be at least as extreme as what was observed if it is greater than or equal to f_mean, which is already in your namespace.

The semifinal and final times are contained in the numpy arrays semi_times and final_times.

Instructions

100 XP
  • Set up an empty array to contain 1000 permutation replicates using np.empty(). Call this array perm_reps.
  • Write a for loop to generate permutation replicates.
    • Generate a permutation sample using the swap_random() function you just wrote. Store the arrays in semi_perm and final_perm.
    • Compute the value of f from the permutation sample.
    • Store the mean of the permutation sample in the perm_reps array.
  • Compute the p-value and print it to the screen.