--- id: cem version: "1.1.0" license: unclear license_treatment: unclear maintenance: dormant --- # cem — Coarsened Exact Matching for Causal Inference License: unclear · Maintenance: dormant · Downloads: 2.7M/mo ## What it is and what it does CEM is a lightweight Python library for Coarsened Exact Matching, a statistical method that improves causal inference by reducing covariate imbalance in observational data. It works by coarsening continuous and categorical predictor variables into strata, then matching or reweighting observations to balance treatment and control groups. The library provides automatic and manual coarsening workflows, implements L1 and L2 multivariate imbalance measures, and produces observation weights suitable for downstream regression analysis. The package is designed for researchers and analysts working with observational studies who need treatment effect estimates that are robust to model specification. It depends only on pandas and numpy, making it lightweight and easy to integrate into existing data analysis pipelines. Users typically coarsen their data, apply matching to generate weights, measure resulting imbalance, and use those weights in weighted regression models. Use it for: - Reduce covariate imbalance in observational studies before estimating treatment effects. - Generate observation weights for weighted regression to improve causal inference robustness. - Compare L1 and L2 imbalance measures across different coarsening strategies. - Preprocess data for causal inference when alternative matching is not suitable. - Validate that matched samples have acceptable covariate balance before analysis. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Implements Coarsened Exact Matching (CEM), a statistical matching technique that reduces covariate imbalance in observational data to produce more stable causal treatment effect estimates. Yes, if you are conducting causal inference with observational data and need a lightweight, dependency-minimal matching technique. The package has no known vulnerabilities and low install friction. However, the dormant maintenance status and unclear license terms warrant verification before production use. Suitable for research and academic work; exercise caution in proprietary contexts until license is clarified. ## Install pip install cem uv add cem poetry add cem ## Installing cem Before you install: Low friction installation with only pandas and numpy as runtime dependencies. Package is dormant (last release 2023-10-12) with no recent maintenance signal, though it remains compatible with Python 3.9–3.12. License in practice: License treatment is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms before use in proprietary or restricted contexts. Quickstart: pip install cem from cem.match import match from cem.coarsen import coarsen from cem.imbalance import L1 import pandas as pd X_coarse = coarsen(X, T, "l1") weights = match(X_coarse, T) imbalance = L1(X_coarse, weights) Requires Python >=3.9,<3.13; pandas and numpy must be installed. Verify before relying: - Whether the dormant status signals abandonment risk or stable maintenance. - Actual license terms and conditions (SPDX identifier and full license text not provided). - Performance characteristics and scalability limits for large datasets. - How CEM results compare to other matching techniques in practice. ## Package facts - License: not declared (unclear) - Python support: capped_below_current - Install friction: low - Maintenance: dormant - Downloads: 2.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags coarsened exact matching, causal inference matching, covariate imbalance reduction, treatment effect estimation, observational study matching, propensity score alternative, L1 L2 imbalance measures, causal-inference, matching-methods, observational-studies [View on SkillFed](https://skillfed.io/packages/cem) · [View on PyPI](https://pypi.org/project/cem/)