Exploring sample size
Now we'll explore the effect of sample size on the results of statistical tests. Here, we'll be comparing the Weight
of American Athletics
and Swimming
competitors in the athletes
dataset. The boxplots show the difference between these two groups.
Using a defined seed and varying sample sizes, you will perform t-tests comparing the Weight
of samples from both Sport
s. random
, scipy.stats
, and pandas
have been loaded for you as random
, stats
, and pd
.
This exercise is part of the course
Performing Experiments in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create subset with defined random seed and perform t-test
subset = athletes.sample(n=____, random_state= 1007)
print(stats.ttest_ind(____[____.Sport == "Athletics"].Weight, ____ ))