Een hypothese formuleren en simuleren

Statistical Thinking in Python (deel 2)

Justin Bois

Lecturer at the California Institute of Technology

Verkiezingsuitslagen swing states VS, 2008

ch3-1.002.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

ch3-1.004.png

Statistical Thinking in Python (deel 2)

Hypothesetoetsing

  • Beoordeling van hoe aannemelijk de waarnemingen zijn als een hypothese waar is
Statistical Thinking in Python (deel 2)

Nulhypothese

  • Andere naam voor de hypothese die je toetst
Statistical Thinking in Python (deel 2)

ECDF’s van verkiezingsuitslagen in swing states

ch3-1.009.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

Percentage stemmen voor Obama

ch3-1.011.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

De hypothese simuleren

ch3-1.013.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

De hypothese simuleren

ch3-1.015.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

De hypothese simuleren

ch3-1.017.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

De hypothese simuleren

ch3-1.019.png

Statistical Thinking in Python (deel 2)

Permutatie

  • Willekeurige herordening van items in een array
Statistical Thinking in Python (deel 2)

Een permutatiesteekproef genereren

import numpy as np
dem_share_both = np.concatenate(
                       (dem_share_PA, dem_share_OH))

dem_share_perm = np.random.permutation(dem_share_both)
perm_sample_PA = dem_share_perm[:len(dem_share_PA)] perm_sample_OH = dem_share_perm[len(dem_share_PA):]
Statistical Thinking in Python (deel 2)

Laten we oefenen!

Statistical Thinking in Python (deel 2)

Preparing Video For Download...