Skip to content

Commit

Permalink
Merge pull request #20 from josesho/v0.1.7
Browse files Browse the repository at this point in the history
v0.1.7
  • Loading branch information
josesho authored Jan 15, 2019
2 parents 67e9672 + 0f2bb55 commit 16eb1fb
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install:
- conda update conda --yes
- conda create -n testenv --yes pip python=$PYTHON matplotlib
- source activate testenv
- pip install pytest==3.7
- pip install pytest==4.0
- pip install .

script: pytest
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ DABEST powers [estimationstats.com](https://www.estimationstats.com/), allowing

DABEST has been tested on Python 2.7, 3.5, 3.6, and 3.7.

_Python 2.7 will no longer be supported from dabest v0.2.0 onwards, as [Python 2.7 will no longer be supported after January 1 2020](https://python3statement.org/)._ dabest v.0.2.0 is under development, and will be released before the end of 2019.

In addition, the following packages are also required:
- [numpy](https://www.numpy.org) (1.15)
- [scipy](https://www.scipy.org) (1.1)
Expand Down
2 changes: 1 addition & 1 deletion dabest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._api import plot
from ._bootstrap_tools import bootstrap

__version__="0.1.6"
__version__="0.1.7"
15 changes: 14 additions & 1 deletion dabest/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def plot(
ci_linewidth=3,
summary_linewidth=3,
multiplot_horizontal_spacing=0.75,
cumming_vertical_spacing=0.1,
font_scale=1,
dpi=100,
tick_length=10,
Expand Down Expand Up @@ -170,6 +171,12 @@ def plot(
this determines the horizontal spacing between each plot. This
number is a fraction of the axes width.
cumming_vertical_spacing: float, default 0.05
The amount of height reserved for space between the swarmplot and
the contrast plots, expressed as a fraction of the average axis
height.
font_scale: float, default 1.
The font size will be scaled by this number. This value is passed
on to seaborn.set().
Expand Down Expand Up @@ -529,6 +536,12 @@ def plot(
else:
ws = 0

# Set appropriate vertical spacing between subplots,
# based on whether the contrast is floating.
if float_contrast is False:
hs = cumming_vertical_spacing
else:
hs = 0

# infer the figsize.
if color_col is None:
Expand All @@ -553,7 +566,7 @@ def plot(
if fig_size is None:
fig_size = fsize

gridspecs = {'width_ratios': widthratio, 'wspace' : ws, 'hspace': 0}
gridspecs = {'width_ratios': widthratio, 'wspace' : ws, 'hspace': hs}
subplots_args = {'ncols': ncols, 'figsize':fig_size, 'dpi':dpi,
'gridspec_kw': gridspecs}

Expand Down
2 changes: 1 addition & 1 deletion dabest/_bootstrap_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class bootstrap:
alpha: float, default 0.05
Denotes the likelihood that the confidence interval produced
_does not_ include the true summary statistic. When alpha = 0.05,
does not include the true summary statistic. When alpha = 0.05,
a 95% confidence interval is produced.
reps: int, default 5000
Expand Down
48 changes: 11 additions & 37 deletions dabest/tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@



@pytest.fixture
def create_dummy_dataset(seed=None, n=30, base_mean=0, expt_groups=6,
scale_means=2, scale_std=1.2):
"""
Expand Down Expand Up @@ -53,58 +52,39 @@ def create_dummy_dataset(seed=None, n=30, base_mean=0, expt_groups=6,
return random_seed, max_mean_diff, df


@pytest.fixture
def is_difference(result):
assert result.is_difference == True


@pytest.fixture
def is_paired(result):
assert result.is_paired == True


@pytest.fixture
def check_pvalue_1samp(result):
assert result.pvalue_1samp_ttest != 'NIL'


@pytest.fixture
def check_pvalue_2samp_unpaired(result):
assert result.pvalue_2samp_ind_ttest != 'NIL'


@pytest.fixture
def check_pvalue_2samp_paired(result):
assert result.pvalue_2samp_related_ttest != 'NIL'


@pytest.fixture
def check_mann_whitney(result):
"""Nonparametric unpaired"""
assert result.pvalue_mann_whitney != 'NIL'
assert result.pvalue_wilcoxon == 'NIL'


@pytest.fixture
def check_wilcoxon(result):
"""Nonparametric Paired"""
assert result.pvalue_wilcoxon != 'NIL'
assert result.pvalue_mann_whitney == 'NIL'

# def test_mean_within_ci_bca(mean, result):
# assert mean >= result.bca_ci_low
# assert mean <= result.bca_ci_high
#
# def test_mean_within_ci_pct(mean, result):
# assert mean >= result.pct_ci_low
# assert mean <= result.pct_ci_high

@pytest.fixture
def test_mean_within_ci_bca(mean, result):
assert mean >= result.bca_ci_low
assert mean <= result.bca_ci_high


@pytest.fixture
def test_mean_within_ci_pct(mean, result):
assert mean >= result.pct_ci_low
assert mean <= result.pct_ci_high


@pytest.fixture
def single_samp_stat_tests(sample, result):

assert result.is_difference == False
Expand All @@ -113,8 +93,6 @@ def single_samp_stat_tests(sample, result):
ttest_result = sp.stats.ttest_1samp(sample, 0).pvalue
assert result.pvalue_1samp_ttest == pytest.approx(ttest_result)


@pytest.fixture
def unpaired_stat_tests(control, expt, result):
is_difference(result)
check_pvalue_2samp_unpaired(result)
Expand All @@ -130,8 +108,6 @@ def unpaired_stat_tests(control, expt, result):
alternative='two-sided').pvalue
assert result.pvalue_mann_whitney == pytest.approx(mann_whitney_result)


@pytest.fixture
def paired_stat_tests(control, expt, result):
is_difference(result)
is_paired(result)
Expand All @@ -146,9 +122,7 @@ def paired_stat_tests(control, expt, result):
wilcoxon_result = sp.stats.wilcoxon(control, expt).pvalue
assert result.pvalue_wilcoxon == pytest.approx(wilcoxon_result)


@pytest.fixture
def does_ci_captures_mean_diff(control, expt, paired, nreps=100, alpha=0.05):
def does_ci_capture_mean_diff(control, expt, paired, nreps=100, alpha=0.05):
if expt is None:
mean_diff = control.mean()
else:
Expand Down Expand Up @@ -206,7 +180,7 @@ def test_single_sample_bootstrap(mean=100, sd=10, n=25, nreps=100, alpha=0.05):
results = bst.bootstrap(sample, alpha_level=alpha)
single_samp_stat_tests(sample, results)

does_ci_captures_mean_diff(sample, None, False, nreps, alpha)
does_ci_capture_mean_diff(sample, None, False, nreps, alpha)



Expand All @@ -225,7 +199,7 @@ def test_unpaired_difference(mean=100, sd=10, n=25, nreps=100, alpha=0.05):
results = bst.bootstrap(sample1, sample2, paired=False, alpha_level=alpha)
unpaired_stat_tests(sample1, sample2, results)

does_ci_captures_mean_diff(sample1, sample2, False, nreps, alpha)
does_ci_capture_mean_diff(sample1, sample2, False, nreps, alpha)



Expand All @@ -248,4 +222,4 @@ def test_paired_difference(mean=100, sd=10, n=25, nreps=100, alpha=0.05):
results = bst.bootstrap(sample1, sample2, alpha_level=alpha, paired=True)
paired_stat_tests(sample1, sample2, results)

does_ci_captures_mean_diff(sample1, sample2, True, nreps, alpha)
does_ci_capture_mean_diff(sample1, sample2, True, nreps, alpha)
3 changes: 0 additions & 3 deletions dabest/tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
from .. import _api


# Fixtures.
@pytest.fixture
def create_dummy_dataset(seed=None, n=30, base_mean=0, expt_groups=6,
scale_means=2, scale_std=1.2):
"""
Expand Down Expand Up @@ -56,7 +54,6 @@ def create_dummy_dataset(seed=None, n=30, base_mean=0, expt_groups=6,



@pytest.fixture
def get_swarm_yspans(coll, round_result=False, decimals=12):
"""
Given a matplotlib Collection, will obtain the y spans
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1.5'
release = '0.1.7'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
11 changes: 6 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,32 @@ DABEST
-----------------------------------------------
Data Analysis with Bootstrap-coupled ESTimation
-----------------------------------------------
*version 0.1.6*
*version 0.1.7*

Analyze your data with effect sizes!

.. image:: _images/showpiece.png


News
----
January 2019
- Release of v0.1.7. *Added `cumming_vertical_spacing` option.* See the :doc:`release-notes`.

October 2018
- Release of v0.1.6. *Added more keywords for control of plot elements.* See the :doc:`release-notes`.


July 2018
- Release of v0.1.5. *bugfix for setup and package management*
- Release of v0.1.4.


June 2018
- Release of v0.1.3.
- Added a short tutorial :doc:`dabest-r`!

December 2017
- We have made a `webapp <https://www.estimationstats.com>`_ that produces Gardner-Altman and Cumming plots!


Contents
--------

Expand All @@ -41,7 +43,6 @@ Contents
background
getting-started
tutorial
dabest-r
release-notes
about
api
6 changes: 5 additions & 1 deletion docs/source/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
Release Notes
=============

v0.1.7
======
The keyword `cumming_vertical_spacing` has been added to tweak the vertical spacing between the rawdata swarm axes and the contrast axes in Cumming estimation plots.


v0.1.6
======
Expand Down Expand Up @@ -38,7 +42,7 @@ Aesthetic changes
* add `tick_length` and `tick_pad` arguments to allow tweaking of the axes tick lengths, and padding of the tick labels, respectively.

v0.1.3
=====
======
Update dependencies to

* pandas v0.23
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Load Libraries
.. parsed-literal::
We're using DABEST v0.1.6
We're using DABEST v0.1.7
--------------------
Create dummy dataset
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def check_dependencies():
author_email='[email protected]',
maintainer='Joses W. Ho',
maintainer_email='[email protected]',
version='0.1.6',
version='0.1.7',
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
packages=find_packages(),
Expand Down

0 comments on commit 16eb1fb

Please sign in to comment.