Statistical post-hoc analysis and outlier detection algorithms
Project description
This Python package provides statistical post-hoc tests for pairwise multiple comparisons and outlier detection algorithms.
Features
Pairwise multiple comparisons parametric and nonparametric tests:
Conover, Dunn, and Nemenyi tests for use with Kruskal-Wallis test.
Conover, Nemenyi, Siegel, and Miller tests for use with Friedman test.
Quade, van Waerden, and Durbin tests.
Student, Mann-Whitney, Wilcoxon, and TukeyHSD tests.
Anderson-Darling test.
Mack-Wolfe test.
Nashimoto and Wright’s test (NPM test).
Scheffe test.
Tamhane T2 test.
Plotting functionality (e.g. significance plots).
Outlier detection algorithms:
Simple test based on interquartile range (IQR).
Grubbs test.
Tietjen-Moore test.
Generalized Extreme Studentized Deviate test (ESD test).
All tests are capable of p adjustments for multiple pairwise comparisons.
Dependencies
Compatibility
Package is compatible with Python 2 and Python 3.
Install
You can install the package with: pip install scikit-posthocs
Examples
List or NumPy array
import scikit_posthocs as sp
x = [[1,2,3,5,1], [12,31,54], [10,12,6,74,11]]
sp.posthoc_conover(x, p_adjust = 'holm')
array([[-1. , 0.00119517, 0.00278329], [ 0.00119517, -1. , 0.18672227], [ 0.00278329, 0.18672227, -1. ]])
Pandas DataFrame
Columns specified with val_col and group_col args must be melted prior to making comparisons.
import scikit_posthocs as sp
import pandas as pd
x = pd.DataFrame({"a": [1,2,3,5,1], "b": [12,31,54,62,12], "c": [10,12,6,74,11]})
x = x.melt(var_name='groups', value_name='values')
sp.posthoc_conover(x, val_col='values', group_col='groups', p_adjust = 'fdr_bh')
Significance plots
P values can be plotted using a heatmap:
pc = sp.posthoc_conover(x, val_col='values', group_col='groups')
heatmap_args = {'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True, 'cbar_ax_bbox': [0.80, 0.35, 0.04, 0.3]}
sp.sign_plot(pc, **heatmap_args)
Custom colormap applied to a plot:
pc = sp.posthoc_conover(x, val_col='values', group_col='groups')
# Format: diagonal, non-significant, p<0.001, p<0.01, p<0.05
cmap = ['1', '#fb6a4a', '#08306b', '#4292c6', '#c6dbef']
heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5', 'clip_on': False, 'square': True, 'cbar_ax_bbox': [0.80, 0.35, 0.04, 0.3]}
sp.sign_plot(pc, **heatmap_args)
Credits
Thorsten Pohlert, PMCMR author and maintainer
Donate
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 scikit-posthocs-0.3.9.tar.gz
.
File metadata
- Download URL: scikit-posthocs-0.3.9.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc7f83e2211c8b50aeaa63d786198b1d09e01ec2cbdad273e945ebee41ce506 |
|
MD5 | e87f801bd6a1677cf2cb2b42cb7bf2b1 |
|
BLAKE2b-256 | 9c49afbf4e0536011705cf816e70e4960d775c8802f29684148163c181ada2cb |
File details
Details for the file scikit_posthocs-0.3.9-py2.py3-none-any.whl
.
File metadata
- Download URL: scikit_posthocs-0.3.9-py2.py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67cb2fc473946f79a22210c2d2079a8dd62f5e6d79bd1f1dbd1f773d4849163a |
|
MD5 | 243bf00593c59a96895413d94db16258 |
|
BLAKE2b-256 | b7cd053ba2fa7bdc1c79c63c6d048205cececf1dfe10b326c2109fc2eb222f45 |