CEM-LinearInf is a Python package for linear causal inference, which can help you implement the whole process of causal inference easily.
Project description
CEM-LinearInf's Documentation
CEM-LinearInf is a Python package for linear causal inference, which can help you implement the whole process of causal inference easily.
Please check out the following sections for further information, including how to install and use this package, and related references.
- Documentation: https://cem-linearinf.readthedocs.io/en/latest/index.html
- GitHub repo: https://github.com/WenyiWU0111/CEM_LinearInf.git
- Open Source: MIT license
💡 Installation
Install CEM_LinearInf
using pip
pip install CEM_LinearInf
📖 Examples and notebooks
✏️ Functions
-
Coarsened Exact Matching (CEM)
CEM is a data preprocessing algorithm in causal inference which can construct your observational data into 'quasi' experimental data easily, mitigating the model dependency, bias, and inefficiency of your estimation of the treatment effect (Ho, Imai, King, & Stuart 2007).
Different coarsen methods and 1 to k matching method based on different distances are supported.
-
Balance Checking
When we finish the coarsened exact matching, it is necessary to evaluate the quality of the matching with balance checking methods. When the covariate balance is achieved, the resulting effect estimate is less sensitive to model misspecification and ideally close to true treatment effect (Greifer, 2023).
Different methods including L1 imbalance score, SMD, KS score, density plot, and empirical cdf plot are supported.
-
Treatment Effect Inference
After conducting the coarsened exact matching and imbalance checking, we can estimate the average treatment effect ATT and heterogeneous treatment effect HTE with statistical inference methods.
Linear regression models including OLS, Ridge, and Lasso are supported here.
-
Sensitivity Analysis
When we conduct causal inference to the observational data, the most important assumption is that there is no unobserved confounding. Therefore, after finishing the treatment effect estimation, investigators are advised to conduct the sensitivity analysis to examine how fragile a result is against the possibility of unobserved confounders (Cinelli, Hazlett, 2020).
In other words, we should examine how strong the effect of unobserved confounders should be to erase the treatment effect estimated.
Omitted variable bias based sensitivity analysis method (Cinelli, Hazlett, 2020) and Wilcoxon's signed rank test based sensitivity analysis method (Rosenbaum, 2015) are supported here.
⭐️ Reference
-
Abadie, A., & Imbens, G. W. (2006). Large Sample Properties of Matching Estimators for Average Treatment Effects. Econometrica, 74(1), 235–267. https://doi.org/10.1111/j.1468-0262.2006.00655.x
-
Chernozhukov, V., Chetverikov, D., Demirer, M., Duflo, E., Hansen, C., Newey, W., & Robins, J. (2017). Double/debiased machine learning for treatment and causal parameters.
-
Cinelli, C., & Hazlett, C. (2020). Making Sense of Sensitivity: Extending Omitted Variable Bias. Journal of the Royal Statistical Society Series B: Statistical Methodology, 82(1), 39–67. https://doi.org/10.1111/rssb.12348
-
Cinelli, C., & Ferwerda, J., & Hazlett, C. (2020). “sensemakr: Sensitivity Analysis Tools for OLS in R and Stata.” https://www.researchgate.net/publication/340965014_sensemakr_Sensitivity_Analysis_Tools_for_OLS_in_R_and_Stata
-
Greifer N (2023). cobalt: Covariate Balance Tables and Plots. https://github.com/ngreifer/cobalt.
-
Ho, D., Imai, K., King, G., & Stuart, E. (2007). Matching as Nonparametric Preprocessing for Reducing Model Dependence in Parametric Causal Inference. Political Analysis, 15, 199–236. Retrieved from https://tinyurl.com/y4xtv32s
-
Ho D, Imai K, King G, Stuart E (2011). “MatchIt: Nonparametric Preprocessing for Parametric Causal Inference.” Journal of Statistical Software, 42(8), 1–28. https://doi.org/10.18637/jss.v042.i08.
-
Iacus, S. M., King, G., & Porro, G. (2009). CEM: Coarsened Exact Matching Software. Journal of Statistical Software, 30(9). Retrieved from http://gking.harvard.edu/cem
-
Iacus, S. M., King, G., and Porro, G. (2011). Multivariate Matching Methods That are Monotonic Imbalance Bounding. Journal of the American Statistical Association, 106(493), 345-361. Retrieved from https://tinyurl.com/y6pq3fyl
-
Iacus, S. M., King, G., & Porro, G. (2012). Causal Inference Without Balance Checking: Coarsened Exact Matching. Political Analysis, 20(1), 1–24. Retrieved from https://tinyurl.com/yydq5enf
-
Rosenbaum, P. R. (2005). Sensitivity analysis in observational studies. Encyclopedia of statistics in behavioral science.
-
Standardized mean difference (SMD) in causal inference. (2021, Oct 31). Retrieved from https://statisticaloddsandends.wordpress.com/2021/10/31/standardized-mean-difference-smd-in-causal-inference/
-
What is the L1 imbalance measure in causal inference? (2021, Nov 25). Retrieved from https://statisticaloddsandends.wordpress.com/2021/11/25/what-is-the-l1-imbalance-measure-in-causal-inference/
-
Zhang, Z., Kim, H. J., Lonjon, G., Zhu, Y., & written on behalf of AME Big-Data Clinical Trial Collaborative Group (2019). Balance diagnostics after propensity score matching. Annals of translational medicine, 7(1), 16. https://doi.org/10.21037/atm.2018.12.10
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file CEM_LinearInf-0.0.1.tar.gz
.
File metadata
- Download URL: CEM_LinearInf-0.0.1.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d94609843bbc5750aaa23d1b38e3b27f1eb4ce95f0c68a59e61f03261cdfc67 |
|
MD5 | 778e877461bc390bd496d12f43f26f19 |
|
BLAKE2b-256 | c61f76bd904a91036166f3452500f07b045938df89ce60f654c0195f9b6f0578 |
File details
Details for the file CEM_LinearInf-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: CEM_LinearInf-0.0.1-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a218e829559193a49e9e268fbdbf591122a125e383701c8f133fd5ac867ca82d |
|
MD5 | 1ee1afde851a7c71043e8165fe46ce67 |
|
BLAKE2b-256 | c2db716bc854d22a6f04236f3e8ccd0927f471ab282fb92aa3ea698a0a0cc41a |