Unfortunately, I don't think we have an automated procedure for everything. You would have to multiply impute the data, do matching on each imputed data set, and then combine it in zelig() using mi() function. But this does not require any programming. You can simply run the same matching procedure on each data set via matchit() and then feed the resulting multiple matched data sets into zelig().
Good luck,
Kosuke
Department of Politics
Princeton University
http://imai.princeton.edu
On Sep 13, 2011, at 6:02 PM, Pingaul jb wrote:
> Dear Professor,
> I’m a post-doctoral student at Montreal University. I’m actually in Columbia, working and propensity scores with a colleague and using MatchIt and Zelig. First, congratulations for your packages that are very flexible.
>
> My question is about multiple imputation and propensity scores with these softwares. From what I understand, combining both approaches would include:
>
> 1/ Doing multiple imputation and testing which variables to include.
>
> 2/ Propensity score analysis on each imputed data set and pooling the overall balance to check if it is ok (or on each data set?).
>
> 3/ Calculation of the quantities of interest for each data set
>
> 4/ Pooling the quantities across data sets.
>
> I would like to know if there is a written syntax to perform the MatchIt analysis for all of the imputed data set without having to do it manually and check the overall balance. Also, in theory, the number of individuals retained after propensity score matching and the weights can be different for each imputed data set. So that we have to perform the final analysis on each one and then pool the data with a specific procedure to take into account the eventual varying Ns? I normally use Mice package for multiple imputation but it seems that Zelig handle Amelia. My colleague seems to do be able to do all that in stata, but I’m not sure how to make all the three R packages work together.
>
> I would be very happy if you could indicate to me a reference or a place where I can find the syntax to do that (I’ve been using R for some times so I can use packages easily but I have no programming skills).
>
>
> Best Regards!
>
>
>
> Jean-Baptiste
>
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
Zelig program information: http://gking.harvard.edu/zelig/
Hi there,
I am encountering this error when using sim after logit.mixed or
probit.mixed:
Error in qifunction(obj, x = x, x1 = x1, y = y, param = param, num = num)
> : could not find function "setup.x.matrix"
This is with "ZeligMixed".
If I use ZeligMultilevel I get:
Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),
> :
> attempt to set an attribute on NULL
Toy example:
d <- expand.grid(y=rbinom(10,1,.33),x=rnorm(10,1),t=1:4)
z.out <- zelig(y~x+tag(1|t),data=d,model="logit.mixed")
sim(z.out)
thanks,
Yph
Dear James (and Matt),
thanks a lot for this. Actually, I was using it for teaching last week, and it was a good example to link up getting quantities of interest out in a different ways, look a bit more careful at functions, and more importantly to emphasize that package developers and maintainers are very responsive (the joys of intro to R courses).
So thanks for the fix and the example!
Best, Zoltan
On Feb 22, 2013, at 8:58 PM, "Honaker, James" <jhonaker(a)iq.harvard.edu> wrote:
> Zoltan,
>
> I should have mentioned this earlier, but the Zelig package up on the CRAN mirrors is now corrected too.
>
> Thanks again for pointing this out,
> James.
>
> --
> James Honaker, Senior Research Scientist
> //// Institute for Quantitative Social Science, Harvard University
> ________________________________________
> From: Honaker, James
> Sent: Saturday, February 16, 2013 11:43 PM
> To: Zoltan; zelig(a)lists.gking.harvard.edu
> Subject: RE: [zelig] possible anomaly in plot for expected values (logit, probit)
>
> Zoltan,
>
> Thanks for finding this issue. It is now fixed in the source code available on Github. We will post a new package at the local Zelig repository shortly, and to CRAN. When these are posted I'll send out another message.
>
> In the meantime, if you want to immediately press forward, you can try either to [1] compile from the source on github, or [2] overwrite the changed functions in the Zelig namespace. I've put directions for this, if useful, below.
>
> Thanks again,
> James.
>
> -------------------------------------------------------------
>
> [1] To compile from source, try the following. Currently whether this works depends on how latex is set up on your machine. Type the following in the R console:
>
> install.packages("devtools")
> library(devtools)
> install_github(repo="Zelig", user="IQSS", ref = "master")
>
>
> [2] To overwrite the functions, in your code, somewhere after library("Zelig") or require("Zelig"), the following two functions into your code (or put the two functions into another file, and source that file into your code):
>
> plot.simulations from the bottom of: https://github.com/IQSS/Zelig/blob/master/R/plots.R
> simulations.plot form : https://github.com/IQSS/Zelig/blob/master/R/simulations.plot.R
>
> then put the following lines into your code to replace the functions in the Zelig package namespace:
>
> assignInNamespace("simulations.plot", simulations.plot, ns="Zelig")
> assignInNamespace("plot.simulations", plot.simulations, ns="Zelig")
>
> Let me know you have any other questions, and thanks again, James.
>
> --
> James Honaker, Senior Research Scientist
> //// Institute for Quantitative Social Science, Harvard University
>
>
>
> ________________________________________
> From: zelig-bounces(a)lists.gking.harvard.edu [zelig-bounces(a)lists.gking.harvard.edu] On Behalf Of Zoltan [zoltan.fazekas(a)gmail.com]
> Sent: Saturday, February 16, 2013 8:47 AM
> To: zelig(a)lists.gking.harvard.edu
> Subject: [zelig] possible anomaly in plot for expected values (logit, probit)
>
> Hi there,
>
> I might doing something incorrect here, so please bear with me, but it seems to me that there is a problem when doing a summary plot after the simulation for logit model. To me, the plots for expected (Y|X1) seems incorrect, though when I pull the number out of qi, everything looks alright.
>
> My session info:
>
> R version 2.15.2 (2012-10-26)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
> other attached packages:
> [1] Zelig_4.1-2 sandwich_2.2-9 zoo_1.7-9 MASS_7.3-22 boot_1.3-7
> loaded via a namespace (and not attached):
> [1] grid_2.15.2 lattice_0.20-10
>
> Reproducible example:
>
> require(Zelig)
> REP <- read.csv("http://zfazekas.github.com/docs/rep.csv", sep = ",")
> REP <- na.omit(REP)
> pid.zelig <- zelig(close_dummy ~ educ + polinfo + age,
> data = REP, model = "logit",
> cite = F)
> summary(pid.zelig)
> x.low <- setx(pid.zelig, polinfo = 0)
> x.high <- setx(pid.zelig, polinfo = 1)
> s.pid.zelig <- sim(pid.zelig, x = x.low, x1 = x.high) ## Again, we are focusing on first differences
> summary(s.pid.zelig)
> plot(s.pid.zelig)
> par(mfrow = c(1,1))
> hist(as.numeric(s.pid.zelig$qi[[2]]))
>
>
> ----------------------
> Zoltan Fazekas
Hi Deepa,
I'm not sure if your message is an accidental duplicate of your earlier message, or an intentional resubmission of the original question. In either event, it gives me a chance to briefly chime in.
As Kosuke mentioned on your first message, Average Treatment Effect (ATE) is functionality that was present in Zelig 3.5, and has not yet been included in Zelig 4. (It is possible to revert to Zelig 3.5 - send me questions or see earlier list questions on how to do this).
You can see that adding ATE is an issue in the developer Zelig list on Github, and is scheduled to be included within the next three weeks. Take a look at:
https://github.com/IQSS/Zelig/issues/48
Best,
James.
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
________________________________________
From: zelig-bounces(a)lists.gking.harvard.edu [zelig-bounces(a)lists.gking.harvard.edu] On Behalf Of Deepa Pradhan [pradhan.deepa(a)gmail.com]
Sent: Wednesday, February 20, 2013 6:28 PM
To: zelig(a)lists.gking.harvard.edu
Subject: [zelig] Help with Zelig: Average Treatment Effect on Treated Estimation
Hi,
I am trying to estimate average treatment effect on treated using the
steps in Ho, Imai, Kin and Stuart, 2011 paper. But I am getting
warning message that cond is not supported by this version of zelig. I
also tried the earlier version of zelig, but unfortunatley it also
gives same warning. However, I can still get some results despite of
the warning message when I continue with the following step given in
the paper. So does the warning sign cause significant effect on the
result?
> x.out1<-setx(z.out1,data=match.data(m.out,"treat"),cond=TRUE)
Warning message:
In setx.default(z.out1, data = match.data(m.out, "treat"), cond = TRUE) :
"cond" is not currently supported by this version of Zelig
Any help will be much appreciated.
Thanks a lot.
Deepa Pradhan
PhD Candidate
Macquarie University
NSW, Australia
-
--
Zelig Mailing List, served by HUIT
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/mailman/listinfo/zelig
Zelig program information: http://gking.harvard.edu/zelig/
Zelig mailing list
Zelig(a)lists.gking.harvard.edu
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/zelig
Hello,
Can I supply a user defined variance-covariance matrix to sim()?
Suppose reg is some model zelig can run, such as
reg <- zelig(y~a+b,data=d,model="ls")
Then suppose I compute clustered standard errors using a user defined function cl(), which returns both the clustered standard errors and an alternate variance-covariance matrix, which we can call, respectively
cl.se
cl.vc
Now, I would like to compute quantities of interest as usual, but I would like sim() to use cl.vc instead of vcov(reg).
Can this be done?
Thanks!
cz
Hi,
I am trying to estimate average treatment effect on treated using the
steps in Ho, Imai, Kin and Stuart, 2011 paper. But I am getting
warning message that cond is not supported by this version of zelig. I
also tried the earlier version of zelig, but unfortunatley it also
gives same warning. However, I can still get some results despite of
the warning message when I continue with the following step given in
the paper. So does the warning sign cause significant effect on the
result?
> x.out1<-setx(z.out1,data=match.data(m.out,"treat"),cond=TRUE)
Warning message:
In setx.default(z.out1, data = match.data(m.out, "treat"), cond = TRUE) :
"cond" is not currently supported by this version of Zelig
Any help will be much appreciated.
Thanks a lot.
Deepa Pradhan
PhD Candidate
Macquarie University
NSW, Australia
Hi there,
I might doing something incorrect here, so please bear with me, but it
seems to me that there is a problem when doing a summary plot after the
simulation for logit model. To me, the plots for expected (Y|X1) seems
incorrect, though when I pull the number out of qi, everything looks
alright.
My session info:
R version 2.15.2 (2012-10-26)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
> other attached packages:
> [1] Zelig_4.1-2 sandwich_2.2-9 zoo_1.7-9 MASS_7.3-22 boot_1.3-7
>
> loaded via a namespace (and not attached):
> [1] grid_2.15.2 lattice_0.20-10
Reproducible example:
require(Zelig)
> REP <- read.csv("http://zfazekas.github.com/docs/rep.csv", sep = ",")
> REP <- na.omit(REP)
> pid.zelig <- zelig(close_dummy ~ educ + polinfo + age,
> data = REP, model = "logit",
> cite = F)
> summary(pid.zelig)
> x.low <- setx(pid.zelig, polinfo = 0)
> x.high <- setx(pid.zelig, polinfo = 1)
> s.pid.zelig <- sim(pid.zelig, x = x.low, x1 = x.high) ## Again, we are
> focusing on first differences
> summary(s.pid.zelig)
> plot(s.pid.zelig)
> par(mfrow = c(1,1))
> hist(as.numeric(s.pid.zelig$qi[[2]]))
----------------------
Zoltan Fazekas
Dear all,
I am learning the MatchIt paper by Ho et al. in Journal of Statistical
Software (Vol. 42, No.8, 2011).
However, when I went through all the codes in this paper I met two problems
that troubled me for two days .
As a result, I need your help. Thank you very much!
In fact, all the problems once took place. Before this email, I have
checked almost all the relevant solutions (like updating the software) in
this emaillist, however it still doesn't work.
In respect to the software, I am using the most updated software, including
ZELIG (Versions 4.1-0, built: 2012-11-09) and
MatchIt (Version 2.4-20, built: 2011-10-24) and R (version 2.15.2).
Therefore, I don't think it is a problem from software.
1. In the part of estimating "Average Treatment effect on the treated", I
copy the following code into R.
x.out1 <- setx(z.out1, data = match.data(m.out1, "treat"), cond = TRUE)
However it will give a warning message as follows. Does it matter? What
order does the new Zelig support?
Warning message:
In setx.default(z.out1, data = match.data(m.out1, "treat"), cond = TRUE) :
"cond" is not currently supported by this version of Zelig
2. When I try to estimate the Average Treatment Effect (overall), I copy
the following code.
ate.all <- c(s.out1$qi$att.ev, -s.out2$qi$att.ev)
It will indicates that "Error in -s.out2$qi$att.ev : invalid argument to
unary operator", which finally make me failing to continue.
I totally copy the codes in the article. Then what happened?
Would you like to tell me how to get rid of the failure?
Thank you very much!
Best wishes,
Mao
--
Mao Weizhun
Department of Politics and Management
Chair of International Politics
University of Konstanz
Room D 246
P.O. Box D 86
D-78457 Konstanz
Germany
Phone(O):+49-7531-88-4421
Email: Weizhun.Mao(a)uni-konstanz.de
Web:http://www.polver.uni-konstanz.de/gschneider/mitarbeiter/mao-weizhun/