Statistical Thinking in Python (Part 2)
Justin Bois
Lecturer at the California Institute of Technology
newcomb_value = 299860 # km/s
michelson_shifted = michelson_speed_of_light \\
- np.mean(michelson_speed_of_light) + newcomb_value
def diff_from_newcomb(data, newcomb_value=299860):
return np.mean(data) - newcomb_value
diff_obs = diff_from_newcomb(michelson_speed_of_light)
diff_obs
-7.5999999999767169
bs_replicates = draw_bs_reps(michelson_shifted, diff_from_newcomb, 10000)
p_value = np.sum(bs_replicates <= diff_observed) / 10000
p_value
0.16039999999999999
- Compare one set of data to a single number
- Compare two sets of data
Statistical Thinking in Python (Part 2)