@@ -98,15 +98,14 @@ def __init__(
9898 "cohens_h" : "Cohen's h" ,
9999 "hedges_g" : "Hedges' g" ,
100100 "cliffs_delta" : "Cliff's delta" ,
101- "delta_g" : "deltas' g" ,
102101 }
103102
104103 self .__is_paired = is_paired
105104 self .__resamples = resamples
106105 self .__effect_size = effect_size
107106 self .__random_seed = random_seed
108107 self .__ci = ci
109- self .__proportional = proportional
108+ self .__is_proportional = proportional
110109 self ._check_errors (control , test )
111110
112111 # Convert to numpy arrays for speed.
@@ -237,7 +236,7 @@ def __repr__(self, show_resample_count=True, define_pval=True, sigfig=3):
237236 return "{}\n {}\n \n {}\n {}" .format (out , pvalue , bs , pval_def )
238237 elif not show_resample_count and define_pval :
239238 return "{}\n {}\n \n {}" .format (out , pvalue , pval_def )
240- elif show_resample_count and ~ define_pval :
239+ elif show_resample_count and not define_pval :
241240 return "{}\n {}\n \n {}" .format (out , pvalue , bs )
242241 else :
243242 return "{}\n {}" .format (out , pvalue )
@@ -256,16 +255,15 @@ def _check_errors(self, control, test):
256255 err1 = "`paired` is not None; therefore Cliff's delta is not defined."
257256 raise ValueError (err1 )
258257
259- if self .__proportional and self .__effect_size not in ["mean_diff" , "cohens_h" ]:
260- err1 = "`proportional` is True; therefore effect size other than mean_diff and cohens_h is not defined." + \
261- "If you are calculating deltas' g, it's the same as delta-delta when `proportional` is True"
258+ if self .__is_proportional and self .__effect_size not in ["mean_diff" , "cohens_h" ]:
259+ err1 = "`is_proportional` is True; therefore effect size other than mean_diff and cohens_h is not defined."
262260 raise ValueError (err1 )
263261
264- if self .__proportional and (
262+ if self .__is_proportional and (
265263 isin (control , [0 , 1 ]).all () == False or isin (test , [0 , 1 ]).all () == False
266264 ):
267265 err1 = (
268- "`proportional ` is True; Only accept binary data consisting of 0 and 1."
266+ "`is_proportional ` is True; Only accept binary data consisting of 0 and 1."
269267 )
270268 raise ValueError (err1 )
271269
@@ -333,7 +331,7 @@ def _perform_statistical_test(self):
333331 self .__permutation_count ,
334332 )
335333
336- if self .__is_paired and not self .__proportional :
334+ if self .__is_paired and not self .__is_proportional :
337335 # Wilcoxon, a non-parametric version of the paired T-test.
338336 try :
339337 wilcoxon = spstats .wilcoxon (self .__control , self .__test )
@@ -354,7 +352,7 @@ def _perform_statistical_test(self):
354352 self .__pvalue_paired_students_t = paired_t .pvalue
355353 self .__statistic_paired_students_t = paired_t .statistic
356354
357- elif self .__is_paired and self .__proportional :
355+ elif self .__is_paired and self .__is_proportional :
358356 # for binary paired data, use McNemar's test
359357 # References:
360358 # https://en.wikipedia.org/wiki/McNemar%27s_test
@@ -368,7 +366,7 @@ def _perform_statistical_test(self):
368366 self .__pvalue_mcnemar = _mcnemar .pvalue
369367 self .__statistic_mcnemar = _mcnemar .statistic
370368
371- elif self .__proportional :
369+ elif self .__is_proportional :
372370 # The Cohen's h calculation is for binary categorical data
373371 try :
374372 self .__proportional_difference = es .cohens_h (
@@ -544,8 +542,8 @@ def is_paired(self):
544542 return self .__is_paired
545543
546544 @property
547- def proportional (self ):
548- return self .__proportional
545+ def is_proportional (self ):
546+ return self .__is_proportional
549547
550548 @property
551549 def ci (self ):
@@ -842,12 +840,12 @@ def __init__(
842840 self .__resamples = resamples
843841 self .__permutation_count = permutation_count
844842 self .__random_seed = random_seed
845- self .__proportional = proportional
843+ self .__is_proportional = proportional
846844 self .__x1_level = x1_level
847845 self .__experiment_label = experiment_label
848846 self .__x2 = x2
849847 self .__delta2 = delta2
850- self .__mini_meta = mini_meta
848+ self .__is_mini_meta = mini_meta
851849
852850 def __pre_calc (self ):
853851 from .misc_tools import print_greeting , get_varname
@@ -885,7 +883,7 @@ def __pre_calc(self):
885883 self .__is_paired ,
886884 self .__resamples ,
887885 self .__random_seed ,
888- self .__proportional ,
886+ self .__is_proportional ,
889887 )
890888
891889 for j , current_tuple in enumerate (idx ):
@@ -903,7 +901,7 @@ def __pre_calc(self):
903901 control ,
904902 test ,
905903 self .__effect_size ,
906- self .__proportional ,
904+ self .__is_proportional ,
907905 self .__is_paired ,
908906 self .__ci ,
909907 self .__resamples ,
@@ -917,10 +915,10 @@ def __pre_calc(self):
917915 r_dict ["test_N" ] = int (len (test ))
918916 out .append (r_dict )
919917 if j == len (idx ) - 1 and ix == len (current_tuple ) - 2 :
920- if self .__delta2 and self .__effect_size in ["mean_diff" , "delta_g " ]:
918+ if self .__delta2 and self .__effect_size in ["mean_diff" , "hedges_g " ]:
921919 resamp_count = False
922920 def_pval = False
923- elif self .__mini_meta and self .__effect_size == "mean_diff" :
921+ elif self .__is_mini_meta and self .__effect_size == "mean_diff" :
924922 resamp_count = False
925923 def_pval = False
926924 else :
@@ -1001,32 +999,33 @@ def __pre_calc(self):
1001999 )
10021000
10031001 # Create and compute the delta-delta statistics
1004- if self .__delta2 :
1002+ if self .__delta2 and self .__effect_size not in ["mean_diff" , "hedges_g" ]:
1003+ self .__delta_delta = "Delta-delta is not supported for {}." .format (
1004+ self .__effect_size
1005+ )
1006+ elif self .__delta2 :
10051007 self .__delta_delta = DeltaDelta (
10061008 self , self .__permutation_count , bootstraps_delta_delta , self .__ci
10071009 )
10081010 reprs .append (self .__delta_delta .__repr__ (header = False ))
1009- elif self .__delta2 and self .__effect_size not in ["mean_diff" , "delta_g" ]:
1010- self .__delta_delta = "Delta-delta is not supported for {}." .format (
1011- self .__effect_size
1012- )
1011+
10131012 else :
10141013 self .__delta_delta = (
10151014 "`delta2` is False; delta-delta is therefore not calculated."
10161015 )
10171016
10181017 # Create and compute the weighted average statistics
1019- if self .__mini_meta and self .__effect_size == "mean_diff" :
1020- self .__mini_meta_delta = MiniMetaDelta (
1018+ if self .__is_mini_meta and self .__effect_size == "mean_diff" :
1019+ self .__mini_meta = MiniMetaDelta (
10211020 self , self .__permutation_count , self .__ci
10221021 )
1023- reprs .append (self .__mini_meta_delta .__repr__ (header = False ))
1024- elif self .__mini_meta and self .__effect_size != "mean_diff" :
1025- self .__mini_meta_delta = "Weighted delta is not supported for {}." .format (
1022+ reprs .append (self .__mini_meta .__repr__ (header = False ))
1023+ elif self .__is_mini_meta and self .__effect_size != "mean_diff" :
1024+ self .__mini_meta = "Weighted delta is not supported for {}." .format (
10261025 self .__effect_size
10271026 )
10281027 else :
1029- self .__mini_meta_delta = (
1028+ self .__mini_meta = (
10301029 "`mini_meta` is False; weighted delta is therefore not calculated."
10311030 )
10321031
@@ -1300,7 +1299,7 @@ def plot(
13001299 passed to plot() : {'linewidth':1, 'alpha':0.5, 'jitter':0, 'jitter_seed':9876543210}.
13011300 sankey_kwargs: dict, default None
13021301 Whis will change the appearance of the sankey diagram used to depict
1303- paired proportional data when `show_pairs=True` and `proportional =True`.
1302+ paired proportional data when `show_pairs=True` and `is_proportional =True`.
13041303 Pass any keyword arguments accepted by plot_tools.sankeydiag() function
13051304 here, as a dict. If None, the following keywords are passed to sankey diagram:
13061305 {"width": 0.5, "align": "center", "alpha": 0.4, "bar_width": 0.1, "rightColor": False}
@@ -1320,8 +1319,7 @@ def plot(
13201319 legend_kwargs : dict, default None
13211320 Pass any keyword arguments accepted by the matplotlib Axes
13221321 `legend` command here, as a dict. If None, the following keywords
1323- are passed to matplotlib.Axes.legend : {'loc':'upper left',
1324- 'frameon':False}.
1322+ are passed to matplotlib.Axes.legend : {'frameon':False}.
13251323 title : string, default None
13261324 Title for the plot. If None, no title will be displayed. Pass any
13271325 keyword arguments accepted by the matplotlib.pyplot.suptitle `t` command here,
@@ -1372,7 +1370,7 @@ def plot(
13721370 Whether or not to display the delta dots on paired or repeated measure plots.
13731371 delta_dot_kwargs : dict, default None
13741372 Pass relevant keyword arguments. If None, the following keywords are passed:
1375- {"color": 'k', "marker": "^", "alpha": 0.5, "zorder": -1 , "size": 3, "side": "right"}
1373+ {"color": 'k', "marker": "^", "alpha": 0.5, "zorder": 2 , "size": 3, "side": "right"}
13761374
13771375 horizontal_table_kwargs : dict, default None
13781376 {'show: True, 'color' : 'yellow', 'alpha' :0.2, 'fontsize' : 12, 'text_color' : 'black',
@@ -1437,9 +1435,6 @@ def plot(
14371435 if self .__delta2 and not empty_circle :
14381436 color_col = self .__x2
14391437
1440- # if self.__proportional:
1441- # raw_marker_size = 0.01
1442-
14431438 # Modification incurred due to update of Seaborn
14441439 ci = ("ci" , ci ) if ci is not None else None
14451440
@@ -1450,12 +1445,12 @@ def plot(
14501445 return out
14511446
14521447 @property
1453- def proportional (self ):
1448+ def is_proportional (self ):
14541449 """
14551450 Returns the proportional parameter
14561451 class.
14571452 """
1458- return self .__proportional
1453+ return self .__is_proportional
14591454
14601455 @property
14611456 def results (self ):
@@ -1537,10 +1532,6 @@ def x2(self):
15371532 def experiment_label (self ):
15381533 return self .__experiment_label
15391534
1540- @property
1541- def delta2 (self ):
1542- return self .__delta2
1543-
15441535 @property
15451536 def resamples (self ):
15461537 """
@@ -1568,13 +1559,6 @@ def dabest_obj(self):
15681559 """
15691560 return self .__dabest_obj
15701561
1571- @property
1572- def proportional (self ):
1573- """
1574- Returns the proportional parameter
1575- class.
1576- """
1577- return self .__proportional
15781562
15791563 @property
15801564 def lqrt (self ):
@@ -1590,33 +1574,41 @@ def lqrt(self):
15901574 return self .__lqrt_results
15911575
15921576 @property
1593- def mini_meta (self ):
1577+ def is_mini_meta (self ):
15941578 """
15951579 Returns the mini_meta boolean parameter.
15961580 """
1597- return self .__mini_meta
1581+ return self .__is_mini_meta
15981582
15991583 @property
1600- def mini_meta_delta (self ):
1584+ def mini_meta (self ):
16011585 """
16021586 Returns the mini_meta results.
16031587 """
16041588 try :
1605- return self .__mini_meta_delta
1589+ return self .__mini_meta
16061590 except AttributeError :
16071591 self .__pre_calc ()
1608- return self .__mini_meta_delta
1592+ return self .__mini_meta
16091593
16101594 @property
16111595 def delta_delta (self ):
16121596 """
1613- Returns the mini_meta results.
1597+ Returns the delta_delta results.
16141598 """
16151599 try :
16161600 return self .__delta_delta
16171601 except AttributeError :
16181602 self .__pre_calc ()
16191603 return self .__delta_delta
1604+
1605+ @property
1606+ def delta2 (self ):
1607+ return self .__delta2
1608+
1609+ @property
1610+ def is_delta_delta (self ):
1611+ return self .__delta2
16201612
16211613# %% ../nbs/API/effsize_objects.ipynb 29
16221614class PermutationTest :
@@ -1630,7 +1622,7 @@ class PermutationTest:
16301622 These should be numerical iterables.
16311623 effect_size : string.
16321624 Any one of the following are accepted inputs:
1633- 'mean_diff', 'median_diff', 'cohens_d', 'hedges_g', 'delta_g" or 'cliffs_delta'
1625+ 'mean_diff', 'median_diff', 'cohens_d', 'hedges_g', or 'cliffs_delta'
16341626 is_paired : string, default None
16351627 permutation_count : int, default 10000
16361628 The number of permutations (reshuffles) to perform.
0 commit comments