Generating bootstrap replicates

Statistical Thinking in Python (Part 2)

Justin Bois

Lecturer at the California Institute of Technology

Michelson's speed of light measurements

ch2-1.002.png

1 Data: Michelson, 1880
Statistical Thinking in Python (Part 2)

Resampling an array

ch2-1.004.png

Statistical Thinking in Python (Part 2)

Resampling an array

ch2-1.005.png

Statistical Thinking in Python (Part 2)

Resampling an array

ch2-1.006.png

Statistical Thinking in Python (Part 2)

Resampling an array

ch2-1.007.png

Statistical Thinking in Python (Part 2)

Resampling an array

ch2-1.008.png

Statistical Thinking in Python (Part 2)

Resampling an array

ch2-1.009.png

Statistical Thinking in Python (Part 2)

Resampling an array

ch2-1.010.png

Statistical Thinking in Python (Part 2)

Mean of resampled Michelson measurements

ch2-1.011.png

Statistical Thinking in Python (Part 2)

Bootstrapping

  • The use of resampled data to perform statistical inference
Statistical Thinking in Python (Part 2)

Bootstrap sample

  • A resampled array of the data
Statistical Thinking in Python (Part 2)

Bootstrap replicate

  • A statistic computed from a resampled array
Statistical Thinking in Python (Part 2)

Resampling engine: np.random.choice()

import numpy as np
np.random.choice([1,2,3,4,5], size=5)
array([5, 3, 5, 5, 2])
Statistical Thinking in Python (Part 2)

Computing a bootstrap replicate

bs_sample = np.random.choice(michelson_speed_of_light,
                             size=100)

np.mean(bs_sample)
299847.79999999999
np.median(bs_sample)
299845.0
np.std(bs_sample)
83.564286025729331
Statistical Thinking in Python (Part 2)

Let's practice!

Statistical Thinking in Python (Part 2)

Preparing Video For Download...