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


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.0a1.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.0a1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mcartest-0.0.0a1.tar.gz
Algorithm Hash digest
SHA256 7f1703d0fc2dcced951d503440283613a24f6199eafdd1676eeb75e2fdc706d9
MD5 a3c039ec6647eea4aa1bf1c47e6dfc81
BLAKE2b-256 7166feb20214a9caf611e15b30e7f9b9dd119f9e5cda51703ac4c3a922c17def

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcartest-0.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.0

File hashes

Hashes for mcartest-0.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 4568514b881502af92397fecffff638662cf965bfc1e774ce0fae838648fae5e
MD5 1d865ad51f3b67baf428cbc066188c53
BLAKE2b-256 e1b189342a92d46de33a9321b22de71618ef2a08950316ce6113e119720a0b98

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