diff --git a/.travis.yml b/.travis.yml index 729f3420..101a1873 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ dist: xenial language: python env: - - PYTHON=3.5 BACKEND=agg - PYTHON=3.6 BACKEND=agg - PYTHON=3.7 BACKEND=agg - PYTHON=3.8 BACKEND=agg @@ -20,7 +19,7 @@ before_install: install: - conda update conda --yes - conda config --add channels conda-forge - - conda create -n testenv --yes pip python=$PYTHON matplotlib + - conda create -n testenv --yes pip python=$PYTHON matplotlib freetype=2.10 # - if [ "$PYTHON" = "3.8" ]; then conda create -n testenv --yes --channel conda-forge/label/pre-3.8 pip python=$PYTHON; else conda create -n testenv --yes pip python=$PYTHON matplotlib; fi - source activate testenv - pip install .[dev] diff --git a/README.md b/README.md index 84b8baf5..96e47269 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DABEST-Python [![Travis CI build status](https://travis-ci.org/ACCLAB/DABEST-python.svg?branch=master)](https://travis-ci.org/ACCLAB/DABEST-python) -[![minimal Python version](https://img.shields.io/badge/Python%3E%3D-3.5-6666ff.svg)](https://www.anaconda.com/distribution/) +[![minimal Python version](https://img.shields.io/badge/Python%3E%3D-3.6-6666ff.svg)](https://www.anaconda.com/distribution/) [![PyPI version](https://badge.fury.io/py/dabest.svg)](https://badge.fury.io/py/dabest) [![Downloads](https://pepy.tech/badge/dabest/month)](https://pepy.tech/project/dabest/month) [![Free-to-view citation](https://zenodo.org/badge/DOI/10.1038/s41592-019-0470-3.svg)](https://rdcu.be/bHhJ4) @@ -39,7 +39,7 @@ DABEST powers [estimationstats.com](https://www.estimationstats.com/), allowing ## Installation -This package is tested on Python 3.5, 3.6, 3.7, and 3.8. +This package is tested on Python 3.6, 3.7, and 3.8. It is highly recommended to download the [Anaconda distribution](https://www.continuum.io/downloads) of Python in order to obtain the dependencies easily. You can install this package via `pip`. diff --git a/dabest/__init__.py b/dabest/__init__.py index d4a93d9c..fd3b571b 100644 --- a/dabest/__init__.py +++ b/dabest/__init__.py @@ -23,4 +23,4 @@ from ._stats_tools import effsize as effsize from ._classes import TwoGroupsEffectSize, PermutationTest -__version__ = "0.3.0" +__version__ = "0.3.1" diff --git a/dabest/tests/baseline_images/test_01_gardner_altman_unpaired_meandiff.png b/dabest/tests/baseline_images/test_01_gardner_altman_unpaired_meandiff.png index efe7d87b..bb0bdbb6 100644 Binary files a/dabest/tests/baseline_images/test_01_gardner_altman_unpaired_meandiff.png and b/dabest/tests/baseline_images/test_01_gardner_altman_unpaired_meandiff.png differ diff --git a/dabest/tests/baseline_images/test_02_gardner_altman_unpaired_mediandiff.png b/dabest/tests/baseline_images/test_02_gardner_altman_unpaired_mediandiff.png index 09aabb9a..dabebe4a 100644 Binary files a/dabest/tests/baseline_images/test_02_gardner_altman_unpaired_mediandiff.png and b/dabest/tests/baseline_images/test_02_gardner_altman_unpaired_mediandiff.png differ diff --git a/dabest/tests/baseline_images/test_03_gardner_altman_unpaired_hedges_g.png b/dabest/tests/baseline_images/test_03_gardner_altman_unpaired_hedges_g.png index 8eb24366..2d18b0dc 100644 Binary files a/dabest/tests/baseline_images/test_03_gardner_altman_unpaired_hedges_g.png and b/dabest/tests/baseline_images/test_03_gardner_altman_unpaired_hedges_g.png differ diff --git a/dabest/tests/baseline_images/test_04_gardner_altman_paired_hedges_g.png b/dabest/tests/baseline_images/test_04_gardner_altman_paired_hedges_g.png index 3efccad0..da147062 100644 Binary files a/dabest/tests/baseline_images/test_04_gardner_altman_paired_hedges_g.png and b/dabest/tests/baseline_images/test_04_gardner_altman_paired_hedges_g.png differ diff --git a/dabest/tests/baseline_images/test_04_gardner_altman_paired_meandiff.png b/dabest/tests/baseline_images/test_04_gardner_altman_paired_meandiff.png index d440b849..eea3de7c 100644 Binary files a/dabest/tests/baseline_images/test_04_gardner_altman_paired_meandiff.png and b/dabest/tests/baseline_images/test_04_gardner_altman_paired_meandiff.png differ diff --git a/dabest/tests/baseline_images/test_05_cummings_two_group_unpaired_meandiff.png b/dabest/tests/baseline_images/test_05_cummings_two_group_unpaired_meandiff.png index 8b289700..2578687b 100644 Binary files a/dabest/tests/baseline_images/test_05_cummings_two_group_unpaired_meandiff.png and b/dabest/tests/baseline_images/test_05_cummings_two_group_unpaired_meandiff.png differ diff --git a/dabest/tests/baseline_images/test_06_cummings_two_group_paired_meandiff.png b/dabest/tests/baseline_images/test_06_cummings_two_group_paired_meandiff.png index 265ae254..7b57339a 100644 Binary files a/dabest/tests/baseline_images/test_06_cummings_two_group_paired_meandiff.png and b/dabest/tests/baseline_images/test_06_cummings_two_group_paired_meandiff.png differ diff --git a/dabest/tests/baseline_images/test_07_cummings_multi_group_unpaired.png b/dabest/tests/baseline_images/test_07_cummings_multi_group_unpaired.png index 28db90fd..044f725e 100644 Binary files a/dabest/tests/baseline_images/test_07_cummings_multi_group_unpaired.png and b/dabest/tests/baseline_images/test_07_cummings_multi_group_unpaired.png differ diff --git a/dabest/tests/baseline_images/test_08_cummings_multi_group_paired.png b/dabest/tests/baseline_images/test_08_cummings_multi_group_paired.png index 15905943..b0a698aa 100644 Binary files a/dabest/tests/baseline_images/test_08_cummings_multi_group_paired.png and b/dabest/tests/baseline_images/test_08_cummings_multi_group_paired.png differ diff --git a/dabest/tests/baseline_images/test_09_cummings_shared_control.png b/dabest/tests/baseline_images/test_09_cummings_shared_control.png index 9f015ec2..1a7915bd 100644 Binary files a/dabest/tests/baseline_images/test_09_cummings_shared_control.png and b/dabest/tests/baseline_images/test_09_cummings_shared_control.png differ diff --git a/dabest/tests/baseline_images/test_10_cummings_multi_groups.png b/dabest/tests/baseline_images/test_10_cummings_multi_groups.png index 7a287389..d1a87b32 100644 Binary files a/dabest/tests/baseline_images/test_10_cummings_multi_groups.png and b/dabest/tests/baseline_images/test_10_cummings_multi_groups.png differ diff --git a/dabest/tests/baseline_images/test_11_inset_plots.png b/dabest/tests/baseline_images/test_11_inset_plots.png index 9c5b77b6..e56ca05b 100644 Binary files a/dabest/tests/baseline_images/test_11_inset_plots.png and b/dabest/tests/baseline_images/test_11_inset_plots.png differ diff --git a/dabest/tests/baseline_images/test_12_gardner_altman_ylabel.png b/dabest/tests/baseline_images/test_12_gardner_altman_ylabel.png index 598e10cc..beee947a 100644 Binary files a/dabest/tests/baseline_images/test_12_gardner_altman_ylabel.png and b/dabest/tests/baseline_images/test_12_gardner_altman_ylabel.png differ diff --git a/dabest/tests/baseline_images/test_13_multi_2group_color.png b/dabest/tests/baseline_images/test_13_multi_2group_color.png index 943d13b0..e29cce0f 100644 Binary files a/dabest/tests/baseline_images/test_13_multi_2group_color.png and b/dabest/tests/baseline_images/test_13_multi_2group_color.png differ diff --git a/dabest/tests/baseline_images/test_14_gardner_altman_paired_color.png b/dabest/tests/baseline_images/test_14_gardner_altman_paired_color.png index 8c70d906..8e5cff68 100644 Binary files a/dabest/tests/baseline_images/test_14_gardner_altman_paired_color.png and b/dabest/tests/baseline_images/test_14_gardner_altman_paired_color.png differ diff --git a/dabest/tests/baseline_images/test_15_change_palette_a.png b/dabest/tests/baseline_images/test_15_change_palette_a.png index 9aacd4b9..9cd72d99 100644 Binary files a/dabest/tests/baseline_images/test_15_change_palette_a.png and b/dabest/tests/baseline_images/test_15_change_palette_a.png differ diff --git a/dabest/tests/baseline_images/test_16_change_palette_b.png b/dabest/tests/baseline_images/test_16_change_palette_b.png index 02ca2d59..e9c81327 100644 Binary files a/dabest/tests/baseline_images/test_16_change_palette_b.png and b/dabest/tests/baseline_images/test_16_change_palette_b.png differ diff --git a/dabest/tests/baseline_images/test_17_change_palette_c.png b/dabest/tests/baseline_images/test_17_change_palette_c.png index d8e9fb21..8e1db226 100644 Binary files a/dabest/tests/baseline_images/test_17_change_palette_c.png and b/dabest/tests/baseline_images/test_17_change_palette_c.png differ diff --git a/dabest/tests/baseline_images/test_18_desat.png b/dabest/tests/baseline_images/test_18_desat.png index 08b8b14f..5a435a2f 100644 Binary files a/dabest/tests/baseline_images/test_18_desat.png and b/dabest/tests/baseline_images/test_18_desat.png differ diff --git a/dabest/tests/baseline_images/test_19_dot_sizes.png b/dabest/tests/baseline_images/test_19_dot_sizes.png index 296c6189..1ed6e4ab 100644 Binary files a/dabest/tests/baseline_images/test_19_dot_sizes.png and b/dabest/tests/baseline_images/test_19_dot_sizes.png differ diff --git a/dabest/tests/baseline_images/test_20_change_ylims.png b/dabest/tests/baseline_images/test_20_change_ylims.png index 87a2e312..bde5a2f9 100644 Binary files a/dabest/tests/baseline_images/test_20_change_ylims.png and b/dabest/tests/baseline_images/test_20_change_ylims.png differ diff --git a/dabest/tests/baseline_images/test_21_invert_ylim.png b/dabest/tests/baseline_images/test_21_invert_ylim.png index a60712df..c423ab7a 100644 Binary files a/dabest/tests/baseline_images/test_21_invert_ylim.png and b/dabest/tests/baseline_images/test_21_invert_ylim.png differ diff --git a/dabest/tests/baseline_images/test_22_ticker_gardner_altman.png b/dabest/tests/baseline_images/test_22_ticker_gardner_altman.png index 199effa0..1281d247 100644 Binary files a/dabest/tests/baseline_images/test_22_ticker_gardner_altman.png and b/dabest/tests/baseline_images/test_22_ticker_gardner_altman.png differ diff --git a/dabest/tests/baseline_images/test_23_ticker_cumming.png b/dabest/tests/baseline_images/test_23_ticker_cumming.png index fe76b9e5..0aae1a86 100644 Binary files a/dabest/tests/baseline_images/test_23_ticker_cumming.png and b/dabest/tests/baseline_images/test_23_ticker_cumming.png differ diff --git a/dabest/tests/baseline_images/test_24_wide_df_nan.png b/dabest/tests/baseline_images/test_24_wide_df_nan.png index 7508c4dc..c331bf91 100644 Binary files a/dabest/tests/baseline_images/test_24_wide_df_nan.png and b/dabest/tests/baseline_images/test_24_wide_df_nan.png differ diff --git a/dabest/tests/baseline_images/test_25_long_df_nan.png b/dabest/tests/baseline_images/test_25_long_df_nan.png index 7508c4dc..c331bf91 100644 Binary files a/dabest/tests/baseline_images/test_25_long_df_nan.png and b/dabest/tests/baseline_images/test_25_long_df_nan.png differ diff --git a/dabest/tests/baseline_images/test_26_slopegraph_kwargs.png b/dabest/tests/baseline_images/test_26_slopegraph_kwargs.png index 2a595b02..8b7aeb99 100644 Binary files a/dabest/tests/baseline_images/test_26_slopegraph_kwargs.png and b/dabest/tests/baseline_images/test_26_slopegraph_kwargs.png differ diff --git a/dabest/tests/baseline_images/test_27_gardner_altman_reflines_kwargs.png b/dabest/tests/baseline_images/test_27_gardner_altman_reflines_kwargs.png index 79aab0dc..2908f174 100644 Binary files a/dabest/tests/baseline_images/test_27_gardner_altman_reflines_kwargs.png and b/dabest/tests/baseline_images/test_27_gardner_altman_reflines_kwargs.png differ diff --git a/dabest/tests/baseline_images/test_28_paired_cumming_slopegraph_reflines_kwargs.png b/dabest/tests/baseline_images/test_28_paired_cumming_slopegraph_reflines_kwargs.png index d1aca9d3..250ea4c9 100644 Binary files a/dabest/tests/baseline_images/test_28_paired_cumming_slopegraph_reflines_kwargs.png and b/dabest/tests/baseline_images/test_28_paired_cumming_slopegraph_reflines_kwargs.png differ diff --git a/dabest/tests/baseline_images/test_28_unpaired_cumming_reflines_kwargs.png b/dabest/tests/baseline_images/test_28_unpaired_cumming_reflines_kwargs.png index a26e642c..a0b8f995 100644 Binary files a/dabest/tests/baseline_images/test_28_unpaired_cumming_reflines_kwargs.png and b/dabest/tests/baseline_images/test_28_unpaired_cumming_reflines_kwargs.png differ diff --git a/dabest/tests/baseline_images/test_99_style_sheets.png b/dabest/tests/baseline_images/test_99_style_sheets.png index 46413f8b..f5eddb1c 100644 Binary files a/dabest/tests/baseline_images/test_99_style_sheets.png and b/dabest/tests/baseline_images/test_99_style_sheets.png differ diff --git a/dabest/tests/test_03_plotting.py b/dabest/tests/test_03_plotting.py index 9723b009..78511321 100644 --- a/dabest/tests/test_03_plotting.py +++ b/dabest/tests/test_03_plotting.py @@ -24,14 +24,14 @@ two_groups_unpaired = load(df, idx=("Control 1", "Test 1")) -two_groups_paired = load(df, idx=("Control 1", "Test 1"), +two_groups_paired = load(df, idx=("Control 1", "Test 1"), paired=True, id_col="ID") - + multi_2group = load(df, idx=(("Control 1", "Test 1",), ("Control 2", "Test 2")) ) - -multi_2group_paired = load(df, + +multi_2group_paired = load(df, idx=(("Control 1", "Test 1"), ("Control 2", "Test 2")), paired=True, id_col="ID") @@ -40,7 +40,7 @@ "Test 2", "Test 3", "Test 4", "Test 5", "Test 6") ) - + multi_groups = load(df, idx=(("Control 1", "Test 1",), ("Control 2", "Test 2","Test 3"), ("Control 3", "Test 4","Test 5", "Test 6") @@ -49,84 +49,84 @@ -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_01_gardner_altman_unpaired_meandiff(): return two_groups_unpaired.mean_diff.plot(); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_02_gardner_altman_unpaired_mediandiff(): return two_groups_unpaired.median_diff.plot(); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_03_gardner_altman_unpaired_hedges_g(): return two_groups_unpaired.hedges_g.plot(); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_04_gardner_altman_paired_meandiff(): return two_groups_paired.mean_diff.plot(); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_04_gardner_altman_paired_hedges_g(): return two_groups_paired.hedges_g.plot(); - -@pytest.mark.mpl_image_compare + +@pytest.mark.mpl_image_compare(tolerance=10) def test_05_cummings_two_group_unpaired_meandiff(): return two_groups_unpaired.mean_diff.plot(fig_size=(4, 6), float_contrast=False); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_06_cummings_two_group_paired_meandiff(): return two_groups_paired.mean_diff.plot(fig_size=(6, 6), float_contrast=False); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_07_cummings_multi_group_unpaired(): return multi_2group.mean_diff.plot(); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_08_cummings_multi_group_paired(): return multi_2group_paired.mean_diff.plot(fig_size=(6, 6)); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_09_cummings_shared_control(): return shared_control.mean_diff.plot(); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_10_cummings_multi_groups(): return multi_groups.mean_diff.plot(); -@pytest.mark.mpl_image_compare(tolerance=20) +@pytest.mark.mpl_image_compare(tolerance=10) def test_11_inset_plots(): - + # Load the iris dataset. Requires internet access. iris = pd.read_csv("https://github.com/mwaskom/seaborn-data/raw/master/iris.csv") - iris_melt = pd.melt(iris.reset_index(), + iris_melt = pd.melt(iris.reset_index(), id_vars=["species", "index"], var_name="metric") - - - + + + # Load the above data into `dabest`. iris_dabest1 = load(data=iris, x="species", y="petal_width", idx=("setosa", "versicolor", "virginica")) @@ -134,16 +134,16 @@ def test_11_inset_plots(): iris_dabest2 = load(data=iris, x="species", y="sepal_width", idx=("setosa", "versicolor")) - iris_dabest3 = load(data=iris_melt[iris_melt.species=="setosa"], + iris_dabest3 = load(data=iris_melt[iris_melt.species=="setosa"], x="metric", y="value", idx=("sepal_length", "sepal_width"), paired=True, id_col="index") - - - + + + # Create Figure. - fig, ax = plt.subplots(nrows=2, ncols=2, - figsize=(15, 15), + fig, ax = plt.subplots(nrows=2, ncols=2, + figsize=(15, 15), gridspec_kw={"wspace":0.5}) iris_dabest1.mean_diff.plot(ax=ax.flat[0]); @@ -153,87 +153,87 @@ def test_11_inset_plots(): iris_dabest3.mean_diff.plot(ax=ax.flat[2]); iris_dabest3.mean_diff.plot(ax=ax.flat[3], float_contrast=False); - + return fig - - - -@pytest.mark.mpl_image_compare + + + +@pytest.mark.mpl_image_compare(tolerance=10) def test_12_gardner_altman_ylabel(): - return two_groups_unpaired.mean_diff.plot(swarm_label="This is my\nrawdata", + return two_groups_unpaired.mean_diff.plot(swarm_label="This is my\nrawdata", contrast_label="The bootstrap\ndistribtions!"); - -@pytest.mark.mpl_image_compare + +@pytest.mark.mpl_image_compare(tolerance=10) def test_13_multi_2group_color(): return multi_2group.mean_diff.plot(color_col="Gender"); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_14_gardner_altman_paired_color(): return two_groups_paired.mean_diff.plot(fig_size=(6, 6), color_col="Gender"); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_15_change_palette_a(): return multi_2group.mean_diff.plot(fig_size=(8, 6), - color_col="Gender", + color_col="Gender", custom_palette="Dark2"); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_16_change_palette_b(): return multi_2group.mean_diff.plot(custom_palette="Paired"); -my_color_palette = {"Control 1" : "blue", +my_color_palette = {"Control 1" : "blue", "Test 1" : "purple", "Control 2" : "#cb4b16", # This is a hex string. "Test 2" : (0., 0.7, 0.2) # This is a RGB tuple. } - -@pytest.mark.mpl_image_compare + +@pytest.mark.mpl_image_compare(tolerance=10) def test_17_change_palette_c(): return multi_2group.mean_diff.plot(custom_palette=my_color_palette); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_18_desat(): - return multi_2group.mean_diff.plot(custom_palette=my_color_palette, - swarm_desat=0.75, + return multi_2group.mean_diff.plot(custom_palette=my_color_palette, + swarm_desat=0.75, halfviolin_desat=0.25); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_19_dot_sizes(): - return multi_2group.mean_diff.plot(raw_marker_size=3, + return multi_2group.mean_diff.plot(raw_marker_size=3, es_marker_size=12); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_20_change_ylims(): - return multi_2group.mean_diff.plot(swarm_ylim=(0, 5), + return multi_2group.mean_diff.plot(swarm_ylim=(0, 5), contrast_ylim=(-2, 2)); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_21_invert_ylim(): - return multi_2group.mean_diff.plot(contrast_ylim=(2, -2), + return multi_2group.mean_diff.plot(contrast_ylim=(2, -2), contrast_label="More negative is better!"); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_22_ticker_gardner_altman(): f = two_groups_unpaired.mean_diff.plot() @@ -246,12 +246,12 @@ def test_22_ticker_gardner_altman(): contrast_axes.yaxis.set_major_locator(Ticker.MultipleLocator(0.5)) contrast_axes.yaxis.set_minor_locator(Ticker.MultipleLocator(0.25)) - + return f -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_23_ticker_cumming(): f = multi_2group.mean_diff.plot(swarm_ylim=(0,6), contrast_ylim=(-3, 1)) @@ -264,7 +264,7 @@ def test_23_ticker_cumming(): contrast_axes.yaxis.set_major_locator(Ticker.MultipleLocator(0.5)) contrast_axes.yaxis.set_minor_locator(Ticker.MultipleLocator(0.25)) - + return f @@ -278,7 +278,7 @@ def test_23_ticker_cumming(): wide_df = pd.concat([c1, t1, t2, t3],axis=1) -long_df = pd.melt(wide_df, +long_df = pd.melt(wide_df, value_vars=["Control", "Test 1", "Test 2", "Test 3"], value_name="value", var_name="group") @@ -286,75 +286,74 @@ def test_23_ticker_cumming(): -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_24_wide_df_nan(): - wide_df_dabest = load(wide_df, + wide_df_dabest = load(wide_df, idx=("Control", "Test 1", "Test 2", "Test 3") ) - return wide_df_dabest.mean_diff.plot(); + return wide_df_dabest.mean_diff.plot(); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_25_long_df_nan(): long_df_dabest = load(long_df, x="group", y="value", idx=("Control", "Test 1", "Test 2", "Test 3") ) - return long_df_dabest.mean_diff.plot(); - - - -@pytest.mark.mpl_image_compare + return long_df_dabest.mean_diff.plot(); + + + +@pytest.mark.mpl_image_compare(tolerance=10) def test_26_slopegraph_kwargs(): - + return two_groups_paired.mean_diff.plot( slopegraph_kwargs=dict(linestyle='dotted') ); - -@pytest.mark.mpl_image_compare + +@pytest.mark.mpl_image_compare(tolerance=10) def test_27_gardner_altman_reflines_kwargs(): - + return two_groups_unpaired.mean_diff.plot( reflines_kwargs=dict(linestyle='dotted') ); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_28_unpaired_cumming_reflines_kwargs(): - + return two_groups_unpaired.mean_diff.plot( fig_size=(12,10), float_contrast=False, - reflines_kwargs=dict(linestyle='dotted', + reflines_kwargs=dict(linestyle='dotted', linewidth=2), contrast_ylim=(-1, 1) ); -@pytest.mark.mpl_image_compare +@pytest.mark.mpl_image_compare(tolerance=10) def test_28_paired_cumming_slopegraph_reflines_kwargs(): - + return two_groups_paired.mean_diff.plot(float_contrast=False, color_col="Gender", slopegraph_kwargs=dict(linestyle='dotted'), - reflines_kwargs=dict(linestyle='dashed', + reflines_kwargs=dict(linestyle='dashed', linewidth=2), contrast_ylim=(-1, 1) ); - - -@pytest.mark.mpl_image_compare + + +@pytest.mark.mpl_image_compare(tolerance=10) def test_99_style_sheets(): # Perform this test last so we don't have to reset the plot style. plt.style.use("dark_background") - + return multi_2group.mean_diff.plot(); - diff --git a/docs/source/conf.py b/docs/source/conf.py index 63d707e4..70037856 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -77,7 +77,7 @@ # The short X.Y version. version = '0.3' # The full version, including alpha/beta/rc tags. -release = '0.3.0' +release = '0.3.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/getting-started.rst b/docs/source/getting-started.rst index 69df07ff..2f872e81 100644 --- a/docs/source/getting-started.rst +++ b/docs/source/getting-started.rst @@ -8,15 +8,15 @@ Getting Started Requirements ------------ -Python 3.8 is strongly recommended. DABEST has also been tested with Python 3.5, 3.6, and 3.7. +Python 3.8 is strongly recommended. DABEST has also been tested with Python 3.6 and 3.7. In addition, the following packages are also required (listed with their minimal versions): -* `numpy 1.17 `_ -* `scipy 1.2 `_ -* `matplotlib 3.0 `_ -* `pandas 0.25.3 `_ -* `seaborn 0.9 `_ +* `numpy 1.19 `_ +* `scipy 1.5 `_ +* `matplotlib 3.3 `_ +* `pandas 1.1 `_ +* `seaborn 0.11 `_ * `lqrt 0.3 `_ To obtain these package dependencies easily, it is highly recommended to download the `Anaconda `_ distribution of Python. diff --git a/docs/source/index.rst b/docs/source/index.rst index 7bbb3414..b2b88c27 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -18,31 +18,34 @@ Analyze your data with estimation statistics! News ---- +October 2020: + - v0.3.1 released. The minimal versions of dependencies have been upgraded. Also, the minimal version of Python required is now 3.5. + January 2020: - 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`. December 2019: - - v0.2.8 released. This release adds the `Lq-Likelihood-Ratio-Type Test `_ in the statistical output, and also a bugfix for slopegraph and reference line keyword parsing. + - v0.2.8 released. This release adds the `Lq-Likelihood-Ratio-Type Test `_ in the statistical output, and also a bugfix for slopegraph and reference line keyword parsing. October 2019: - - v0.2.7 released. A minor bugfix in the handling of wide datasets with unequal Ns in each group. - - 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. + - v0.2.7 released. A minor bugfix in the handling of wide datasets with unequal Ns in each group. + - 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. September 2019: - 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. May 2019: - - v0.2.4 released. This is a patch for a set of bugs that mis-aligned Gardner-Altman plots, and also adds the capability to tweak the x-position of the Tufte gapped lines. + - v0.2.4 released. This is a patch for a set of bugs that mis-aligned Gardner-Altman plots, and also adds the capability to tweak the x-position of the Tufte gapped lines. - v0.2.3 released. This is a fix for a bug that did not properly handle x-columns which were pandas Categorical objects. April 2019: - v0.2.2 released. This is a minor bugfix that addressed an issue for an edge case where the mean or median difference was exactly zero. - + March 2019: - v0.2.1 released. This is a minor bugfix that addressed an issue in gapped line plotting. - - v0.2.0 released. This is a major update that makes several breaking changes to the API. - + - v0.2.0 released. This is a major update that makes several breaking changes to the API. + Contents -------- diff --git a/docs/source/release-notes.rst b/docs/source/release-notes.rst index 7f6dd5f7..1cad9301 100644 --- a/docs/source/release-notes.rst +++ b/docs/source/release-notes.rst @@ -4,6 +4,18 @@ Release Notes ============= +v0.3.1 +------ + +This release updates the minimal Python version to 3.6 (as `Python 3.5 is already an "end-of-life" release as of September 2020 `_), and also updates the package requirements to: + - :py:mod:`numpy`: 0.19 + - :py:mod:`matplotlib`: 3.3 + - :py:mod:`scipy`: 1.5 + - :py:mod:`pandas`: 1.1 + - :py:mod:`seaborn`: 0.11 + - :py:mod:`lqrt`: 0.3 + +All users are strongly encouraged to update. v0.3.0 ------ @@ -40,10 +52,10 @@ v0.2.6 Feature additions: - It is now possible to specify a pre-determined :py:mod:`matplotlib` :py:class:`Axes` to create the estimation plot in. See :ref:`inset plot` in the :doc:`tutorial` (`Pull request #73 `_; thanks to Adam Nekimken (`@anekimken `_). - - + - -Bug-fixes: +Bug-fixes: - Ensure all dependencies are installed along with DABEST. (`Pull request #71 `_; thanks to Matthew Edwards (`@mje-nz `_). - Handle infinities in bootstraps during plotting. (`Issue #72 `_, `Pull request #74 `_) @@ -54,7 +66,7 @@ Feature additions: - Adding Ns of each group to the results DataFrame. (`Issue #45 `_) - Auto-labelling the swarmplot rawdata axes y-label. (`Issue #51 `_) -Bug-fixes: +Bug-fixes: - Bug affecting calculation of paired difference confidence intervals. (`Issue #48 in ACCLAB/dabestr `_) - NaNs in unused/unrelated columns would result in null results (`Issue #44 `_) diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 62cb2201..62b63963 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -15,13 +15,13 @@ Load Libraries import numpy as np import pandas as pd import dabest - + print("We're using DABEST v{}".format(dabest.__version__)) .. parsed-literal:: - We're using DABEST v0.3.0 + We're using DABEST v0.3.1 Create dataset for demo @@ -35,32 +35,32 @@ this dataset, each column corresponds to a group of observations. from scipy.stats import norm # Used in generation of populations. - + np.random.seed(9999) # Fix the seed so the results are replicable. # pop_size = 10000 # Size of each population. Ns = 20 # The number of samples taken from each population - + # Create samples c1 = norm.rvs(loc=3, scale=0.4, size=Ns) c2 = norm.rvs(loc=3.5, scale=0.75, size=Ns) c3 = norm.rvs(loc=3.25, scale=0.4, size=Ns) - + t1 = norm.rvs(loc=3.5, scale=0.5, size=Ns) t2 = norm.rvs(loc=2.5, scale=0.6, size=Ns) t3 = norm.rvs(loc=3, scale=0.75, size=Ns) t4 = norm.rvs(loc=3.5, scale=0.75, size=Ns) t5 = norm.rvs(loc=3.25, scale=0.4, size=Ns) t6 = norm.rvs(loc=3.25, scale=0.4, size=Ns) - - + + # Add a `gender` column for coloring the data. females = np.repeat('Female', Ns/2).tolist() males = np.repeat('Male', Ns/2).tolist() gender = females + males - - # Add an `id` column for paired data plotting. + + # Add an `id` column for paired data plotting. id_col = pd.Series(range(1, Ns+1)) - + # Combine samples and gender into a DataFrame. df = pd.DataFrame({'Control 1' : c1, 'Test 1' : t1, 'Control 2' : c2, 'Test 2' : t2, @@ -93,11 +93,11 @@ for more details. /* .dataframe tbody tr th:only-of-type { vertical-align: middle; } - + .dataframe tbody tr th { vertical-align: top; } - + .dataframe thead th { text-align: right; } */ @@ -226,15 +226,15 @@ the comparisons that can be computed. .. parsed-literal:: - DABEST v0.3.0 + DABEST v0.3.1 ============= - + Good afternoon! - The current time is Mon Jan 20 17:12:44 2020. - + The current time is Mon Oct 19 17:12:44 2020. + Effect size(s) with 95% confidence intervals will be computed for: 1. Test 1 minus Control 1 - + 5000 resamples will be used to generate the effect size bootstraps. @@ -251,7 +251,7 @@ dataset that indicates the identity of each observation, using the :linenos: - two_groups_paired = dabest.load(df, idx=("Control 1", "Test 1"), + two_groups_paired = dabest.load(df, idx=("Control 1", "Test 1"), paired=True, id_col="ID") .. code-block:: python3 @@ -265,15 +265,15 @@ dataset that indicates the identity of each observation, using the .. parsed-literal:: - DABEST v0.3.0 + DABEST v0.3.1 ============= - + Good afternoon! - The current time is Mon Jan 20 17:12:44 2020. - + The current time is Mon Oct 19 17:12:44 2020. + Paired effect size(s) with 95% confidence intervals will be computed for: 1. Test 1 minus Control 1 - + 5000 resamples will be used to generate the effect size bootstraps. @@ -298,15 +298,15 @@ produced. .. parsed-literal:: - DABEST v0.3.0 + DABEST v0.3.1 ============= - + Good afternoon! - The current time is Mon Jan 20 17:12:44 2020. - + The current time is Mon Oct 19 17:12:44 2020. + Effect size(s) with 90% confidence intervals will be computed for: 1. Test 1 minus Control 1 - + 5000 resamples will be used to generate the effect size bootstraps. @@ -314,11 +314,11 @@ produced. Effect sizes ------------ -``dabest`` now features a range of effect sizes: - - the mean difference (``mean_diff``) - - the median difference (``median_diff``) - - `Cohen’s d `__ (``cohens_d``) - - `Hedges’ g `__ (``hedges_g``) +``dabest`` now features a range of effect sizes: + - the mean difference (``mean_diff``) + - the median difference (``median_diff``) + - `Cohen’s d `__ (``cohens_d``) + - `Hedges’ g `__ (``hedges_g``) - `Cliff’s delta `__ (``cliffs_delta``) Each of these are attributes of the ``Dabest`` object. @@ -334,20 +334,20 @@ Each of these are attributes of the ``Dabest`` object. .. parsed-literal:: - DABEST v0.3.0 + DABEST v0.3.1 ============= - + Good afternoon! - The current time is Mon Jan 20 17:12:44 2020. - + The current time is Mon Oct 19 17:12:44 2020. + The unpaired mean difference between Control 1 and Test 1 is 0.48 [95%CI 0.221, 0.768]. - The p-value of the two-sided permutation t-test is 0.001. - + The p-value of the two-sided permutation t-test is 0.001. + 5000 bootstrap samples were taken; the confidence interval is bias-corrected and accelerated. The p-value(s) reported are the likelihood(s) of observing the effect size(s), if the null hypothesis of zero difference is true. For each p-value, 5000 reshuffles of the control and test labels were performed. - + To get the results of all valid statistical tests, use `.mean_diff.statistical_tests` @@ -359,7 +359,7 @@ For each comparison, the type of effect size is reported (here, it’s the This confidence interval is generated through bootstrap resampling. See :doc:`bootstraps` for more details. -Since v0.3.0, DABEST will report the p-value of the `non-parametric two-sided approximate permutation t-test `__. This is also known as the Monte Carlo permutation test. +Since v0.3.0, DABEST will report the p-value of the `non-parametric two-sided approximate permutation t-test `__. This is also known as the Monte Carlo permutation test. For unpaired comparisons, the p-values and test statistics of `Welch's t test `__, `Student's t test `__, and `Mann-Whitney U test `__ can be found in addition. For paired comparisons, the p-values and test statistics of the `paired Student's t `__ and `Wilcoxon `__ tests are presented. @@ -380,11 +380,11 @@ For unpaired comparisons, the p-values and test statistics of `Welch's t test