Below is a code to generate Love plots in Stata. This code was created by Rebecca Raciborski, PhD, a health economist at the Center for Mental Healthcare & Outcomes Research, Central Arkansas Veterans Healthcare System.*
Love plots graphically display the pre and post effects of propensity scores. Learn about propensity scores and the application of Love Plots in Todd Wagner's cyberseminar on Propensity Scores.
version 17webuse cattaneo2, clearquietly {teffects ipw (bweight) (mbsmoke mmarried mage prenatal1 fbaby c.mage#(c.mage i.mmarried prenatal1))tebalance summarizemat diff = r(table)[1...,1..2]mat colnames diff = before after}*list description of covariates in PS model IN ORDER specifiedlabel def covariates 1 "Mother married" 2 "Mother's age" 3 "Prenatal care" 4 "First baby" 5 "Mother's age^2" 6 "Mother's age X married" 7 "Mother's age X prenatal care"svmat diff, names(col)sum before, meanonlylocal ll = min(-0.1,r(min))local ul = max(0.1,r(max))tempvar cgen `c' = _n if !missing(before)label val `c' covariatesgraph dot before after, over(`c', label(labsize(small)) axis(noline)) yscale(range(`ll' `ul')) yline(0, lcolor(gs5)) ylabel(, labsize(small) ) yline(-0.1, lcolor(gs5) lpattern(dash)) yline(0.1, lcolor(gs5) lpattern(dash)) ytitle("Standardized Mean Difference", margin(top_bottom)) graphregion(fcolor(white)) plotregion(lcolor(gs5)) legend(subtitle("Matching") order(1 "Before" 2 "After") region(ls(none))) title("Exposure: Maternal smoking", span color(gs0) margin(bottom))*linetype(line) lines(lwidth(none)) uncomment to hide dotsdrop before after
*Minor modifications to run on VINCI and within interactive Stata by Vilija Joyce.