Bootstrap-toetsen van hypothesen

Statistical Thinking in Python (deel 2)

Justin Bois

Lecturer at the California Institute of Technology

Stappenplan voor hypothesetoetsen

  • Formuleer de nulhypothese duidelijk
  • Definieer je toetsstatistiek
  • Genereer veel gesimuleerde datasets onder de nulhypothese
  • Bereken de toetsstatistiek voor elke simulatie
  • De p-waarde is het aandeel simulaties waarbij de statistiek minstens zo extreem is als bij de echte data
Statistical Thinking in Python (deel 2)

Michelson en Newcomb: pioniers van de lichtsnelheid

ch3-3.008.png

1 Afbeelding Michelson: publiek domein, Smithsonian 2 Afbeelding Newcomb: US Library of Congress
Statistical Thinking in Python (deel 2)

Michelson en Newcomb: pioniers van de lichtsnelheid

ch3-3.010.png

1 Afbeelding Michelson: publiek domein, Smithsonian 2 Afbeelding Newcomb: US Library of Congress
Statistical Thinking in Python (deel 2)

De data die we hebben

ch3-3.011.png

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

Nulhypothese

  • De werkelijke gemiddelde lichtsnelheid in Michelsons experimenten was Newcombs gerapporteerde waarde
Statistical Thinking in Python (deel 2)

Michelson-data verschuiven

newcomb_value = 299860  # km/s
michelson_shifted = michelson_speed_of_light \\
           - np.mean(michelson_speed_of_light) + newcomb_value

ch3-3.019.png

Statistical Thinking in Python (deel 2)

Toetsstatistiek berekenen

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
Statistical Thinking in Python (deel 2)

p-waarde berekenen

bs_replicates = draw_bs_reps(michelson_shifted,
                             diff_from_newcomb, 10000)

p_value = np.sum(bs_replicates <= diff_observed) / 10000
p_value
0.16039999999999999
Statistical Thinking in Python (deel 2)

 

Één-steekproeftoets

- Vergelijk één dataset met één getal

 

Twee-steekproeftoets

- Vergelijk twee datasets
Statistical Thinking in Python (deel 2)

Laten we oefenen!

Statistical Thinking in Python (deel 2)

Preparing Video For Download...