Software.

With coauthors and collaborators, I develop statistical routines for panel data visualization and analyses and for other causal inference and social data description purposes. Below are the different user-cases for the various panel methods:

  1. panelView: panel data visualization.
  2. gsynth: panel causal inference with binary treatments following staggered adoption. Require a large number of pretreatment periods for each treated unit.
  3. fect: panel causal inference with binary treatments of general patterns (switching on-and-off allowed). Require a large number of untreated observations for each treated unit.
  4. bpCausal: Bayesian panel causal inference with binary treatments following staggered adoption. Require a large number of pretreatment observations for each treated unit. Suitable when the number of treated units is small.
  5. tjbal: panel causal inference with binary treatments following staggered adoption. Suitable when the numbers of pretreatment periods are small (e.g. short panels).

Note that gsynth, fect, and bpCausal all rely on the strict exogeneity assumption (of some form), which corresponds to baseline randomization, while tjbal relies on sequential ignorability, which corresponds to sequential randomization. Below I summarize their differences in a table.

Please don’t hesitate to email me if you have any questions regarding usage and bugs.

  1. For installation errors under MacOS BigSur, please check this solution first.
  2. For inquiries on errors from applying a specific method to your data, please consider (1) updating the package via Github; (2) sending us a treatment status plot generated by panelView along with your questions. These will help us diagnose potential problems more quickly. Emails are preferred to issue-reporting on Github.

Panel Data Methods

bpCausal: Bayesian Causal Panel Analysis

bpCausal implements dynamic multilevel linear factor models (DM-LFMs), which is a Bayesian alternative to the synthetic control method for comparative case studies. It provides interpretable uncertainty estimates based on the Bayesian posterior distributions of the counterfactuals.

fect: Fixed Effect Counterfactual Estimators

fect implements a group of counterfactual estimators for causal inference using panel data with binary treatments, including interactive fixed effects and matrix completion methods. It also offers several diagnostic tests, such as a placebo test (for no pre-trends).

tjbal: Trajectory Balancing

Using panel data with binary treatments, tjbal seeks balance on kernelized features from pretreatment periods, thus allowing users to draw causal inference on average and distributional effects under weak functional form assumptions.

gsynth: Generalized Synthetic Control Method

gsynth implements the generalized synthetic control method, an imputation-based causal inference method for panel data with binary treatments following staggered adoption. gsynth is a special case of fect, which allows the treatment to switch back and forth.

panelView: Visualizing Panel Data

panelView has three main functions: (1) it visualizes the treatment and missing-value statuses of each observation in a panel dataset; (2) it plots an outcome variable (or any variable) in a time-series fashion; (3) it visualizes the bivariate relationship between two variables by unit or in aggregate.

Other Methods

ivDiag: Estimation and Diagnostics for IV Designs

ivDiag provides estimation and diagnostic tools for instrumental variables designs, including bootstrapped confidence intervals, effective F-statistics, Anderson-Rubin test, F-dependent valid t-ratio test, and local-to-zero tests.

hbal: Hierarchically Regularized Entropy Balancing

hbal implements hierarchically regularized entropy balancing, which hierarchically regularizes higher-order moment constraints of observed covariates. It improves both the feasibility and efficiency of entropy balancing and requires much less computational resources than kernel balancing.

interflex: Flexible Interaction Models

interflex performs diagnostic tests for multiplicative interaction models and implements flexible estimation strategies that allow for nonlinear interaction effects between a treatment and a moderator on an outcome. interflex accommodates both continuous and discrete outcomes.