Created
April 17, 2023 13:58
-
-
Save jeanbaptisteb/5f8c9afa26217af6673a7f3dcb2d31d2 to your computer and use it in GitHub Desktop.
Cohen's h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#function to calculate Cohen's h (effect size for measuring distance between two proportions) | |
#https://en.wikipedia.org/wiki/Cohen's_h | |
import numpy as np | |
def cohenH(p1,p2): | |
phi1 = 2*np.arcsin(np.sqrt(p1)) | |
phi2 = 2*np.arcsin(np.sqrt(p2)) | |
h = phi1 - phi2 | |
return h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment