Exercise

# How should we test the hypothesis?

You are interested in the presence of lane bias toward higher lanes, presumably due to a slight current in the pool. A natural null hypothesis to test, then, is that the mean fractional improvement going from low to high lane numbers is zero. Which of the following is a good way to simulate this null hypothesis?

As a reminder, the arrays `swimtime_low_lanes`

and `swimtime_high_lanes`

contain the swim times for lanes 1-3 and 6-8, respectively, and we define the fractional improvement as `f = (swimtime_low_lanes - swimtime_high_lanes) / swimtime_low_lanes`

.

Instructions

### Possible answers

Randomly swap

`swimtime_low_lanes[i]`

and `swimtime_high_lanes[i]`

with probability 0.5. From these randomly swapped arrays, compute the fractional improvement. The test statistic is the mean of this new `f`

array.Scramble the entries in the

`swimtime_high_lanes`

, and recompute `f`

from the scrambled array and the `swimtime_low_lanes`

array. The test statistic is the mean of this new `f`

array.Shift the

`swimtime_low_lanes`

and `swimtime_high_lanes`

arrays by adding a constant value to each so that the shifted arrays have the same mean. Compute the fractional improvement, `f_shift`

, from these shifted arrays. Then, take a bootstrap replicate of the mean from `f_shift`

.Subtract the mean of

`f`

from `f`

to generate `f_shift`

. Then, take bootstrap replicate of the mean from this `f_shift`

.Either (3) or (4) will work; they are equivalent.