Software

regrake

An R package for regularized raking, based on the optimization framework of Barratt, Angeris, and Boyd (2021). regrake enables more flexible functional forms in raking to population targets — mixing exact and soft (L2) constraints, supporting meaningful regularization, and ultimately producing more expressive and efficient survey weights. It features a brms-inspired formula interface and accepts a wide variety of target input formats.

Original Paper Website Github

rswjax

A JAX implementation of regularized raking/optimal representative sample weighting, drawing heavily on the original rsw implementation of Barratt, Angeris, and Boyd (rsw). Thanks to rewriting some core operations in JAX, it is significantly faster than rsw for medium-large datasets, especially those with many columns (ex: 5k+ rows, 20+ columns). While JAX isn’t the most natural fit here, this was a fun way to build something complex, and practice making it fast with JAX! I started this project because of my interest in regularized raking, and wanting to iterate faster on large weighting problems.

Original Paper Github Package

retrodesign

retrodesign provides tools for working with Type S (Sign) and Type M (Magnitude) errors, as proposed in Gelman and Tuerlinckx (2000) and Gelman & Carlin (2014). In addition to simply calculating the probability of Type S/M error, the package includes functions for calculating these errors across a variety of effect sizes for comparison, and recommended sample size given “tolerances” for Type S/M errors. To improve the speed of these calculations, closed forms solutions for the probability of a Type S/M error from Lu, Qiu, and Deng (2018) are implemented. The broader goal of this project was to make it easier for researchers to understand these issues in their work, and it’s gratifying the package has been able to do that.

Website Github Package