Skip to main content
https://travis-ci.org/maximtrp/scikit-posthocs.svg?branch=master https://img.shields.io/github/issues/maximtrp/scikit-posthocs.svg https://img.shields.io/pypi/v/scikit-posthocs.svg

This Python package provides statistical post-hoc tests for pairwise multiple comparisons and outlier detection algorithms.

Features

  • Multiple comparisons parametric and nonparametric tests (some are ported from R’s PMCMR package):

    • Conover, Dunn, and Nemenyi tests for use with Kruskal-Wallis test.

    • Conover, Nemenyi, and Siegel tests for use with Friedman test.

    • Quade, van Waerden, and Durbin tests.

    • Student, Mann-Whitney, Wilcoxon, and TukeyHSD tests.

    • Anderson-Darling test.

    All tests are capable of p adjustments for multiple pairwise comparisons.

  • 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).

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')
images/melted-dataframe.png
sp.posthoc_conover(x, val_col='values', group_col='groups')
images/result-conover.png

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)
images/plot-conover.png

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)
images/plot-conover-custom-cmap.png

Credits

Thorsten Pohlert, PMCMR author and maintainer

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scikit-posthocs-0.3.8.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scikit_posthocs-0.3.8-py2.py3-none-any.whl (19.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file scikit-posthocs-0.3.8.tar.gz.

File metadata

File hashes

Hashes for scikit-posthocs-0.3.8.tar.gz
Algorithm Hash digest
SHA256 2952af5d48b2fdd74ca148037556ae29d748e2c19b7c400ecd30805b97648199
MD5 ea8baf93e33677fc18e85ba9a2b01873
BLAKE2b-256 20f9fbce20a44d812cd8818c25eaf2ef766983589f0c4d43d724bd6d76d86087

See more details on using hashes here.

File details

Details for the file scikit_posthocs-0.3.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for scikit_posthocs-0.3.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7f242d0a706f7832a715335a9dd8dc429abd27b5590f3bffcdacc6be8063f81a
MD5 4b68dd21f3041a3cb6f62953a359bfbc
BLAKE2b-256 5de663a3265c772a0f22dba5fb1d770266bb5849765ff5a00bdf54ddf3e1969a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.16.1

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.4

2 files

0.11.3

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.7

1 file

0.6.6

2 files

0.6.5

2 files

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

2 files

0.6.0

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.9

2 files

This release

0.3.8 This release

2 files

0.3.7

1 file

0.3.6

1 file

0.3.4

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page