@@ -449,6 +449,9 @@ def __init__(self, control, test, effect_size,
449
449
'pct_low': -0.763588353717278,
450
450
'pvalue_brunner_munzel': nan,
451
451
'pvalue_kruskal': nan,
452
+ 'pvalue_lqrt_paired': nan,
453
+ 'pvalue_lqrt_unpaired_equal_variance': 0.36,
454
+ 'pvalue_lqrt_unpaired_unequal_variance': 0.36,
452
455
'pvalue_mann_whitney': 0.2600723060808019,
453
456
'pvalue_paired_students_t': nan,
454
457
'pvalue_students_t': 0.34743913903372836,
@@ -458,6 +461,9 @@ def __init__(self, control, test, effect_size,
458
461
'resamples': 5000,
459
462
'statistic_brunner_munzel': nan,
460
463
'statistic_kruskal': nan,
464
+ 'statistic_lqrt_paired': nan,
465
+ 'statistic_lqrt_unpaired_equal_variance': 0.8894980773231964,
466
+ 'statistic_lqrt_unpaired_unequal_variance': 0.8916901409507432,
461
467
'statistic_mann_whitney': 406.0,
462
468
'statistic_paired_students_t': nan,
463
469
'statistic_students_t': 0.9472545159069105,
@@ -470,6 +476,7 @@ def __init__(self, control, test, effect_size,
470
476
from numpy .random import choice , seed
471
477
472
478
import scipy .stats as spstats
479
+ import lqrt
473
480
474
481
# import statsmodels.stats.power as power
475
482
@@ -601,6 +608,12 @@ def __init__(self, control, test, effect_size,
601
608
wilcoxon = spstats .wilcoxon (control , test )
602
609
self .__pvalue_wilcoxon = wilcoxon .pvalue
603
610
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
604
617
605
618
if effect_size != "median_diff" :
606
619
# Paired Student's t-test.
@@ -658,7 +671,24 @@ def __init__(self, control, test, effect_size,
658
671
# in terms of rank (eg. all zeros.)
659
672
pass
660
673
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
+
661
690
standardized_es = es .cohens_d (control , test , is_paired = False )
691
+
662
692
# self.__power = power.tt_ind_solve_power(standardized_es,
663
693
# len(control),
664
694
# alpha=self.__alpha,
@@ -968,6 +998,65 @@ def statistic_mann_whitney(self):
968
998
969
999
970
1000
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
+
971
1060
# @property
972
1061
# def power(self):
973
1062
# from numpy import nan as npnan
@@ -1089,7 +1178,16 @@ def __pre_calc(self):
1089
1178
'statistic_paired_students_t' ,
1090
1179
1091
1180
'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' ]
1093
1191
1094
1192
self .__results = out_ .reindex (columns = columns_in_order )
1095
1193
self .__results .dropna (axis = "columns" , how = "all" , inplace = True )
@@ -1209,6 +1307,12 @@ def plot(self, color_col=None,
1209
1307
pyplot.violinplot` command here, as a dict. If None, the following
1210
1308
keywords are passed to violinplot : {'widths':0.5, 'vert':True,
1211
1309
'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}.
1212
1316
reflines_kwargs : dict, default None
1213
1317
This will change the appearance of the zero reference lines. Pass
1214
1318
any keyword arguments accepted by the matplotlib Axes `hlines`
0 commit comments