@@ -299,7 +299,6 @@ def _compute_bca_intervals(self, sorted_bootstraps):
299299 )
300300
301301 else :
302- # TODO improve error handling, separate file with error messages?
303302 err1 = "The $lim_type limit of the BCa interval cannot be computed."
304303 err2 = "It is set to the effect size itself."
305304 err3 = "All bootstrap values were likely all the same."
@@ -330,9 +329,14 @@ def _perform_statistical_test(self):
330329
331330 if self .__is_paired and not self .__proportional :
332331 # Wilcoxon, a non-parametric version of the paired T-test.
333- wilcoxon = spstats .wilcoxon (self .__control , self .__test )
334- self .__pvalue_wilcoxon = wilcoxon .pvalue
335- self .__statistic_wilcoxon = wilcoxon .statistic
332+ try :
333+ wilcoxon = spstats .wilcoxon (self .__control , self .__test )
334+ self .__pvalue_wilcoxon = wilcoxon .pvalue
335+ self .__statistic_wilcoxon = wilcoxon .statistic
336+ except ValueError as e :
337+ warnings .warn ("Wilcoxon test could not be performed. This might be due "
338+ "to identical values under the same group. "
339+ "Details: {}" .format (e ))
336340
337341 if self .__effect_size != "median_diff" :
338342 # Paired Student's t-test.
@@ -398,11 +402,10 @@ def _perform_statistical_test(self):
398402 )
399403 self .__pvalue_mann_whitney = mann_whitney .pvalue
400404 self .__statistic_mann_whitney = mann_whitney .statistic
401- except ValueError :
402- # TODO At least print some warning?
403- # Occurs when the control and test are exactly identical
404- # in terms of rank (eg. all zeros.)
405- pass
405+ except ValueError as e :
406+ warnings .warn ("Mann-Whitney test could not be performed. This might be due "
407+ "to identical rank values in both control and test groups. "
408+ "Details: {}" .format (e ))
406409
407410 standardized_es = es .cohens_d (self .__control , self .__test , is_paired = None )
408411
@@ -411,10 +414,9 @@ def _perform_statistical_test(self):
411414 self .__proportional_difference = es .cohens_h (
412415 self .__control , self .__test
413416 )
414- except ValueError :
415- # TODO At least print some warning?
416- # Occur only when the data consists not only 0's and 1's.
417- pass
417+ except ValueError as e :
418+ warnings .warn (f"Calculation of Cohen's h failed. This method is applicable "
419+ f"only for binary data (0's and 1's). Details: { e } " )
418420
419421 def to_dict (self ):
420422 """
@@ -567,87 +569,79 @@ def statistic_mcnemar(self):
567569
568570 @property
569571 def pvalue_paired_students_t (self ):
570- # TODO Missing docstring
571572 try :
572573 return self .__pvalue_paired_students_t
573574 except AttributeError :
574575 return npnan
575576
576577 @property
577578 def statistic_paired_students_t (self ):
578- # TODO Missing docstring
579579 try :
580580 return self .__statistic_paired_students_t
581581 except AttributeError :
582582 return npnan
583583
584584 @property
585585 def pvalue_kruskal (self ):
586- # TODO Missing docstring
587586 try :
588587 return self .__pvalue_kruskal
589588 except AttributeError :
590589 return npnan
591590
592591 @property
593592 def statistic_kruskal (self ):
594- # TODO Missing docstring
595593 try :
596594 return self .__statistic_kruskal
597595 except AttributeError :
598596 return npnan
599597
600598 @property
601599 def pvalue_welch (self ):
602- # TODO Missing docstring
603600 try :
604601 return self .__pvalue_welch
605602 except AttributeError :
606603 return npnan
607604
608605 @property
609606 def statistic_welch (self ):
610- # TODO Missing docstring
611607 try :
612608 return self .__statistic_welch
613609 except AttributeError :
614610 return npnan
615611
616612 @property
617613 def pvalue_students_t (self ):
618- # TODO Missing docstring
619614 try :
620615 return self .__pvalue_students_t
621616 except AttributeError :
622617 return npnan
623618
624619 @property
625620 def statistic_students_t (self ):
626- # TODO Missing docstring
627621 try :
628622 return self .__statistic_students_t
629623 except AttributeError :
630624 return npnan
631625
632626 @property
633627 def pvalue_mann_whitney (self ):
634- # TODO Missing docstring
635628 try :
636629 return self .__pvalue_mann_whitney
637630 except AttributeError :
638631 return npnan
639632
640633 @property
641634 def statistic_mann_whitney (self ):
642- # TODO Missing docstring
643635 try :
644636 return self .__statistic_mann_whitney
645637 except AttributeError :
646638 return npnan
647639
648640 @property
649641 def pvalue_permutation (self ):
650- # TODO Missing docstring
642+ """
643+ p value of permutation test
644+ """
651645 return self .__PermutationTest_result .pvalue
652646
653647 @property
@@ -663,12 +657,10 @@ def permutations(self):
663657
664658 @property
665659 def permutations_var (self ):
666- # TODO Missing docstring
667660 return self .__PermutationTest_result .permutations_var
668661
669662 @property
670663 def proportional_difference (self ):
671- # TODO Missing docstring
672664 try :
673665 return self .__proportional_difference
674666 except AttributeError :
0 commit comments