Hi Cem list,
I came across a problem when I tried to use the "miest" command to fit a regression model on the five imputed data sets generated by Amelia II because the variable "cem_weight" was not found in other four imputed data sets except the first one.
I used the Amelia II to produce five imputed data sets and saved them as: imp1.dta, imp2.dta, imp3.dta, imp4.dta, imp5.dta in the same folder. I then opened imp1.dta and matched the data with "cem" command. After that, I used the "miest" command to do the regression. However, there was an error and it showed that "no; data in memory would be lost". I learned to use "miest" from the manual cem: Coarsened Exact Matching in Stata written by Blackwell et al. (2010). In the manual, on page 15, it says that "the cem_weights variable is added to each of the datasets". Except for imp1.dta, I did not find the variable "cem_weights" in other four imputed datasets. Many thanks for anyone who can help me solve this problem. I used Stata 12 in Windows Vista.
The following are the commands I typed in Stata: . use "C:\Stata12\imp1.dta", clear(Written by R. ). imb gender n3 black knowledge partyid ideology,tr(treated). cem gender n3(0 6.5 7.5 8.5) black knowledge(0 0.15 0.45 1.5) cem_partyid(#0) cem_id> eo(#0), tr(treated) miname(imp) misets(5). miest imp reg supp treated wmedia [aweight=cem_weights]no; data in memory would be lostr(4);
Best,Mitch
Hello all,
Can anyone help me understand why imbalance measure for "mat" function is
different from imbalance meausre obtained from matched dataset using
"imbalance" function? Initially when I ran "mat" function, it gave me
imbalance measure (L1) of
0.727 with 171 matched control and 116 matched treatment. I subset
those matches from the original dataset and ran "imbalance" function
and it gave me L1=0.825
Thank you.
Dear all,
when installing the cem package in R2.15 I receive the following error
message.
> install.packages("cem",repos="http://r.iq.harvard.edu", type="source")
Warning in install.packages :
package ?cem? is not available (for R version 2.15.2)
Installing package(s) into ?C:/home/R/win-library/2.15?
(as ?lib? is unspecified)
Warning in install.packages :
dependencies ?randomForest?, ?combinat? are not available
trying URL 'http://r.iq.harvard.edu/src/contrib/cem_1.1.4.tar.gz'
Content type 'application/x-gzip' length 889628 bytes (868 Kb)
opened URL
I would be very grateful for any advise on how to make cem work.
Kind regards,
Hannah
I am familiarizing myself with CEM using R.
I've used spacegraph and cem so far, I notice that when the bins that are chosen automatically; the bins chosen always start and begin at the smallest and largest values of the data and only the number of divisions is changed. Why is it that other variations of bin configurations are not explored?
Setting aside bin configurations that are not equally spaced, but have you considered variations of bin configurations that translate about, not necessarily beginning and ending at the limits of the range, but still cover the data? Like so.
MakeRndmBins <- function(data,n){
min=min(data)
max=max(data)
outVect=array(dim=n+3) # vector indices 1:n+2 will define
outVect[1]=min # bins from min to max with n+1 bins
outVect[n+2]=max # or n divisions
caliper=(max-min)/(n+1) # caliper or bin width
for (i in 1:n ){
outVect[i+1]=caliper*i+min
}
outVect[n+3] = max + caliper # create one extra bin
# on the right side
outVect = outVect - runif(1,0,caliper) #perform random
# translation to the left
return(outVect)
}
> MakeRndmBins(c(17,55),3)
[1] 15.08076 24.58076 34.08076 43.58076 53.08076 62.58076
> MakeRndmBins(c(0,1),3)
[1] -0.06772855 0.18227145 0.43227145 0.68227145 0.93227145 1.18227145
> MakeRndmBins(c(0,1),3)
[1] -0.1023989 0.1476011 0.3976011 0.6476011 0.8976011 1.1476011
> MakeRndmBins(c(0,1),3)
[1] -0.04485268 0.20514732 0.45514732 0.70514732 0.95514732 1.20514732
One might argue this is exactly like changing the size of the first and last bins.