Cover: Toolkit for Weighting and Analysis of Nonequivalent Groups

Toolkit for Weighting and Analysis of Nonequivalent Groups

A Tutorial on the TWANG Shiny App for Two Treatments

Published Jul 7, 2022

by Beth Ann Griffin, Ricardo Sanchez, Matthew Cefalu, Christopher E. Maerzluft, Chuck Story, Lynsay Ayer, Donna L. Coffman, Brian G. Vegetabile, Joseph D. Pane, Lane F. Burgette, et al.

Download eBook for Free

FormatFile SizeNotes
PDF file 6.9 MB

Use Adobe Acrobat Reader version 10 or higher for the best experience.

The Toolkit for Weighting and Analysis of Nonequivalent Groups (TWANG) was first developed in 2004 by RAND researchers for the R statistical computing language and environment. The R version of the package contains functions for creating high-quality propensity score weights that can be used to estimate treatment effects with two or more treatment groups and time-varying treatments. The Shiny software development package allowed the TWANG project team to develop a menu-driven application that can be used to perform analyses using the TWANG package's suite of commands without requiring a user to learn R. This tutorial provides an introduction on how to use the TWANG Shiny app to estimate propensity score weights for two treatment groups when using observational data as well as to estimate treatment effect estimates using those propensity score weights.

The TWANG Shiny app can be used to compute the needed propensity score weights for an analysis and check the quality of the resulting propensity score weights by assessing whether they have good balancing properties. The TWANG Shiny app can also use the propensity score weights to estimate causal treatment effect estimates assuming key assumptions of methods hold (e.g., no unobserved confounding or overlap concerns exist in the data). It also showcases how to assess the sensitivity of those results to unobserved confounding. The tutorial demonstrates use of the TWANG Shiny app through an illustrative example and toy dataset. An updated version of the TWANG Shiny app was released in July 2022.

Access the tool

Research conducted by

This research was prepared for the National Institute on Drug Abuse and conducted by the Justice Policy Program within RAND Social and Economic Well-Being.

This report is part of the RAND tool series. RAND tools may include models, databases, calculators, computer code, GIS mapping tools, practitioner guidelines, web applications, and various toolkits. All RAND tools undergo rigorous peer review to ensure both high data standards and appropriate methodology in keeping with RAND's commitment to quality and objectivity.

This document and trademark(s) contained herein are protected by law. This representation of RAND intellectual property is provided for noncommercial use only. Unauthorized posting of this publication online is prohibited; linking directly to this product page is encouraged. Permission is required from RAND to reproduce, or reuse in another form, any of its research documents for commercial purposes. For information on reprint and reuse permissions, please visit

RAND is a nonprofit institution that helps improve policy and decisionmaking through research and analysis. RAND's publications do not necessarily reflect the opinions of its research clients and sponsors.