Learn R Programming

cem (version 1.1.31)

relax.cem: Diagnostic tool for CEM

Description

Diagnostic tools for CEM

Usage

relax.cem(obj, data, depth=1, verbose = 1, L1.breaks=NULL, plot=TRUE, 
 fixed=NULL, shifts=NULL, minimal=NULL, use.coarsened=TRUE, 
 eval.imbalance=TRUE, use.weights=FALSE, ...)
relax.plot(tab, group="1", max.terms=50, perc=.5, unique=FALSE, colors=TRUE)

Value

tab

an invisible object containing the tabs and the L1breaks used

Arguments

obj

an object of class cem.

data

the original data.

verbose

controls the level of verbosity.

L1.breaks

list of cutpoints for the calculation of the L1 measure.

plot

plot the solutions?

tab

the output table from relax.cem.

fixed

vector of variable names which will not be relaxed.

max.terms

plot only the last best results of relax.cem.

shifts

a vector of proportions of shifts.

minimal

the minimal number of intervals acceptable after relaxation. Should be a nameed list of positive integers.

group

character string denoting group id. Defaults to "1".

perc

only plot if percentage of matched units is greater than perc.

unique

only plot different solutions (in terms of matched units).

depth

if 1, relaxes up to dropping one var, if 2 relaxes (up to dropping) two vars, etc.

use.coarsened

used coarsened values for continuous variables.

colors

If TRUE each variable is plotted in a different colour.

eval.imbalance

If TRUE L1 measure is evaluated at each iteration.

use.weights

If TRUE L1 measure is evaluated with weights calculated at each iteration. Slows down the execution.

...

passed to the relax.plot function.

Author

Stefano Iacus, Gary King, and Giuseppe Porro

Details

relax.cem starts from a cem solution (as given by cem) which has to be run with argument keep.all=TRUE. relax.cem tries several relaxed coarsenings on the variables. Coarsenings corresponds to dividing the support of each variable into a decreasing number of intervals of the same length (even if in the starting solution intervals are of different lengths). Because CEM is MIB, the number of matched units increases as the number of intervals decrease. All variables are coarsened into k intervals along a sequence which starts from the original number of intervals and decreases to 10 intervals by 2, then continues from 10 down to 1 intervals by 1. If minimal is specified, variables are coarsened down to that minimal value.

To observe MIB property of CEM use.coarsened (default) should be set to TRUE; otherwise the coarsening of the continuous variable will be recalculated at each iteration and there is no guarantee of monotonicity.

relax.cem outputs a list of tables. Each table is named Ggroup where group is the id of the group. Each Ggroup table is ordered in increasing order of matched units of group group. Columns PercGgroup and Ggroup report percentage and absolute number of matched units for each group. Column Relaxed indicates which relaxation has been done, with something like "V1(4), V3(5)", which means "variable V1 has been split in 4 intervals of the same length and variable V3 into five intervals". Thus, the number of intervals is reported in parenthases and if equal to 1 means that the corresponding variable is excluded from affecting the match (i.e. all observations are assigned to the same interval).

If shifts is not null, each coarsening is shifted accordingly (see shift.cem for additional details). In case of shifting ``S:'' appears in the labels.

The relax.plot, plot all the different relaxation in increasing order of number of treated units matched. For each coarsening it also reports the value of the L1 measure. The table generated by relax.cem may contain many entries. By default, only a portion of best coarsenings are plotted (option max.terms). In addition, the user can specify to plot the corasening for which at least a certain percentage of treated units have been matched (option perc, by default 50 In addition, of several different coarsenings which lead to the same number of treated units matched, the user can specify to plot only one of them using the option unique = TRUE (default).

If L1.breaks are NULL they are taken from the cem object if available or calculated atumatically as in cem.

Calling directly plot on the output of cem.relax has the same effect of calling directly relax.plot.

References

Iacus, King, Porro (2011) tools:::Rd_expr_doi("10.1198/jasa.2011.tm09599")

Iacus, King, Porro (2012) tools:::Rd_expr_doi("10.1093/pan/mpr013")

Iacus, King, Porro (2019) tools:::Rd_expr_doi("10.1017/pan.2018.29")

See Also

cem

Examples

Run this code
# \donttest{
data(LL)
set.seed(123)
mat <- cem(treatment="treated",data=LL, drop="re78", keep.all=TRUE)
mat
tab <- relax.cem(mat, LL, depth=1, plot=FALSE)

relax.plot(tab, group="1")
plot(tab, group="1")
relax.plot(tab, group="1", unique=TRUE)
relax.plot(tab, group="1", perc=0.6)
relax.plot(tab, group="1", perc=0.6,unique=TRUE)


tab1 <- relax.cem(mat, LL, depth=1, minimal=list(re74=6, age=3, education=3, re75=5))
tab2 <- relax.cem(mat, LL, depth=1, minimal=list(re74=6, age=3,
                  education=3, re75=5), shifts=0.01)
tab3 <- relax.cem(mat, LL, depth=1, minimal=list(age=3, education=3),
                  fixed=c("re74","re75"))
tab4 <- relax.cem(mat, LL, depth=2, minimal=list(age=4,
                   education=3,re75=6),plot=FALSE, fixed="re74")
relax.plot(tab4)
relax.plot(tab4, unique=TRUE)
relax.plot(tab4, perc=0.7) 
# }

Run the code above in your browser using DataLab