Skip to content

Commit e0c487b

Browse files
authored
Merge pull request #89 from ACCLAB/v0.2.8
v0.2.8
2 parents e6cd4b8 + 270519c commit e0c487b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+218
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3+
.idea/*
34
*.py[cod]
45
*$py.class
56

dabest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
from ._stats_tools import effsize as effsize
2424
from ._classes import TwoGroupsEffectSize
2525

26-
__version__ = "0.2.7"
26+
__version__ = "0.2.8"

dabest/_classes.py

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ def __init__(self, control, test, effect_size,
449449
'pct_low': -0.763588353717278,
450450
'pvalue_brunner_munzel': nan,
451451
'pvalue_kruskal': nan,
452+
'pvalue_lqrt_paired': nan,
453+
'pvalue_lqrt_unpaired_equal_variance': 0.36,
454+
'pvalue_lqrt_unpaired_unequal_variance': 0.36,
452455
'pvalue_mann_whitney': 0.2600723060808019,
453456
'pvalue_paired_students_t': nan,
454457
'pvalue_students_t': 0.34743913903372836,
@@ -458,6 +461,9 @@ def __init__(self, control, test, effect_size,
458461
'resamples': 5000,
459462
'statistic_brunner_munzel': nan,
460463
'statistic_kruskal': nan,
464+
'statistic_lqrt_paired': nan,
465+
'statistic_lqrt_unpaired_equal_variance': 0.8894980773231964,
466+
'statistic_lqrt_unpaired_unequal_variance': 0.8916901409507432,
461467
'statistic_mann_whitney': 406.0,
462468
'statistic_paired_students_t': nan,
463469
'statistic_students_t': 0.9472545159069105,
@@ -470,6 +476,7 @@ def __init__(self, control, test, effect_size,
470476
from numpy.random import choice, seed
471477

472478
import scipy.stats as spstats
479+
import lqrt
473480

474481
# import statsmodels.stats.power as power
475482

@@ -601,6 +608,12 @@ def __init__(self, control, test, effect_size,
601608
wilcoxon = spstats.wilcoxon(control, test)
602609
self.__pvalue_wilcoxon = wilcoxon.pvalue
603610
self.__statistic_wilcoxon = wilcoxon.statistic
611+
612+
lqrt_result = lqrt.lqrtest_rel(control, test,
613+
random_state=random_seed)
614+
615+
self.__pvalue_paired_lqrt = lqrt_result.pvalue
616+
self.__statistic_paired_lqrt = lqrt_result.statistic
604617

605618
if effect_size != "median_diff":
606619
# Paired Student's t-test.
@@ -658,7 +671,24 @@ def __init__(self, control, test, effect_size,
658671
# in terms of rank (eg. all zeros.)
659672
pass
660673

674+
# Likelihood Q-Ratio test:
675+
lqrt_equal_var_result = lqrt.lqrtest_ind(control, test,
676+
random_state=random_seed,
677+
equal_var=True)
678+
679+
self.__pvalue_lqrt_equal_var = lqrt_equal_var_result.pvalue
680+
self.__statistic_lqrt_equal_var = lqrt_equal_var_result.statistic
681+
682+
lqrt_unequal_var_result = lqrt.lqrtest_ind(control, test,
683+
random_state=random_seed,
684+
equal_var=False)
685+
686+
self.__pvalue_lqrt_unequal_var = lqrt_unequal_var_result.pvalue
687+
self.__statistic_lqrt_unequal_var = lqrt_unequal_var_result.statistic
688+
689+
661690
standardized_es = es.cohens_d(control, test, is_paired=False)
691+
662692
# self.__power = power.tt_ind_solve_power(standardized_es,
663693
# len(control),
664694
# alpha=self.__alpha,
@@ -968,6 +998,65 @@ def statistic_mann_whitney(self):
968998

969999

9701000

1001+
1002+
@property
1003+
def pvalue_lqrt_paired(self):
1004+
from numpy import nan as npnan
1005+
try:
1006+
return self.__pvalue_paired_lqrt
1007+
except AttributeError:
1008+
return npnan
1009+
1010+
1011+
1012+
@property
1013+
def statistic_lqrt_paired(self):
1014+
from numpy import nan as npnan
1015+
try:
1016+
return self.__statistic_paired_lqrt
1017+
except AttributeError:
1018+
return npnan
1019+
1020+
1021+
@property
1022+
def pvalue_lqrt_unpaired_equal_variance(self):
1023+
from numpy import nan as npnan
1024+
try:
1025+
return self.__pvalue_lqrt_equal_var
1026+
except AttributeError:
1027+
return npnan
1028+
1029+
1030+
1031+
@property
1032+
def statistic_lqrt_unpaired_equal_variance(self):
1033+
from numpy import nan as npnan
1034+
try:
1035+
return self.__statistic_lqrt_equal_var
1036+
except AttributeError:
1037+
return npnan
1038+
1039+
1040+
@property
1041+
def pvalue_lqrt_unpaired_unequal_variance(self):
1042+
from numpy import nan as npnan
1043+
try:
1044+
return self.__pvalue_lqrt_unequal_var
1045+
except AttributeError:
1046+
return npnan
1047+
1048+
1049+
1050+
@property
1051+
def statistic_lqrt_unpaired_unequal_variance(self):
1052+
from numpy import nan as npnan
1053+
try:
1054+
return self.__statistic_lqrt_unequal_var
1055+
except AttributeError:
1056+
return npnan
1057+
1058+
1059+
9711060
# @property
9721061
# def power(self):
9731062
# from numpy import nan as npnan
@@ -1089,7 +1178,16 @@ def __pre_calc(self):
10891178
'statistic_paired_students_t',
10901179

10911180
'pvalue_kruskal',
1092-
'statistic_kruskal']
1181+
'statistic_kruskal',
1182+
1183+
'pvalue_lqrt_paired',
1184+
'statistic_lqrt_paired',
1185+
1186+
'pvalue_lqrt_unpaired_equal_variance',
1187+
'statistic_lqrt_unpaired_equal_variance',
1188+
1189+
'pvalue_lqrt_unpaired_unequal_variance',
1190+
'statistic_lqrt_unpaired_unequal_variance']
10931191

10941192
self.__results = out_.reindex(columns=columns_in_order)
10951193
self.__results.dropna(axis="columns", how="all", inplace=True)
@@ -1209,6 +1307,12 @@ def plot(self, color_col=None,
12091307
pyplot.violinplot` command here, as a dict. If None, the following
12101308
keywords are passed to violinplot : {'widths':0.5, 'vert':True,
12111309
'showextrema':False, 'showmedians':False}.
1310+
slopegraph_kwargs : dict, default None
1311+
This will change the appearance of the lines used to join each pair
1312+
of observations when `show_pairs=True`. Pass any keyword arguments
1313+
accepted by matplotlib `plot()` function here, as a dict.
1314+
If None, the following keywords are
1315+
passed to plot() : {'linewidth':1, 'alpha':0.5}.
12121316
reflines_kwargs : dict, default None
12131317
This will change the appearance of the zero reference lines. Pass
12141318
any keyword arguments accepted by the matplotlib Axes `hlines`

dabest/plotter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
130130
if plot_kwargs["slopegraph_kwargs"] is None:
131131
slopegraph_kwargs = default_slopegraph_kwargs
132132
else:
133-
slopegraph_kwargs = merge_two_dicts(slopegraph_kwargs,
133+
slopegraph_kwargs = merge_two_dicts(default_slopegraph_kwargs,
134134
plot_kwargs["slopegraph_kwargs"])
135135

136136

@@ -697,7 +697,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
697697
else:
698698
contrast_ylim_high, contrast_ylim_low = contrast_axes_ylim
699699
if contrast_ylim_low < 0 < contrast_ylim_high:
700-
contrast_axes.axhline(y=0, lw=0.75, color=ytick_color)
700+
contrast_axes.axhline(y=0, **reflines_kwargs)
701701

702702
# Compute the end of each x-axes line.
703703
rightend_ticks = np.array([len(i)-1 for i in idx]) + np.array(ticks_to_skip)
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes

0 commit comments

Comments
 (0)