Skip to content

Commit 3faa92d

Browse files
authored
Merge pull request #133 from maiyishan/v0.4dev
1. classes.py: added MiniMetaDelta, fixed Cohen's h function signatures 2. Added Cohen's h and minimeta function signatures to api.rst 3. Added minimetadelta.rst tutorial page, split repeated measures and plot aesthetics into their own pages 4. Added release notes to release-notes.rst & updated index.rst (landing page) 5. Changed version #s in documentation to v2023.02.14 6. Added upcoming release announcement to README.md, changed pictures to have white backgrounds
2 parents 0f2d7c1 + 95e977a commit 3faa92d

19 files changed

Lines changed: 1539 additions & 1272 deletions

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66
[![Free-to-view citation](https://zenodo.org/badge/DOI/10.1038/s41592-019-0470-3.svg)](https://rdcu.be/bHhJ4)
77
[![License](https://img.shields.io/badge/License-BSD%203--Clause--Clear-orange.svg)](https://spdx.org/licenses/BSD-3-Clause-Clear.html)
88

9+
## Upcoming Version Update
10+
11+
On 20 March 2023, we will be officially releasing **DABEST v2023.02.14 for Python**. This new version will provide the following new features:
12+
13+
1. **Repeated measures.** Augments the prior function for plotting (independent) multiple test groups versus a shared control; it can now do the same for repeated-measures experimental designs. Thus, together, these two methods can be used to replace both flavors of the 1-way ANOVA with an estimation analysis.
14+
15+
2. **Proportional data.** Generates proportional bar plots, proportional differences, and calculates Cohen's h. Also enables plotting Sankey diagrams for paired binary data. This is the estimation equivalent to a bar chart with Fischer's exact test.
16+
17+
3. **The ∆∆ plot.** Calculates the delta-delta (∆∆) for 2 × 2 experimental designs and plots the four groups with their relevant effect sizes. This design can be used as a replacement for the 2 × 2 ANOVA.
18+
19+
4. **Mini-meta.** Calculates and plots a weighted delta (∆) for meta-analysis of experimental replicates. Useful for summarizing data from multiple replicated experiments, for example by different scientists in the same lab, or the same scientist at different times. When the observed values are known (and share a common metric), this makes meta-analysis available as a routinely accessible tool.
20+
21+
Prior to the official update, users keen to try these features now are invited to download the v0.4dev branch. After 20 March 2023, the new version will be the one we recommend for all users.
22+
23+
924
## Contents
1025
<!-- TOC depthFrom:1 depthTo:2 withLinks:1 updateOnSave:1 orderedList:0 -->
1126
- [About](#about)
@@ -32,7 +47,7 @@ An estimation plot has two key features.
3247

3348
2. It presents the effect size as a **bootstrap 95% confidence interval** on a **separate but aligned axes**.
3449

35-
![The five kinds of estimation plots](docs/source/_images/showpiece.png?raw=true "The five kinds of estimation plots.")
50+
![The five kinds of estimation plots](docs/source/_images/showpiece.png "The five kinds of estimation plots.")
3651

3752
DABEST powers [estimationstats.com](https://www.estimationstats.com/), allowing everyone access to high-quality estimation plots.
3853

@@ -78,7 +93,7 @@ iris_dabest = dabest.load(data=iris, x="species", y="petal_width",
7893
# Produce a Cumming estimation plot.
7994
iris_dabest.mean_diff.plot();
8095
```
81-
![A Cumming estimation plot of petal width from the iris dataset](https://github.com/ACCLAB/DABEST-python/blob/master/iris.png)
96+
![A Cumming estimation plot of petal width from the iris dataset](iris.png)
8297

8398
Please refer to the official [tutorial](https://acclab.github.io/DABEST-python-docs/tutorial.html) for more useful code snippets.
8499

@@ -108,11 +123,11 @@ We also have a [Code of Conduct](https://github.com/ACCLAB/DABEST-python/blob/ma
108123
### A wish list for new features
109124
Currently, DABEST offers functions to handle data traditionally analyzed with Student’s paired and unpaired t-tests. It also offers plots for multiplexed versions of these, and the estimation counterpart to a 1-way analysis of variance (ANOVA), the shared-control design. While these five functions execute a large fraction of common biomedical data analyses, there remain three others: 2-way data, time-series group data, and proportional data. We aim to add these new functions to both the R and Python libraries.
110125

111-
● In many experiments, four groups are investigate to isolate an interaction, for example: a genotype × drug effect. Here, wild-type and mutant animals are each subjected to drug or sham treatments; the data are traditionally analysed with a 2×2 ANOVA. We have received requests by email, Twitter, and GitHub to implement an estimation counterpart to the 2-way ANOVA. To do this, we will implement ∆∆ plots, in which the difference of means (∆) of two groups is subtracted from a second two-group ∆.
126+
● In many experiments, four groups are investigate to isolate an interaction, for example: a genotype × drug effect. Here, wild-type and mutant animals are each subjected to drug or sham treatments; the data are traditionally analysed with a 2×2 ANOVA. We have received requests by email, Twitter, and GitHub to implement an estimation counterpart to the 2-way ANOVA. To do this, we will implement ∆∆ plots, in which the difference of means (∆) of two groups is subtracted from a second two-group ∆. **Implemented in v2023.02.14.**
112127

113-
● Currently, DABEST can analyse multiple paired data in a single plot, and multiple groups with a common, shared control. However, a common design in biomedical science is to follow the same group of subjects over multiple, successive time points. An estimation plot for this would combine elements of the two other designs, and could be used in place of a repeated-measures ANOVA.
128+
● Currently, DABEST can analyse multiple paired data in a single plot, and multiple groups with a common, shared control. However, a common design in biomedical science is to follow the same group of subjects over multiple, successive time points. An estimation plot for this would combine elements of the two other designs, and could be used in place of a repeated-measures ANOVA. **Implemented in v2023.02.14**
114129

115-
● We have observed that proportional data are often analyzed in neuroscience and other areas of biomedical research. However, compared to other data types, the charts are frequently impoverished: often, they omit error bars, sample sizes, and even P values—let alone effect sizes. We would like DABEST to feature proportion charts, with error bars and a curve for the distribution of the proportional differences.
130+
● We have observed that proportional data are often analyzed in neuroscience and other areas of biomedical research. However, compared to other data types, the charts are frequently impoverished: often, they omit error bars, sample sizes, and even P values—let alone effect sizes. We would like DABEST to feature proportion charts, with error bars and a curve for the distribution of the proportional differences. **Implemented in v2023.02.14**
116131

117132
We encourage contributions for the above features.
118133

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: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,18 +572,19 @@ 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
584-
For a non-directional Cohen's 'h', the equation is:
584+
For a non-directional Cohen's *h*, the equation is:
585+
585586
.. math::
586-
h = \\abs{2 * \\arcsin{\\sqrt{proportion_{Test}}}} - \\abs{2 * \\arcsin{\\sqrt{proportion_{Control}}}}
587+
h = |2 * \\arcsin{\\sqrt{proportion_{Test}}} - 2 * \\arcsin{\\sqrt{proportion_{Control}}}|
587588
588589
References:
589590
https://en.wikipedia.org/wiki/Cohen%27s_h
@@ -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,

docs/source/_images/showpiece.png

78.6 KB
Loading
32.2 KB
Loading

docs/source/api.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
.. currentmodule:: dabest
44

5+
===
56
API
67
===
78

@@ -15,11 +16,14 @@ Computing Effect Sizes
1516
----------------------
1617

1718
.. autoclass:: dabest._classes.Dabest
18-
:members: mean_diff, median_diff, cohens_d, hedges_g, cliffs_delta
19+
:members: mean_diff, median_diff, cohens_d, hedges_g, cliffs_delta, cohens_h
1920
:member-order: bysource
2021

2122
.. .. autoclass:: dabest._classes.TwoGroupsEffectSize
2223
24+
.. autoclass:: dabest._classes.MiniMetaDelta
25+
:members: difference, bca_low, bca_high, bootstraps, to_dict
26+
2327

2428
Plotting Data
2529
-------------

docs/source/bootstraps.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _Bootstrap Confidence Intervals:
1+
.. _bootstraps:
22

33

44
==============================

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
# General information about the project.
6969
project = 'dabest'
70-
copyright = '2017-2023, Joses W. Ho'
70+
copyright = '2016-2023, Joses W. Ho'
7171
author = 'Joses W. Ho'
7272

7373
# The version info for the project you're documenting, acts as replacement for
@@ -84,7 +84,7 @@
8484
#
8585
# This is also used if you do content translation via gettext catalogs.
8686
# Usually you set "language" from the command line for these cases.
87-
language = None
87+
language = 'en'
8888

8989
# List of patterns, relative to source directory, that match files and
9090
# directories to ignore when looking for source files.

docs/source/getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _Getting Started:
1+
.. _getting-started:
22

33
===============
44
Getting Started

docs/source/index.rst

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66
DABEST
77
======
88

9+
Update
10+
------
11+
**DABEST version 2023.02.14** has been released:
12+
:doc:`release-notes`
13+
14+
Briefly, this release introduces several new functions:
15+
16+
- Additional plotting functions for repeated measures experimental designs
17+
- Calculating of Cohen's *h* and proportional plots for binary data
18+
- Calculating and plotting delta-deltas for 2x2 experimental designs
19+
- Calculating and plotting of weighted deltas for mini-meta-analysis of experimental replicates
20+
21+
Refer to :doc:`release-notes` for full details.
22+
23+
924
-----------------------------------------------
1025
Data Analysis with Bootstrap-coupled ESTimation
1126
-----------------------------------------------
@@ -18,8 +33,16 @@ Analyze your data with estimation statistics!
1833

1934
News
2035
----
36+
March 2023:
37+
- **v2023.02.14** released. The following features have been added:
38+
- Additional plotting functions for repeated measures experimental designs
39+
- Calculating of Cohen's *h* and proportional plots for binary data
40+
- Calculating and plotting delta-deltas for 2x2 experimental designs
41+
- Calculating and plotting of weighted deltas for mini-meta-analysis of experimental replicates
42+
- See :doc:`release-notes` for more details.
43+
2144
October 2020:
22-
- v0.3.1 released. The minimal versions of dependencies have been upgraded. Also, the minimal version of Python required is now 3.5.
45+
- v0.3.1 released. The minimal versions of dependencies have been upgraded. Also, the minimal version of Python required is now 3.6.
2346

2447
January 2020:
2548
- v0.3.0 released. Approximate permutation tests have been added, and are now the default p-values reported in the textual output. The LqRT tests were also refactored to a user-callable property. For more information, see the :doc:`release-notes`.
@@ -29,7 +52,7 @@ December 2019:
2952

3053
October 2019:
3154
- v0.2.7 released. A minor bugfix in the handling of wide datasets with unequal Ns in each group.
32-
- v0.2.6 released. This release has one new feature (plotting of estimation plot inside any :py:mod:`matplotlib` :py:class:`Axes`; see the section on :ref:`inset plot` in the :doc:`tutorial`). There are also two bug patches for the handling of bootstrap plotting, and of dependency installation.
55+
- v0.2.6 released. This release has one new feature (plotting of estimation plot inside any :py:mod:`matplotlib` :py:class:`Axes`; see the section on :ref:`inset plot` in the :doc:`plotaesthetics`). There are also two bug patches for the handling of bootstrap plotting, and of dependency installation.
3356

3457
September 2019:
3558
- v0.2.5 released. This release addresses two feature requests, and also patches two bugs: one affecting the paired difference CIs, and one involving NaNs in unused/irrelevant columns.
@@ -56,7 +79,10 @@ Contents
5679
bootstraps
5780
getting-started
5881
tutorial
82+
repeatedmeasures
5983
proportion-plot
84+
minimetadelta
85+
plotaesthetics
6086
release-notes
6187
api
6288
about

0 commit comments

Comments
 (0)