1. Learn
  2. /
  3. Courses
  4. /
  5. Statistical Thinking in Python (Part 2)

Connected

Exercise

Bootstrap hypothesis test on bee sperm counts

Now, you will test the following hypothesis: On average, male bees treated with neonicotinoid insecticide have the same number of active sperm per milliliter of semen than do untreated male beed. You will use the difference of means as your test statistic.

For your reference, the call signature for the draw_bs_reps() function you wrote in chapter 2 is draw_bs_reps(data, func, size=1).

Instructions

100 XP
  • Compute the mean alive sperm count of control minus that of treated.
  • Compute the mean of all alive sperm counts.
  • Generate shifted data sets for both control and treated such that the shifted data sets have the same mean. This has already been done for you.
  • Generate 10,000 bootstrap replicates of the mean each for the two shifted arrays. Use your draw_bs_reps() function.
  • Compute the bootstrap replicates of the difference of means.
  • The code to compute and print the p-value has been written for you. Hit 'Submit Answer' to see the result!