Get startedGet started for free

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.

Boxplots of body weights of Olympic athletes from two sports

Using a defined seed and varying sample sizes, you will perform t-tests comparing the Weight of samples from both Sports. 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

View Course

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, ____ ))
Edit and Run Code