Learn R Programming

cem (version 1.0.117)

L1.profile: Calculates L1 distance for different coarsenings

Description

Calculates L1 distance for different coarsenings

Usage

L1.profile(group, data, drop = NULL, min.cut=2, max.cut=6, ref.cut=3, 
 weights, plot=TRUE, add=FALSE, col="red", lty=1)

Arguments

group
the group variable
data
the data
drop
a vector of variable names in the data frame to ignore
min.cut
minimum number of cut points per variable
max.cut
maximum number of cut points per variable
ref.cut
reference number of cut points per variable
weights
weights
plot
plot a graph?
add
add graph to an existing plot? Makes sense only if plot is TRUE
col
draw in specified color
lty
draw using specified lty

Value

  • An invisible object of class L1profile which contains a named list of coarsening.

Details

The L1 measure depends on the coarsening. A very fine coarsening on the variables (many cut points) produces values of L1 close to 1. A very mild coarsening (very fex cutpoints), is not able to discriminate, i.e. L1 close to 0. This is particularly true when the number of observations is small with respect to the number of continuous variables.

This function calculates the L1 distance for different levels of coarsening. First tries to move the cut the support of all variables together from min.cut to max.cut. Then, fixing a coarsening into ref.cut number of cut points on all variables, it changes the coarsening one variable at time, again from min.cut to max.cut. Given two matching solutions, if, say, the first method provides values of L1 sistematically smaller then the same values for the second method, uniformly on the cut points choices, then then imbalance has been better reduced by the first method. Non numeric variables are not grouped, i.e. no coarsening occurs.

A plot method exists for the returned object.

References

Stefano Iacus, Gary King, Giuseppe Porro, ``Matching for Casual Inference Without Balance Checking,'' http://gking.harvard.edu/files/abs/cem-abs.shtml

Examples

Run this code
data(LL)
for(i in c(4:6,10:12))
 LL[[i]] <- factor(LL[[i]])

L1.profile(LL$treated,LL, drop=c("treated","re78"), max.cut=10)

if(require(MatchIt)){
 m2 <- matchit(treated ~ black + hispanic + married + nodegree + u74 + u75 + education +
  age + re74 + re75, data=LL, distance="logit")
 
 L1.profile(LL$treated,LL, drop=c("treated","re78"), max.cut=10, 
  weights=m2$w, add=TRUE, col="green", lty=2)
}

m1 <- cem("treated", LL, drop="re78")

L1.profile(LL$treated,LL, drop=c("treated","re78"), max.cut=10, 
 weights=m1$w, add=TRUE, col="blue", lty=3)

legend(5, 0.9, legend=c("raw data", "pscore", "cem"), lty=1:3, col=c("red", "green", "blue"))

Run the code above in your browser using DataLab