Skip to main content

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 look for exact matches.

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.

Download files

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

Source Distribution

grim-0.0.3.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

grim-0.0.3-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file grim-0.0.3.tar.gz.

File metadata

  • Download URL: grim-0.0.3.tar.gz
  • Upload date:
  • Size: 2.5 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

Hashes for grim-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a90f3200614c4b93620b465c8393260bda53775b1fbbad0ba2db22160088cd9d
MD5 dfc6194078e04ae845ec2a7323fb3c09
BLAKE2b-256 ea4393fe1a56004eb002e97fe5aacfd49bc111f47a75c40cc6e7acdd22ef3fcd

See more details on using hashes here.

File details

Details for the file grim-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: grim-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.7 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

Hashes for grim-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b79b8840120774ccfe2cda1989a0623698086f95260539c710ef29639991f394
MD5 8e5f7e4c196a514a1e690d712ba4c70e
BLAKE2b-256 9e9121a7e82546ff1ea3cd886589683b6d5462e57f024bd7429f70ce3db52f48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page