Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
miaojingang Add missing "!".
PiperOrigin-RevId: 258149805
Latest commit 0a07278 Jul 15, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
empirical_calibration Internal change. Jul 10, 2019
notebooks move lalonde example to notebooks/ Jul 11, 2019 \nRestructure directory\n Jul 2, 2019
LICENSE \nRestructure directory\n Jul 2, 2019 Add missing "!". Jul 15, 2019 Move data/ to under empirical_calibration/. Jul 10, 2019

A Python Library For Empirical Calibration

Dealing with biased data samples is a common task across many statistical fields. In survey sampling, bias often occurs due to the unrepresentative samples. In causal studies with observational data, the treated vs untreated group assignment is often correlated with covariates, i.e., not random. Empirical calibration is a generic weighting method that presents a unified view on correcting or reducing the data biases for the tasks mentioned above. We provide a Python library EC to compute the empirical calibration weights. The problem is formulated as a convex optimization and solved efficiently in the dual form. Compared to existing software, EC is both more efficient and robust. EC also accommodates different optimization objectives, supports weight clipping, and allows inexact calibration which improves the usability. We demonstrate its usage across various experiments with both simulated and real-world data.


Wang, Xiaojing, Miao, Jingang, and Sun, Yunting. (2019). A Python Library For Empirical Calibration. arXiv preprint arXiv:1906.11920.


The easiest way is propably using pip:

pip install -q git+

If you are using a machine without admin rights, you can do:

pip install -q git+ --user

If you are using Google Colab, just add "!" to the beginning:

!pip install -q git+

Package works for python 2 and python 3, although we may stop supporting python 2 in the future.


Package can be imported as

import empirical_calibration as ec

The best way to learn how to use the package is probably by following one of the notebooks, and the recommended way of opening them is Google Colab.


Package is created and maintained by Xiaojing Wang, Jingang Miao, and Yunting Sun.

You can’t perform that action at this time.