Permutation test: wild type versus heterozygote
Test the hypothesis that the heterozygote and wild type bout lengths are identically distributed using a permutation test.
This exercise is part of the course
Case Studies in Statistical Thinking
Exercise instructions
- Compute the difference of means (heterozygote minus wild type bout lengths) of the actual datasets, storing the result in the variable
diff_means_exp
. Thenumpy
arraysbout_lengths_wt
andbout_lengths_het
are already in your namespace. - Draw 10,000 permutation replicates of the difference of means using
dcst.draw_perm_reps()
. You can use thedcst.diff_of_means()
function as well, storing your result inperm_reps
. - Compute the p-value, defining "at least as extreme as" to be that the difference of means under the null hypothesis is greater than or equal to that which was observed experimentally.
- Print the p-value to the screen.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Compute the difference of means: diff_means_exp
diff_means_exp = ____ - ____
# Draw permutation replicates: perm_reps
perm_reps = ____(____, ____,
____, size=____)
# Compute the p-value: p-val
p_val = ____(____ >= ____) / len(____)
# Print the result
print('p =', p_val)