Bayesian estimation supersedes the t-test
Project description
BEST: Bayesian Estimation Supersedes the t-Test
Python implementation of a Bayesian model to replace t-tests with Bayesian estimation, following the idea described in the following publication:
John K. Kruschke. Bayesian estimation supersedes the t test. Journal of Experimental Psychology: General, 2013, v.142 (2), pp. 573-603. (doi: 10.1037/a0029146)
The package implements Bayesian estimation of the mean of one or two groups, and plotting functions for the posterior distributions of variables such as the effect size, group means and their difference.
Documentation
See the documentation for more information, at best.readthedocs.io.
Requirements
- Python ≧ 3.7
- SciPy
- Matplotlib (≧ 3.0.0) for plotting
- PyMC3
Examples
A complete analysis and plotting is done in just a few lines:
>>> best_out = best.analyze_two(group1_data, group2_data)
>>> fig = best.plot_all(best_out)
>>> fig.savefig('best_plots.pdf')
For example, the two-group analysis in examples/smart_drug.py
produces the following output:
More detailed analysis of the same data can be found in the Jupyter notebook examples/Smart drug (comparison of two groups).ipynb
.
An example single-group analysis can be found in examples/paired_samples.py
.
The documentation describes the API in detail.
Installation
Ensure your Python version is sufficiently up-to-date (at least 3.7):
$ python --version
Python 3.7.12
Then install this package and its dependencies with PIP:
$ pip install best
Developer notes
Tests
Running the tests requires pytest (pip install pytest
),
and then can be run with:
$ python -m pytest tests
The plotting tests only ensure that the plot_all
function does not throw errors,
and the plots need manual verification at tests/data/plot_all_*.pdf
.
Documentation
The documentation can be built with Sphinx:
$ cd docs
$ make html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file best-2.0.4.tar.gz
.
File metadata
- Download URL: best-2.0.4.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a49800dfc970216e9ade76239da577bf1a15bc60d272abd658d191787e81a553 |
|
MD5 | e8fbaa4cf5277c617f04c7ed0226365f |
|
BLAKE2b-256 | 4740f26a968aa325447f2178f4e0f886b575014889d37fb7acdd491237e2250c |
File details
Details for the file best-2.0.4-py3-none-any.whl
.
File metadata
- Download URL: best-2.0.4-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f129cd342965c1ab1a697947ff3a61604208f667fe1bb992f59787321f96f44b |
|
MD5 | 8ac8265f61b9456b4353c2733e40108f |
|
BLAKE2b-256 | fa1bf2aa5626c8adbb0c055513d283c604c58106ea71f926211587d27677ff7b |