Objective
To provide step-by-step guidance and STATA and R code for using propensity score (PS) weighting to estimate moderation effects with categorical variables.
Research design
Tutorial illustrating the key steps for estimating and testing moderation using observational data. Steps include: (1) examining covariate overlap across treatment groups within levels of the moderator; (2) estimating the PS weights; (3) evaluating whether PS weights improved covariate balance; (4) estimating moderated treatment effects; and (5) assessing the sensitivity of findings to unobserved confounding. Our illustrative case study uses data from 41,832 adults from the 2019 National Survey on Drug Use and Health to examine if gender moderates the association between sexual minority status (eg, lesbian, gay, or bisexual [LGB] identity) and adult smoking prevalence.
Results
For our case study, there were no noted concerns about covariate overlap, and we were able to successfully estimate the PS weights within each level of the moderator. Moreover, balance criteria indicated that PS weights successfully achieved covariate balance for both moderator groups. PS-weighted results indicated there was significant evidence of moderation for the case study, and sensitivity analyses demonstrated that results were highly robust for one level of the moderator but not the other.
Conclusions
When conducting moderation analyses, covariate imbalances across levels of the moderator can cause biased estimates. As demonstrated in this tutorial, PS weighting within each level of the moderator can improve the estimated moderation effects by minimizing bias from imbalance within the moderator subgroups.