Learn R Programming

designmatch (version 0.5.4)

pairsplot: Pairs plot for visualizing matched pairs

Description

Function for visualizing matched pairs in two dimensions.

Usage

pairsplot(cov1, cov2, t_id, c_id, xlab, ylab, main)

Arguments

cov1

a vector for the covariate to be plotted on the x axis.

cov2

a vector for the covariate to be plotted on the y axis.

t_id

a vector of indexes of the treated units.

c_id

a vector of indexes of the matched controls.

xlab

a string specifying the label of the x axis.

ylab

a string specifying the label of the y axis.

main

a string specifying the main title of the plot.

Author

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

Details

pairsplot is a function for visualizing matched pairs in two dimensions, usually defined by two of the matching covariates. Matched pairs are connected by line segments. Horizontal and vertical lines show the means of treated units and matched controls for each of the covariates. Among others, pairsplot can be useful for visualizing near/far matches, e.g. when building a stronger instrumental variable (Baiocchi et al., 2010).

References

Baiocchi, M., Small, D., Lorch, S. and Rosenbaum, P. R. (2010), "Building a Stronger Instrument in an Observational Study of Perinatal Care for Premature Infants," Journal of the American Statistical Association, 105, 1285-1296.

Examples

Run this code
	# 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)
	
	# 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)
 
	# pairsplot	
	pairsplot(rubble, flats, t_id, c_id, "Rubble", "Flats", "")

Run the code above in your browser using DataLab