An implementation of the GRIM test, in Python
Project description
The GRIM test
An implementation of the GRIM test, in python
Beta: Work in progress
Introduction
This package is based on the GRIM (Granularity-Related Inconsistency of Means) test first highlighted by Heathers & Brown in their 2016 paper.
The test makes use of a simple numerical property to identify if the mean of integer values has been correctly calculated.
You don't need the original integer values. You just need the mean and the number (n) of items in the list.
What about rounding?
Often the 'mean' you are testing has previously been rounded. You can check if the mean is consistent with a particular rounding type by including that as an argument.
This implementation supports all the rounding types currently found in Python 3.8's decimal implementation.
(They are: ROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_UP, ROUND_05UP)
If no rounding type is included then the test assumes the it should use ROUND_HALF_UP.
Example:
from grim import mean_tester
import decimal
# mean is 11.09 and n is 21
print(mean_tester.consistency_check('11.09', '21', decimal.ROUND_HALF_UP))
This will return False as the mean could not be correct given a list of 21 integers (and using ROUND_HALF_UP rounding.)
You can pass in the numbers as Strings or Decimals, this avoids floating point accuracy issues that are more likely to occur when using a 'float'.
How can I find out more?
James Heathers has published articles that explain how the technique works and how he used it to expose inconsistencies in scientific papers.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grim-0.1.0.tar.gz.
File metadata
- Download URL: grim-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
866f65fb8a4b7c792e930e981adcbf752716dfa86864d0bc811f2d78199d0cd1
|
|
| MD5 |
c9a3d245e205a759b446c445927116fa
|
|
| BLAKE2b-256 |
9c42cd77ce55cb147160e0b031c3abade36a2f897533b8e30d042bd21da734a5
|
File details
Details for the file grim-0.1.0-py3-none-any.whl.
File metadata
- Download URL: grim-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9b30d43009957468cba7e8b01cdd4398f6cb38bb5a054395918af360cffb11d
|
|
| MD5 |
c90722013442cdf4319952b149160f2f
|
|
| BLAKE2b-256 |
294849435f96dfa5140286e9d5550001b4fac70279e4f23b29f18de5ab001a11
|