ecdfplot: Empirical cumulative distribution function plot for assessing...

Description Usage Arguments Details Author(s) Examples

View source: R/ecdfplot.r

Description

Function that plots the empirical cumulative distribution function of a given covariate for treated units and matched controls. ecdfplot can be used to visually inspect the balance of the entire empirical distribution function of the covariate in question.

Usage

1
	ecdfplot(x, t_id, c_id, main_title = "", legend_position = "right")

Arguments

x

a covariate vector to be used to assess balance.

t_id

a vector of indexes of the treated units.

c_id

a vector of indexes of the matched controls.

main_title

a string defining the main title of the plot.

legend_position

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

Details

Function that plots the empirical cumulative distribution function of a given covariate for treated units and matched controls. ecdfplot can be used to visually inspect the balance of the entire empirical distribution function of the covariate in question.

Author(s)

Jose R. Zubizarreta <[email protected]>, Cinar Kilcioglu <[email protected]>.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
	# 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)
		
	# Indexes of the controls before matching
	c_id_before = which(t_ind == 0)
	
	# Indixes of the matched controls (obtained using bmatch in designmatch)
	c_id_after = c(80, 82, 35, 59, 69, 68, 34, 62, 104, 61, 106, 120, 56, 119, 28, 
	113, 76, 118, 75, 71)
	
	# ecdfplot
	par(mfrow = c(2, 1))
	ecdfplot(rubble, t_id, c_id_before, "Before matching")
	ecdfplot(rubble, t_id, c_id_after, "After matching")

Example output

Loading required package: lattice
Loading required package: MASS
Loading required package: slam
Loading required package: Rglpk
Using the GLPK callable library version 4.52

designmatch documentation built on June 19, 2018, 1 a.m.