Bonferroni correction
Improved nutrition and healthcare has lead to increased human heights in most societies over the past century. But is this trend also reflected amongst elite athletes? To examine this, we'll be looking at another slice from our Olympic dataset and performing multiple tests.
You have been provided with the athletes
dataset containing information about American male Olympic athletes from three years: 1924, 1952, and 2016. You will perform two-sample t-tests to compare the three timepoints, seen in boxplots. Between which times do significant differences exist? As you'll be performing multiple non-independent tests, you will need to perform Bonferroni correction on the results. statsmodels
, scipy.stats
, and pandas
have been loaded for you as sm
, stats
, and pd
.
This exercise is part of the course
Performing Experiments in Python
Exercise instructions
- Perform three two-sample t-tests, comparing each possible pair of years.
- Create an array containing the p-values from your three t-tests and print it.
- Perform a Bonferroni correction on the p-values and print the result.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Perform three two-sample t-tests
t_result_1924v2016= ____(____.Height, ____.Height)
t_result_1952v2016= ____
t_result_1924v1952= ____
# Create an array of p-value results
pvals_array = [____, ____, ____]
print(____)
# Perform Bonferroni correction
adjustedvalues = sm.stats.multitest.multipletests(____, alpha=0.05, method=____)
print(____)