loveplot: Love plot for assessing covariate balance

loveplotR Documentation

Love plot for assessing covariate balance

Description

Function that creates a Love plot for assessing covariate balance after matching.

Usage

	loveplot(X_mat, t_id, c_id, v_line, legend_position = "topright")

Arguments

X_mat

matrix of covariates: a matrix of covariates used to assess balance.

t_id

a vector of indexes of the treated units.

c_id

a vector of indexes of the matched controls.

v_line

a scalar defining the location of the vertical line that denotes a satisfactory balance.

legend_position

a string specifying the position of the legend. The default is topright. Other options are: bottomright, bottom, bottomleft, left, topleft, top, topright, right and center

Details

In the spirit of Love (2004), loveplot draws a love plot for assessing covariate balance after matching. Specifically, loveplot plots the absolute standardized differences in means before and after matching for all the covariates specified in X_mat.

Author(s)

Jose R. Zubizarreta <zubizarreta@hcp.med.harvard.edu>, Cinar Kilcioglu <ckilcioglu16@gsb.columbia.edu>.

References

Love, T. (2004), "Graphical Display of Covariate Balance," http://chrp.org/love/JSM2004RoundTableHandout.pdf.

Examples

	# Load data
	data(germancities)

	# Sort and attach data
	germancities = germancities[order(germancities$treat, decreasing = TRUE), ]
	attach(germancities)

	# Treatment indicator
	t_ind = treat
	
	# Indexes of the treated units
	t_id = which(t_ind == 1)

	# Matrix of covariates
	X_mat = cbind(log2pop, popgrowth1939, popgrowth3339, emprate, indrate, 
	rubble, rubblemiss, flats, flatsmiss, refugees)

	# Indices of the matched controls (obtained using bmatch in designmatch)
	c_id = c(67, 75, 39, 104, 38, 93, 79, 59, 64, 55, 106, 99, 97, 61, 82, 57, 76, 47, 46, 49)
 
	# Vertical line for satisfactory balance
	vline = 0.15
	
 	# loveplot
	loveplot(X_mat, t_id, c_id, vline) 

designmatch documentation built on Aug. 29, 2023, 5:11 p.m.