@@ -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`
0 commit comments