Skip to main content

MCAR statistical tests in Python: Little's chi-square test and pairwise t-tests, extended with Cohen's d effect sizes and MCAR/not-MCAR labeling.

Project description

My Logo


Downloads PyPI License

mcartest provides statistical tests for assessing whether missing data is Missing Completely At Random (MCAR), the assumption most imputation methods quietly depend on. It implements Little's chi-square test across the full dataset and pairwise t-tests between every combination of features, returning results as a readable matrix rather than a single opaque p-value.

Where most implementations stop at significance, mcartest also reports Cohen's d effect sizes, because a p-value alone is misleading: with a large sample, a trivial difference becomes "significant," while a real association in a sparse missing-group may never reach the threshold. Effect sizes tell you how strongly missingness is tied to a feature, not just whether the test rejected.

Results can be returned as raw p-values, as human-readable MCAR / not-MCAR labels, or as effect-size magnitude bands (negligible, small, medium, large) reported only where MCAR is rejected, since under MCAR there is no association to quantify. Styling helpers render the matrices with color-coded cells in notebooks and export them straight to Excel.

Built on pyampute (BSD 3-Clause), extended with the effect-size and labeling functionality described above.

Prerequisites

Before installing mcartest, ensure your system meets the following requirements:

Python Version

mcartest requires Python 3.8 or higher. Specific dependency versions vary depending on your Python version.

Dependencies

The following dependencies will be automatically installed with mcartest:

  • jinja2>=3.0.0
  • numpy>=1.19.0
  • openpyxl>=3.0.0
  • pandas>=1.3.0
  • scipy>=1.5.0

💾 Installation

You can install mcartest directly from PyPI:

pip install mcartest

📄 Official Documentation

Documentation

🌐 Author Website

https://www.mii.ucla.edu/

⚖️ License

mcartest is distributed under the Apache License. See LICENSE for more information.

This library includes code derived from pyampute, used under the BSD 3-Clause License. See NOTICE and THIRD_PARTY_LICENSES.md for attribution and the full third-party license text.

📚 Citing mcartest

If you use mcartest in your research or projects, please consider citing it.

Support

If you have any questions or issues with mcartest, please open an issue on this GitHub repository.

Acknowledgements

This work builds on pyampute by Rianne Schouten and Davina Zamanzadeh, whose implementation of Little's MCAR test and the pairwise t-test approach forms the statistical core of this library. The effect-size and labeling extensions were added on top of their work and are also being contributed back upstream.

References

  1. Little, R. J. A. (1988). A Test of Missing Completely at Random for Multivariate Data with Missing Values. Journal of the American Statistical Association, 83(404), 1198-1202. https://doi.org/10.1080/01621459.1988.10478722

  2. Schouten, R. M., Lugtig, P., & Vink, G. (2018). Generating missing values for simulation purposes: A multivariate amputation procedure. Journal of Statistical Computation and Simulation, 88(15), 2909-2930. https://doi.org/10.1080/00949655.2018.1491577

  3. Schouten, R. M., Zamanzadeh, D., & Singh, P. (2022). pyampute: a Python library for data amputation. Zenodo. https://doi.org/10.25080/majora-212e5952-03e

Project details


Download files

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

Source Distribution

mcartest-0.0.0a2.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

mcartest-0.0.0a2-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file mcartest-0.0.0a2.tar.gz.

File metadata

  • Download URL: mcartest-0.0.0a2.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for mcartest-0.0.0a2.tar.gz
Algorithm Hash digest
SHA256 0f25959a134922923f072d82f16273f20f66d5cedcde4f0d4836c858c26d8df6
MD5 fedd8ee1c2b983bbe8d338e8adf9ff39
BLAKE2b-256 df8e4341f296050b4f1e9c4e6fa3ac416285e7e890c4eb1fe8db75f40056c0ae

See more details on using hashes here.

File details

Details for the file mcartest-0.0.0a2-py3-none-any.whl.

File metadata

  • Download URL: mcartest-0.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for mcartest-0.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 e8584ccb1de4f95f9d82fb8466a93516297037a6805f4d2045d6a3340c020c72
MD5 ef06ee171d64941dcc96101a1c546d3d
BLAKE2b-256 93ec16a09b89458d253b2da8345f38717487bd3e6bd013e4969546fccf8b31f5

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 Pingdom Monitoring Sentry Error logging StatusPage Status page