Session Ready
Exercise

Blocking

We're going to have another look at the same data but, this time, we'll use blocking to improve our approach. Like last time, you'll be using a two-sample t-test on athlete Weight within your DataFrame, athletes. This time, however, you will control for Sex as a blocking factor, sampling equally from male and female participants. You will need to extract a random subset of athletes from both events to run your test. pandas, scipy.stats, plotnine, and random have been loaded into the workspace as pd, stats, p9, and ran, respectively.

Instructions
100 XP
  • Create four subset DataFrames from athletes, with 15 randomly chosen samples in each, corresponding to each of the four possible combinations of Sex and Sport.
  • Concatenate the two Athletics blocks and the two Swimming blocks to create two DataFrames to compare, each containing 30 samples.
  • Perform a two-sample t-test, comparing Weight between sports and print the output.