HERC: Love Plot in Stata
Attention A T users. To access the menus on this page please perform the following steps. 1. Please switch auto forms mode to off. 2. Hit enter to expand a main menu option (Health, Benefits, etc). 3. To enter and activate the submenu links, hit the down arrow. You will now be able to tab or arrow up or down through the submenu options to access/activate the submenu links.
Locator
Contact
Search HERC

Love Plot in Stata

Menu
Menu

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 17
webuse cattaneo2, clear
 
quietly {
teffects ipw (bweight) (mbsmoke mmarried mage prenatal1 fbaby c.mage#(c.mage i.mmarried prenatal1))
tebalance summarize
mat diff = r(table)[1...,1..2]
mat colnames diff = before after
}
 
*list description of covariates in PS model IN ORDER specified
label 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, meanonly
local ll = min(-0.1,r(min))
local ul = max(0.1,r(max))
tempvar c 
gen `c' = _n if !missing(before)
label val `c' covariates
graph 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 dots
 
drop before after

*Minor modifications to run on VINCI and within interactive Stata by Vilija Joyce.