Exercise

Permutation practice

Are NBA players heavier than US adult males? You are now interested in calculating the 95% confidence interval of the mean difference (in kilograms) between NBA players and US adult males. You'll use the two lists provided.

Permutation is great when testing for difference, so that's the resampling method you'll use here!

nba_weights = [96.7, 101.1, 97.9, 98.1, 98.1, 100.3, 101.0, 98.0, 97.4, 100.5, 100.3, 100.2, 100.6]
us_adult_weights = [75.1, 100.1, 95.2, 81.0, 72.0, 63.5, 80.0, 97.1, 94.3, 80.3, 93.5, 85.8, 95.1]

Note that each of the above lists has 13 weights listed.

The following have been imported for you: random, numpy as np, seaborn as sns, and matplotlib.pyplot as plt.

Instructions

100 XP
  • Define all_weights as a list which contains the values from both nba_weights and us_adult_weights.
  • Perform the permutation on all_weights using np.random.permutation().
  • Assign the first 13 permutated samples to perm_nba and the remaining 13 to perm_adult.