Code and Data
- R
causalTransportR
: a package for bridging causal effects to new or general populationsivDiag
: Diagnostics and Uncertainty Quantification for Instrumental Variables DesignsrenyiWeights
: Balancing methods using Renyi DivergencesCVXSynth
: Synthetic Control Solvers in CVXRaipwML
: ML estimators for treatment effects under unconfoundednesssp2DID
: Semiparametric 2-period difference in differences estimatorsLalRUtils
: Utilities Package- Applied statistics
- Misc Snippets and Notebooks
- Python
- Stata
- Misc
- Workflow
Intermittently updated list of software projects. Largely collates projects from my github.
R
causalTransportR
: a package for bridging causal effects to new or general populations
causalTransportR
implements a number of estimators to generalize and transport causal effects by reweighting doubly-robust score functions with transformations of selection scores. All nuisance functions are cross-fit using fast supervised learning algorithms.
Reference: Lal, Zheng, Ejdemyr (2022)
remotes::install_github("Netflix-Skunkworks/causalTransportR")
ivDiag
: Diagnostics and Uncertainty Quantification for Instrumental Variables Designs
Package to implement recommended diagnostics, weak-IV tests, and bootstrap in Lal, Lockhart, Xu, and Zu
remotes::install_github("apoorvalal/ivDiag")
renyiWeights
: Balancing methods using Renyi Divergences
remotes::install_github("apoorvalal/renyiWeights")
CVXSynth
: Synthetic Control Solvers in CVXR
Implementations of the original synthetic control (Abadie, Diamond, Hainmueller 2010, 2015) and elastic net synthetic control (Doudchenko and Imbens 2016).
remotes::install_github("apoorvalal/CVXSynth")
Solver
Uses the domain-specific language CVXR with the commercial solver MOSEK
to solve for weights. MOSEK
is free for academics and can be installed using installation instructions on their website. Else, an alternate solver can be passed as the solv
argument for both sc_solve
and en_sc_solve
functions.
aipwML
: ML estimators for treatment effects under unconfoundedness
remotes::install_github("apoorvalal/aipwML")
- tuning-free implementation with h2o here
sp2DID
: Semiparametric 2-period difference in differences estimators
devtools::install_github("apoorvalal/sp2DID")
LalRUtils
: Utilities Package
remotes::install_github("apoorvalal/LalRUtils")
Applied statistics
- Entropy Balancing using Disciplined Convex Optimization
- DML and Ebal with knockoff selection
- Utility library to prepare tables using r6 doubleML objects
- Oaxaca-Blinder estimators for the ATT
- CATE estimation
- Stargazer fork with sensible defaults
- Topic Models in R with applications to the Hansard
Misc Snippets and Notebooks
- Optimized RD (Imbens and Wager 2018)
- Export RDRobust results in a table
- Split-sample debiased Probit with fixed effects
- List all libraries used in project
- Partial Dependence Plots
- Replicating Sala-i-Martin (1997) in less than 100 lines
- Tuning a model using cross-validation in CARET
- Visualising the spread of COVID-19
- Runnable code (deepnote)
- Archive
purrr
-powered grouped plots - gapminder example- download DOI from dataverse
Python
Webscrapers (and associated datasets)
Geographic Data
- geodata conda env
- Animated Maps
- Large vector dataset processing
- Rasterise polygons
- Zonal statistics (raster to polygon calculations)
- Choropleths with custom colourmaps (US presidential voting)
- Measures of Spatial Autocorrelation in PYSAL
- Raster Processing
- Labelling Maps
Text / Parsing
- PDF to plaintext + Ngram-style figures using newspaper data
- Layoutparser for historical tables
- Translating using google translate API
Maths
snippets
Stata
Utilities Package
To install, run the following line in the Stata console:
net install lal_utilities, from(https://raw.github.com/apoorvalal/misc_stata_ados/master/)
Or, if you prefer, download ados and move to your personal ado folder / c(sysdir_personal)
(where ssc-installed ados live).
- walk through many stata files to create codebook
- parallelise multiple stata sessions with a python caller
Misc
- Devnagari characters in latex
- requires
xelatex
andpolyglossia
- requires
- Figlet for code readability
Workflow
I alternate between VSCode, Atom, Sublime, and Jupyter (on my local machine) and Vim (on a remote/headless server) for my programming/word-processing/writing needs. Check out Kieran Healy’s excellent guide to plain text.
I currently use a Framework Laptop running Ubuntu 22.04 as my primary work machine. Some templates for notebooks / tex files / markdown notes can be found here (and can be stored in ~/Templates
on Ubuntu for ease of use):