Skip to content

Commit 58ab0cc

Browse files
committed
cohens h plot
1 parent 16529c8 commit 58ab0cc

6 files changed

Lines changed: 377 additions & 98 deletions

File tree

dabest/_classes.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ class TwoGroupsEffectSize(object):
15701570
mean differences between two groups.
15711571
"""
15721572

1573-
def __init__(self, control, test, effect_size,
1573+
def __init__(self, control, test, effect_size,proportional,
15741574
is_paired=None, ci=95,
15751575
resamples=5000,
15761576
permutation_count=5000,
@@ -1732,6 +1732,14 @@ def __init__(self, control, test, effect_size,
17321732
err1 = "`paired` is not None; therefore Cliff's delta is not defined."
17331733
raise ValueError(err1)
17341734

1735+
if proportional==True and effect_size not in ['mean_diff','cohens_h']:
1736+
err1 = "`proportional` is True; therefore effect size other than mean_diff and cohens_h is not defined."
1737+
raise ValueError(err1)
1738+
1739+
if proportional==True and (np.isin(control, [0, 1]).all() == False or np.isin(test, [0, 1]).all() == False):
1740+
err1 = "`proportional` is True; Only accept binary data consisting of 0 and 1."
1741+
raise ValueError(err1)
1742+
17351743
# Convert to numpy arrays for speed.
17361744
# NaNs are automatically dropped.
17371745
control = array(control)
@@ -2425,6 +2433,7 @@ def __pre_calc(self):
24252433

24262434
result = TwoGroupsEffectSize(control, test,
24272435
self.__effect_size,
2436+
self.__proportional,
24282437
self.__is_paired,
24292438
self.__ci,
24302439
self.__resamples,

dabest/_stats_tools/effsize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ def cohens_h(control, test):
278278
phi_control = 2 * np.arcsin(np.sqrt(prop_control))
279279
phi_test = 2 * np.arcsin(np.sqrt(prop_test))
280280

281-
282-
return phi_control - phi_test
281+
return phi_test - phi_control
282+
# return phi_control - phi_test
283283

284284

285285

0 commit comments

Comments
 (0)