Formuler et simuler une hypothèse

Réflexion statistique en Python (Partie 2)

Justin Bois

Lecturer at the California Institute of Technology

Résultats des swing states US en 2008

ch3-1.002.png

1 Données récupérées sur Data.gov (https://www.data.gov/)
Réflexion statistique en Python (Partie 2)

ch3-1.004.png

Réflexion statistique en Python (Partie 2)

Test d'hypothèse

  • Évaluer à quel point les données observées sont plausibles en supposant une hypothèse vraie
Réflexion statistique en Python (Partie 2)

Hypothèse nulle

  • Autre nom de l'hypothèse que vous testez
Réflexion statistique en Python (Partie 2)

ECDF des résultats des swing states

ch3-1.009.png

1 Données récupérées sur Data.gov (https://www.data.gov/)
Réflexion statistique en Python (Partie 2)

Pourcentage de voix pour Obama

ch3-1.011.png

1 Données récupérées sur Data.gov (https://www.data.gov/)
Réflexion statistique en Python (Partie 2)

Simuler l'hypothèse

ch3-1.013.png

1 Données récupérées sur Data.gov (https://www.data.gov/)
Réflexion statistique en Python (Partie 2)

Simuler l'hypothèse

ch3-1.015.png

1 Données récupérées sur Data.gov (https://www.data.gov/)
Réflexion statistique en Python (Partie 2)

Simuler l'hypothèse

ch3-1.017.png

1 Données récupérées sur Data.gov (https://www.data.gov/)
Réflexion statistique en Python (Partie 2)

Simuler l'hypothèse

ch3-1.019.png

Réflexion statistique en Python (Partie 2)

Permutation

  • Réorganisation aléatoire des éléments d'un tableau
Réflexion statistique en Python (Partie 2)

Générer un échantillon par permutation

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):]
Réflexion statistique en Python (Partie 2)

Passons à la pratique !

Réflexion statistique en Python (Partie 2)

Preparing Video For Download...