Skip to main content
https://img.shields.io/pypi/v/medstat.svg https://img.shields.io/travis/monferrand/medstat.svg License Documentation Status

medstat is a library aiming to make basic hypothesis testing as simple as possible.

Getting started

This project is available on PyPI you can just:

pip install medstat

Quick Example

Load your data in a dataframe using for instance pd.read_csv() or pd.read_excel().

data = pd.read_csv("my_data.csv")

Test a single hypothesis:

>>> medstat.test_hypothesis(data, 'sex', 'age < 30')

{'contingency_table':
age < 30  False  True  All
sex
Female       26    22   48
Male         24     8   32
All          50    30   80,
'test': 'Fisher',
'p-value': 0.06541995357625573,
'significant': False}

Or test many hypothesis at the same time:

result = medstat.analyse_dataset(data,
                                 [('sex', 'age < 30'),
                                  ('sex', 'test_a'),
                                  ('test_a', 'age > 50'),
                                 ])

It prints the output:

-------------------- Test 1 --------------------
Test independence between sex and age < 30.
Use Chi-squared test.
Result is not significant.
p-value: 0.18407215636751517
Contingency table:
 age < 30  False  True  All
sex
Female       21    18   39
Male         29    12   41
All          50    30   80


-------------------- Test 2 --------------------
Test independence between sex and test_a.
Use Chi-squared test.
Result is not significant.
p-value: 0.9539453144224308
Contingency table:
 test_a  negative  positive  All
sex
Female        25        14   39
Male          25        16   41
All           50        30   80


-------------------- Test 3 --------------------
Test independence between test_a and age > 50.
Use Fisher test.
Result is significant.
p-value: 6.392910983822276e-12
Contingency table:
 age > 50  False  True  All
test_a
negative     46     4   50
positive      5    25   30
All          51    29   80

You can also save it to a text file using the file argument.

result = medstat.analyse_dataset(data,
                                 [('sex', 'age < 30'),
                                  ('sex', 'test_a'),
                                  ('test_a', 'age > 50'),
                                 ],
                                file='report.txt')

Metadata

Release files for medstat 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for medstat 1.0.2
File Size Uploaded
medstat-1.0.2.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for medstat 1.0.2
File Interpreter ABI Platform
medstat-1.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 17.7 kB

Release files / medstat-1.0.2.tar.gz

Download URL medstat-1.0.2.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
91d519fff773b2faaa66f70722cc422c19f175a1784c7e2d4962ea76fe77ae01
BLAKE2b-256 checksum
How to use checksums
73f4b398621c7289c4a047b024a678a9a48eeba02e7e0660221f20a14deacdb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.0

Release files / medstat-1.0.2-py2.py3-none-any.whl

Download URL medstat-1.0.2-py2.py3-none-any.whl
Size 5.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
441410b4237c00631955f0c829563a0d75c7aa61e31b31f6030a8b29947b4e1f
BLAKE2b-256 checksum
How to use checksums
02aae192dc3fe1a869ad72fa21dbfdbc5350dacbae01600ed251bb67497bc0ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release 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