Skip to content

Commit 6bebb34

Browse files
committed
Adding lqrt initial commit.
1 parent e6cd4b8 commit 6bebb34

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

.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/_classes.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ def __init__(self, control, test, effect_size,
470470
from numpy.random import choice, seed
471471

472472
import scipy.stats as spstats
473+
import lqrt
473474

474475
# import statsmodels.stats.power as power
475476

@@ -658,6 +659,16 @@ def __init__(self, control, test, effect_size,
658659
# in terms of rank (eg. all zeros.)
659660
pass
660661

662+
# Likelihood Q-Ratio test:
663+
# Assumes a gross-error model of distributions
664+
try:
665+
lqrt_ratio = lqrt.lqrtest_rel(control, test)
666+
self.__pvalue_lqrt = lqrt_ratio.pvalue
667+
self.__statistic_lqrt = lqrt_ratio.statistic
668+
except ImportError:
669+
# warnings.warn("To get")
670+
pass
671+
661672
standardized_es = es.cohens_d(control, test, is_paired=False)
662673
# self.__power = power.tt_ind_solve_power(standardized_es,
663674
# len(control),
@@ -874,6 +885,21 @@ def statistic_wilcoxon(self):
874885
except AttributeError:
875886
return npnan
876887

888+
@property
889+
def pvalue_lqrt(self):
890+
from numpy import nan as npnan
891+
try:
892+
return self.__pvalue_lqrt
893+
except AttributeError:
894+
return npnan
895+
896+
@property
897+
def statistic_lqrt(self):
898+
from numpy import nan as npnan
899+
try:
900+
return self.__statistic_lqrt
901+
except AttributeError:
902+
return npnan
877903

878904

879905
@property

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
'numpy~=1.15',
4343
'scipy~=1.2',
4444
'pandas==0.24',
45-
4645
'matplotlib~=3.0',
47-
'seaborn~=0.9'
46+
'seaborn~=0.9',
47+
'lqrt>=0.3.2'
4848
],
4949
extras_require={'dev': ['pytest==5.2', 'pytest-mpl==0.10']},
5050
python_requires='>=3.5',

0 commit comments

Comments
 (0)