Skip to content

Instantly share code, notes, and snippets.

@jeanbaptisteb
Created April 17, 2023 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeanbaptisteb/5f8c9afa26217af6673a7f3dcb2d31d2 to your computer and use it in GitHub Desktop.
Save jeanbaptisteb/5f8c9afa26217af6673a7f3dcb2d31d2 to your computer and use it in GitHub Desktop.
Cohen's h
#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