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 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/
Hello,
I recently updated Zelig to 4.1-2, and ran some old code, which had worked
under Zelig 3, producing an error. setx() does not produce an object with the
correct names or attributes when one of the variables in the model is set equal
to a vector of different values. Instead, names(x.out) produces a character
vector, the elements of which are the values to which the variables have been
set. This leads to sim() producing similarly odd output (including no first
differences).
Reproducible code:
library(Zelig)
obs <- 1000
dat <- data.frame(cbind(rnorm(obs), runif(obs)))
names(dat) <- c("myX1", "myX2")
dat$myY <- dat$myX1 + 2*dat$myX2 - dat$myX1*dat$myX2 + rnorm(obs)
m1 <- zelig(myY ~ myX1 + myX2 + myX1:myX2, data = dat, model = "ls")
x.out <- setx(m1, myX1 = 2:3, myX2 = .4)
x.out2 <- setx(m1, myX1 = 2:3, myX2 = .6)
s.out <- sim(m1, x = x.out, x1 = x.out2)
s.out$qi$fd
I am running ZELIG (Versions 4.1-2, built: 2013-01-11)
The problem does not appear if myX1 is set to a single value, rather than a
vector.
Best,
Michael
Hi -
Zelig 4.1-2 has been released and is downloadable from CRAN. Note that it may not be immediately available across all CRAN mirrors, as it takes approximately a day to spread.
To download and install directly from CRAN, enter the following in an R-console:
install.packages("Zelig")
Alternatively, to download the nightly build from GitHub:
install.packages("Zelig", type="source", repos="http://iqss.github.com/")
This patch fixes:
1. Integration with AmeliaII, http://gking.harvard.edu/amelia, and
2. Implementation issues using the "by" parameter with Zelig
For general information on the Zelig project, visit our project page @ IQSS:
http://projects.iq.harvard.edu/zelig/
Or for source code and issue tracking, visit our GitHub page:
https://github.com/iqss/Zelig
Thanks!
Matt
Hello,
In the newest version of Zelig (4.1.2) the plot.ci command seems to be
broken.
Using the example located on the help page for plot.ci I get the below
errors (I've put them in bold).
I get the same results if I use "plot" in place of "plot.ci"
Thanks,
Shane
> data(turnout)
> z.out <- zelig(vote ~ race + educate + age + I(age^2) + income,
+ model = "logit", data = turnout)
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Olivia Lau. 2013.
"logit: Logistic Regression for Dichotomous Dependent Variables"
in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software,"
http://gking.harvard.edu/zelig
> age.range <- 18:95
> x.low <- setx(z.out, educate = 12, age = age.range)
> x.high <- setx(z.out, educate = 16, age = age.range)
> s.out <- sim(z.out, x = x.low, x1 = x.high)
> plot.ci(s.out, xlab = "Age in Years",
+ ylab = "Predicted Probability of Voting",
+ main = "Effect of Education and Age on Voting Behavior")
*NULL*
> legend(45, 0.52, legend = c("College Education (16 years)",
+ "High School Education (12 years)"), col = c("blue","red"),
+ lty = c("solid"))
*Error in strwidth(legend, units = "user", cex = cex, font = text.font) :*
* plot.new has not been called yet*
--
Shane Gleason
Doctoral Candidate
Southern Illinois University:Carbondale
Department of Political Science
Faner 3172
Dear Zelig Users,
Has anyone encountered this error in Zelig after performing a
subclassification of the propensity score using the MatchIt package? The
error is presented below using example data and code from the MatchIt
website (http://r.iq.harvard.edu/docs/matchit/2.4-20/Examples2.html) under
the Subclassification heading
I'm very interested to know if anyone has encountered, or better yet, found
a solution to this problem.
Thanks,
Joe
> m.out2 <- matchit(treat ~ age + educ + black + hispan + nodegree +
+ married + re74 + re75, data = lalonde,
+ method = "subclass", subclass = 4)
> z.out3 <- zelig(re78 ~ re74 + re75 + distance,
+ data = match.data(m.out2, "control"),
+ model = "ls", by = "subclass")
The following object(s) are masked from 'env (position 7)':
..., data, formula, weights
The following object(s) are masked from 'env (position 8)':
..., data, formula, weights
The following object(s) are masked from 'env (position 3)':
weights
The following object(s) are masked from 'env (position 8)':
weights
The following object(s) are masked from 'env (position 9)':
weights
Error in `[[<-`(`*tmp*`, label, value = list(result = list(coefficients =
c(4342.81293440479, :
no such index at level 1
>
Hi - Zelig 4.1-2 (Development Version) is available for download on GitHub and Zelig's Project Page.
To download and install directly, enter the following in an R-console:
install.packages("Zelig", type="source", repos="http://iqss.github.com/")
To download the package directly, visit:
http://projects.iq.harvard.edu/zelig/software/zelig
This release fixes two major issues:
1. Integration with AmeliaII, http://gking.harvard.edu/amelia, and
2. Compatibility issues using the "by" parameter with Zelig
For general information on the Zelig project, visit our project page @ IQSS:
http://projects.iq.harvard.edu/zelig/
Or for source code and issue tracking, visit our GitHub page:
https://github.com/iqss/Zelig
Thanks!
Matt
Hello,
I have run my probit model in Zelig after using AmeliaII to impute the data sets. When I use the "summary(z.out)" command, I receive the coefficients for 50 separate data analyses, but no combined output for all data sets together. Am I doing anything wrong?
Here is the code:
>z.out <- zelig(democ ~ loglrgdpch + loglodac + lurban + logpop + lprimsch + llife +
lfuelx + alesinae + alesinar + ldemoc + loglrgdpchldemoc +
loglodacldemoc + lurbanldemoc + logpopldemoc + lprimschldemoc +
llifeldemoc + lfuelxldemoc + alesinaeldemoc + alesinarldemoc,
model="probit",
data = mi(outdata1, outdata2,
outdata3, outdata4, outdata5, outdata6, outdata7, outdata8, outdata9, outdata10,
outdata11, outdata12, outdata13, outdata14, outdata15, outdata16, outdata17, outdata18,
outdata19, outdata20, outdata21, outdata22, outdata23, outdata24, outdata25, outdata26,
outdata27, outdata28, outdata29, outdata30, outdata31, outdata32, outdata33, outdata34,
outdata35, outdata36, outdata37, outdata38, outdata39, outdata40, outdata41, outdata42,
outdata43, outdata44, outdata45, outdata46, outdata47, outdata48, outdata49, outdata50))
>summary(z.out)
Any help would be greatly appreciated.
All best
Florian