Hi Maurice,
this code should work. It was a bug in CEM when it returns an empty matching solution (no
matched units). I'll fix it in the next release of CEM.
Meanwhile, one way is to set some break points for the support of your variables:
I've set 3 cut points for each numerical variable, you may decide a different
solution for example using the spacegraph function (see below)
library(MatchIt)
library(cem)
formula.matching <- as.formula ("CINTER2G ~ QCP84AX3 + QCP84PS2 + QCP84BAT +
QCP84OP + QCP84IN2 + QCP84HYP + ADVERS84 + DOSSM + DOSSP")
todrop <- c("ID")
data.for.matching$DOSSM <- factor(data.for.matching$DOSSM)
data.for.matching$DOSSP <- factor(data.for.matching$DOSSP)
br <- list(QCP84AX3=3, QCP84PS2=3, QCP84BAT=3, QCP84OP=3, QCP84IN2=3, QCP84HYP=3,
ADVERS84=3)
mat <- cem(treatment="CINTER2G", data=data.for.matching, drop=todrop,
cut=br)
mat2 <- matchit(formula = formula.matching, data = data.for.matching,
method="cem", drop=todrop, cut=br)
# USING SPACEGRAPH
sp <- spacegraph("CINTER2G", data.for.matching, drop="ID", M=250,
R=list(cem=50,psm=50, mdm=0),min=2,max=3)
mybr <- plot(sp) # type esc on the plot window to exit and obtain the cutpoints
# and then
mat <- cem(treatment="CINTER2G", data=data.for.matching, drop=todrop,
cut=mybr$breaks)
mat2 <- matchit(formula = formula.matching, data = data.for.matching,
method="cem", drop=todrop, cut=mybr$breaks)
bests
Stefano
Il giorno 15/ago/2013, alle ore 16:09, Francois Maurice <maurice.francois(a)ymail.com>
ha scritto:
Here's a sample script and a dataset attached to this email.
And here's the session information :
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=French_Canada.1252 LC_CTYPE=French_Canada.1252
[3] LC_MONETARY=French_Canada.1252 LC_NUMERIC=C
[5] LC_TIME=French_Canada.1252
attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] cem_1.1.5 combinat_0.0-8 randomForest_4.6-7 lattice_0.20-15
[5] nlme_3.1-108 MatchIt_2.4-21 MASS_7.3-23 rkward_0.6.0
loaded via a namespace (and not attached):
[1] grid_2.15.1 tools_2.15.1
thanks to look at it,
François Maurice
<data.RData><cem.R>-
--
cem Mailing List, served by HUIT
Send messages: cem(a)lists.gking.harvard.edu
[un]subscribe Options:
http://lists.gking.harvard.edu/?info=cem
More information on cem:
http://gking.harvard.edu/cem
Cem mailing list
Cem(a)lists.gking.harvard.edu
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/cem
-----------------------------------
Stefano M. Iacus
Dipartimento di Economia, Management
e Metodi Quantitativi
Universita' di Milano
Via Conservatorio, 7
I-20123 Milano
Tel: 02 50321 461
Fax: 02 50321 505
http://www.economia.unimi.it/iacus
Twitter: @iacus
------------------------------------------------------------------------------------
Please don't send me Word or PowerPoint attachments if not
absolutely necessary. See:
http://www.gnu.org/philosophy/no-word-attachments.html