L1.profile {cem}R Documentation

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 = 12, 
weights, plot = TRUE, add = FALSE, col = "red", 
lty = 1, M=100, useCP=NULL, grouping=NULL, progress=TRUE,
verbose=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

weights

weights

useCP

a list which elements is a list of cutpoints, usually passed from a previous instance of L1.profile. If not NULL these coarsenings are used instead of generating them randomly.

M

number of random coarsenings

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

grouping

named list, each element of which is a list of groupings for a single categorical variable. See Details.

progress

if TRUE, feedback on progress is given. See Details.

verbose

integer, controls level of output.

Details

The L1 measure depends on the coarsening chosen to calculate it, and as such the comparison of different matching solutions may differ depending on this somewhat arbitrary choice. This function computes L1 for a random range of possible coarsenings. The point of this function is that if one matching solution has a lower L1 than another, then it dominates without regard to the choice of coarsening. A graphic display conveys the results succinctly. (The logic is similar to that for ROC curves used for classification algorithms.) (This degree of coarsening should remain fixed for different CEM runs.)

For each variables the function generates a random number of cutpoints between min.cut and max.cut in which to cut the support of each variable. This procedure is repeated M times. The out is sorted in increasing values of L1 just for graphical representation.

Non numeric variables are grouped randomly unless they appear specified in the grouping argument.

A plot method exists for the returned object.

Value

An invisible object of class L1profile which contains a named list of coarsenings and values of the L1 measure for each coarsening.

Author(s)

Stefano Iacus, Gary King, and Giuseppe Porro

References

Iacus, King, Porro (2011) doi: 10.1198/jasa.2011.tm09599

Iacus, King, Porro (2012) doi: 10.1093/pan/mpr013

Iacus, King, Porro (2019) doi: 10.1017/pan.2018.29

Examples


set.seed(123)
data(LL)
for(i in c(4:6,10:12))
 LL[[i]] <- factor(LL[[i]])

imb0 <- L1.profile(LL$treated,LL, drop=c("treated","re78"))

if(require(MatchIt)){
 m2 <- matchit(treated ~ black + hispanic + married + nodegree + 
  u74 + u75 + education + age + re74 + re75, data=LL, 
  distance="logit")

 m3 <- try(matchit(treated ~ black + hispanic + married + nodegree + 
  u74 + u75 + education + age + re74 + re75, data=LL, 
  distance="mahalanobis"), TRUE)
 
 L1.profile(LL$treated,LL, drop=c("treated","re78"), 
  weights=m2$w, add=TRUE, col="green", lty=2, useCP=imb0$CP)

 if(class(m3)[1]!="try-error"){
   L1.profile(LL$treated,LL, drop=c("treated","re78"), 
    weights=m3$w, add=TRUE, col="orange", lty=3, useCP=imb0$CP)
    }
}

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

L1.profile(LL$treated,LL, drop=c("treated","re78"), 
 weights=m1$w>0, add=TRUE, col="blue", lty=4, useCP=imb0$CP)

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


[Package cem version 1.1.29 Index]