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.0a3.tar.gz (15.7 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.0a3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcartest-0.0.0a3.tar.gz
  • Upload date:
  • Size: 15.7 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.0a3.tar.gz
Algorithm Hash digest
SHA256 961dc4e084cb07a5d645015bb162a13d5ae905a7259f14473cb599ebc56c019e
MD5 49f37327b26d1aaa6c95947f28cd56ed
BLAKE2b-256 364b537593a122cd3cbfa6172563c8fa5981cf9c9f612ba4814a99a80ac7656c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcartest-0.0.0a3-py3-none-any.whl
  • Upload date:
  • Size: 15.8 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.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 9525c362725b57d984e61cce88e463ab5f725cc3c6faa059f4cd24cab4e93bf3
MD5 3febd527d9cafca64d89522083b4166a
BLAKE2b-256 3afb1d546f179dcf4252fca3579ffce1c7878a6e1561b58f107d0912890613a0

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