Skip to content

Commit 676391d

Browse files
committed
Documentation
Fixed typos in Cohen's h function signature Added MiniMetaDelta function signature Added Cohen's h to api.rst Split repeated-measures and plot-aesthetics parts of tutiorial into their own pages Wrote release notes Changed version#s to v2023.02.14
1 parent 0f2d7c1 commit 676391d

11 files changed

Lines changed: 1474 additions & 1257 deletions

File tree

dabest/_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def load(data, idx=None, x=None, y=None, paired=None, id_col=None,
8888
>>> my_data = dabest.load(df, idx=("Control 1", "Test 1"))
8989
9090
For proportion plot.
91+
9192
>>> np.random.seed(88888)
9293
>>> N = 10
9394
>>> c1 = np.random.binomial(1, 0.2, size=N)

dabest/_classes.py

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,16 +572,17 @@ def cohens_h(self):
572572
573573
Notes
574574
-----
575-
Cohen's 'h' uses the information of proportion in the control and test groups to calculate the distance between two proportions.
575+
Cohen's *h* uses the information of proportion in the control and test groups to calculate the distance between two proportions.
576576
It can be used to describe the difference between two proportions as "small", "medium", or "large".
577577
It can be used to determine if the difference between two proportions is "meaningful".
578578
579-
A directional Cohen's 'h' is computed with the following equation:
579+
A directional Cohen's *h* is computed with the following equation:
580580
581581
.. math::
582582
h = 2 * \\arcsin{\\sqrt{proportion_{Test}}} - 2 * \\arcsin{\\sqrt{proportion_{Control}}}
583583
584584
For a non-directional Cohen's 'h', the equation is:
585+
585586
.. math::
586587
h = \\abs{2 * \\arcsin{\\sqrt{proportion_{Test}}}} - \\abs{2 * \\arcsin{\\sqrt{proportion_{Control}}}}
587588
@@ -1201,7 +1202,55 @@ def permutations_delta_delta(self):
12011202

12021203
class MiniMetaDelta(object):
12031204
"""
1204-
A class to compute and store the weighted mean differences.
1205+
A class to compute and store the weighted delta.
1206+
A weighted delta is calculated if the argument ``mini_meta=True`` is passed during ``dabest.load()``.
1207+
1208+
The weighted delta is calcuated as follows:
1209+
1210+
.. math::
1211+
\\theta_{\\text{weighted}} = \\frac{\\Sigma\\hat{\\theta_{i}}w_{i}}{{\\Sigma}w_{i}}
1212+
1213+
where:
1214+
1215+
.. math::
1216+
\\hat{\\theta_{i}} = \\text{Mean difference for replicate }i
1217+
1218+
.. math::
1219+
w_{i} = \\text{Weight for replicate }i = \\frac{1}{s_{i}^2}
1220+
1221+
.. math::
1222+
s_{i}^2 = \\text{Pooled variance for replicate }i = \\frac{(n_{test}-1)s_{test}^2+(n_{control}-1)s_{control}^2}{n_{test}+n_{control}-2}
1223+
1224+
.. math::
1225+
n = \\text{sample size and }s^2 = \\text{variance for control/test.}
1226+
1227+
1228+
Example
1229+
-------
1230+
>>> from scipy.stats import norm
1231+
>>> import pandas as pd
1232+
>>> import dabest
1233+
>>> c1 = norm.rvs(loc=3, scale=0.4, size=Ns)
1234+
>>> c2 = norm.rvs(loc=3.5, scale=0.75, size=Ns)
1235+
>>> c3 = norm.rvs(loc=3.25, scale=0.4, size=Ns)
1236+
1237+
>>> t1 = norm.rvs(loc=3.5, scale=0.5, size=Ns)
1238+
>>> t2 = norm.rvs(loc=2.5, scale=0.6, size=Ns)
1239+
>>> t3 = norm.rvs(loc=3, scale=0.75, size=Ns)
1240+
>>> my_df = pd.DataFrame({'Control 1' : c1, 'Test 1' : t1,
1241+
'Control 2' : c2, 'Test 2' : t2,
1242+
'Control 3' : c3, 'Test 3' : t3})
1243+
>>> my_dabest_object = dabest.load(df, idx=(("Control 1", "Test 1"), ("Control 2", "Test 2"), ("Control 3", "Test 3")), mini_meta=True)
1244+
>>> my_dabest_object.mean_diff.mini_meta_delta
1245+
1246+
Notes
1247+
-----
1248+
As of version 2023.02.14, weighted delta can only be calculated for mean difference, and not for standardized measures such as Cohen's *d*.
1249+
1250+
Details about the calculated weighted delta are accessed as attributes of the ``mini_meta_delta`` class. See the :doc:`minimetadelta` for details on usage.
1251+
1252+
Refer to Chapter 10 of the Cochrane handbook for further information on meta-analysis: https://training.cochrane.org/handbook/current/chapter-10
1253+
12051254
"""
12061255

12071256
def __init__(self, effectsizedataframe, permutation_count,
32.2 KB
Loading

docs/source/api.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ Computing Effect Sizes
1515
----------------------
1616

1717
.. autoclass:: dabest._classes.Dabest
18-
:members: mean_diff, median_diff, cohens_d, hedges_g, cliffs_delta
18+
:members: mean_diff, median_diff, cohens_d, hedges_g, cliffs_delta, cohens_h
1919
:member-order: bysource
2020

2121
.. .. autoclass:: dabest._classes.TwoGroupsEffectSize
2222
23+
.. autoclass:: dabest._classes.MiniMetaDelta
24+
:members: difference, bca_low, bca_high, bootstraps, to_dict
25+
2326

2427
Plotting Data
2528
-------------

docs/source/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ Contents
5656
bootstraps
5757
getting-started
5858
tutorial
59+
repeatedmeasures
5960
proportion-plot
61+
minimetadelta
62+
plotaesthetics
6063
release-notes
6164
api
6265
about

0 commit comments

Comments
 (0)