diff --git a/.gitignore b/.gitignore index 9945cf18..d43a704b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Byte-compiled / optimized / DLL files __pycache__/ +.idea/* *.py[cod] *$py.class diff --git a/dabest/_classes.py b/dabest/_classes.py index 026246ed..3e7ef8ef 100644 --- a/dabest/_classes.py +++ b/dabest/_classes.py @@ -470,6 +470,7 @@ def __init__(self, control, test, effect_size, from numpy.random import choice, seed import scipy.stats as spstats + import lqrt # import statsmodels.stats.power as power @@ -658,6 +659,20 @@ def __init__(self, control, test, effect_size, # in terms of rank (eg. all zeros.) pass + # Likelihood Q-Ratio test: + # Assumes a gross-error model of distributions + try: + if self.__is_paired: + lqrt_ratio = lqrt.lqrtest_rel(control, test) + else: + lqrt_ratio = lqrt.lqrtest_ind(control, test) + self.__pvalue_lqrt = lqrt_ratio.pvalue + self.__statistic_lqrt = lqrt_ratio.statistic + except ImportError: + # did not install necessary library to run robust lqrt statistic + # warnings.warn("To get") + pass + standardized_es = es.cohens_d(control, test, is_paired=False) # self.__power = power.tt_ind_solve_power(standardized_es, # len(control), @@ -874,6 +889,21 @@ def statistic_wilcoxon(self): except AttributeError: return npnan + @property + def pvalue_lqrt(self): + from numpy import nan as npnan + try: + return self.__pvalue_lqrt + except AttributeError: + return npnan + + @property + def statistic_lqrt(self): + from numpy import nan as npnan + try: + return self.__statistic_lqrt + except AttributeError: + return npnan @property diff --git a/setup.py b/setup.py index f31eae05..af8ace44 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,8 @@ 'pandas~=0.25,!=0.25.2', 'matplotlib~=3.0', - 'seaborn~=0.9' + 'seaborn~=0.9', + 'lqrt>=0.3.2' ], extras_require={'dev': ['pytest~=5.2', 'pytest-mpl~=0.10']}, python_requires='~=3.5',