Skip to main content

Tutorials and notebooks Overview

The tutorials here present various examples of applying balance end-to-end. Each tutorial is linked to a Jupyter notebook you can download and run from your own environment.

Requirements: You will need a Jupyter installation to run these notebooks yourselves. We also assume you have the balance pkg installed.

If you are new to balance, we suggest getting started with the balance Quickstart tutorial.

Tutorials list (more tutorials to be added soon):

  1. quickstart - this is based on a simulated data and presents the simple end-to-end workflow of balance package with default arguments. It demonstrates the process from reading the data, through understanding the biases in the sample, producing weights, evaluating the results and producing the population estimations.
  2. quickstart_cbps - like the quickstart tutorial, but shows how to use the CBPS algorithm and compares the results to IPW (logistic regression with LASSO).
  3. quickstart_rake - like the quickstart tutorial, but shows how to use the rake (raking) algorithm and compares the results to IPW (logistic regression with LASSO).
  4. balance_transformations_and_formulas - This tutorial showcases ways in which transformations, formulas and penalty can be included in your pre-processing of the covariates before adjusting for them.
  5. comparing_cbps_in_r_vs_python_using_sim_data - This notebook compares the results of running CBPS in R and Python. In R using the BCPS package, and in Python using the balance package. The results are almost identical.