Exercise

Fisher's exact test

Now, you'll work with the Olympics dataset to look at the relative success of the American swimming and athletics teams. Whether each athlete received a medal is coded as True or False in the MedalTF column of athletes. Do a larger proportion of swimming or athletics participants come home with medals? A Fisher exact test is a useful way to compare proportions of samples falling into discrete categories. To test this, you'll need to perform a Fisher exact test on MedalTF in relation to Sport. pandas and plotnine have already been imported as pd and p9.

Instructions

100 XP
  • Using the crosstab() function, produce a cross-tabulation of MedalTF against Sport, save the result as table and print() it.
  • Perform a fisher_exact() test on table and print the result.
  • Compare the p-value to the given alpha and print the message.