Session Ready
Exercise

Hypothesis test: Are beaks deeper in 2012?

Your plot of the ECDF and determination of the confidence interval make it pretty clear that the beaks of G. scandens on Daphne Major have gotten deeper. But is it possible that this effect is just due to random chance? In other words, what is the probability that we would get the observed difference in mean beak depth if the means were the same?

Be careful! The hypothesis we are testing is not that the beak depths come from the same distribution. For that we could use a permutation test. The hypothesis is that the means are equal. To perform this hypothesis test, we need to shift the two data sets so that they have the same mean and then use bootstrap sampling to compute the difference of means.

Instructions
100 XP
  • Make a concatenated array of the 1975 and 2012 beak depths and compute and store its mean.
  • Shift bd_1975 and bd_2012 such that their means are equal to the one you just computed for the combined data set.
  • Take 10,000 bootstrap replicates of the mean each for the 1975 and 2012 beak depths.
  • Subtract the 1975 replicates from the 2012 replicates to get bootstrap replicates of the difference.
  • Compute and print the p-value. The observed difference in means you computed in the last exercise is still in your namespace as mean_diff.