Skip to content

Commit 9be14c2

Browse files
committed
Merge remote-tracking branch 'origin/propplot'
# Conflicts: # dabest/_stats_tools/effsize.py
2 parents 2fea25c + 8a47196 commit 9be14c2

4 files changed

Lines changed: 62 additions & 98 deletions

File tree

dabest/_classes.py

Lines changed: 11 additions & 2 deletions
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,
@@ -2615,7 +2624,7 @@ def plot(self, color_col=None,
26152624
halfviolin_alpha=0.8,
26162625

26172626
#bar plot
2618-
bar_label=None, bar_desat=0.5, bar_width = 0.5,bar_ylim = None,
2627+
bar_label=None, bar_desat=0.8, bar_width = 0.5,bar_ylim = None,
26192628
# error bar of proportion plot
26202629
ci=None, err_color=None,
26212630

dabest/_stats_tools/effsize.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ def cohens_h(control, test):
276276
phi_control = 2 * np.arcsin(np.sqrt(prop_control))
277277
phi_test = 2 * np.arcsin(np.sqrt(prop_test))
278278

279-
280279
return phi_test - phi_control
281280

282281

0 commit comments

Comments
 (0)