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/
*Please, let me know how can I install ZeligMultinomial package. I want to
use mlogit, which according to the manual (page 50), is found in said
package.
I tried with the command,
install.packages("ZeligMultinomial", repos="http://r.iq.harvard.edu/",
type="source")
But received the following message:
Warning: dependency 'MNP' is not available
trying URL '
http://r.iq.harvard.edu/src/contrib/ZeligMultinomial_0.5-4.tar.gz'
Content type 'application/x-gzip' length 9730 bytes
opened URL
==================================================
downloaded 9730 bytes
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_PAPER failed, using "C"
ERROR: dependency 'MNP' is not available for package 'ZeligMultinomial'
* removing
'/Library/Frameworks/R.framework/Versions/2.14/Resources/library/ZeligMultinomial'
The downloaded packages are in
'/private/var/folders/UL/ULLu+bi5GR8IM1G-7XZBJU+++TI/-Tmp-/Rtmp6jw6M9/downloaded_packages'
Warning message:
In install.packages("ZeligMultinomial", repos = "http://r.iq.harvard.edu/",
:
installation of package 'ZeligMultinomial' had non-zero exit status
***
Good morning
If I run
<<<
susan.lsmixed.out <- zelig(formula = unprot_vag_sex ~ married + age + TREATMENT.ARM*time + highest_grade + income + tag(1|id),
data = susanMI.out$imputations, model = "ls.mixed")
summary(susan.lsmixed.out)
>>>>
I get an error
Error in x$coef : $ operator is invalid for atomic vectors
Searching the archives, I see that others have had similar problems. Is there a workaround?
summary(susan.lsmixed.out[[1]])
works fine; should I then average across the five imputed data sets?
thanks!
Peter
Peter L. Flom, PhD
Statistical Consultant
Website: http://www DOT statisticalanalysisconsulting DOT com/
Writing; http://www.associatedcontent.com/user/582880/peter_flom.html
Twitter: @peterflom
-
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/
Hello,
I am having problems with the "ls.mixed" model in zelig() and the weights argument. This is similar to the problem documented here: https://lists.gking.harvard.edu/pipermail/zelig/2011-July/000183.html. However, while it seems like the issue in that thread was missing values on the dependent variable, I am having the issue with no missing data. I can estimate the model with weights using lmer(), but not using zelig(). I have an example that reproduces this error using fake data posted here: http://pastebin.com/29KbmRZD and listed below.
##
library(Zelig)
set.seed(1000)
x <- runif(1000, -1, 1)
y <- x + rnorm(1000)
wt <- rexp(1000)
id <- rep(1:20, times = 50)
d <- as.data.frame(cbind(y, x, wt, id))
m1 <- zelig(y ~ x + tag(1|id), model = "ls.mixed", weights = "wt", data = d)
m2 <- lmer(y ~ x + (1|id), weights = wt, data = d)
##
Thanks for any insight with this problem.
Jeff Harden
---
Jeffrey J. Harden
Ph.D Candidate, Department of Political Science
Program Coordinator, American Politics Research Group (APRG)
University of North Carolina at Chapel Hill
jjharden(a)unc.edu<mailto:jjharden@unc.edu>
http://jjharden.web.unc.edu/
Hey all,
I developed a problem today, and couldn't seem to solve it (I say today
because I use Zelig regularly, including yesterday, and this wasn't an
issue). But I've found it and am now able to replicate it, so thought I
should share it and see if others have this problem.
If I have the arm package loaded with Zelig and try to execute a command
like the folllowing:
> s.out <- sim(z.out2, x=x.low, x1=x.high,num=10000)
I get the following error:
Error in .local(object, ...) :
unused argument(s) (x = list(`(Intercept)` = c(1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), Legal_Infra_lag1 =
c(2.58489978735531, 2.58489978735531, 2.58489978735531, 2.58489978735531,
2.58489978735531, 2.58489978735531, 2.58489978735531, 2.58489978735531,
starting httpd help server ... done
This is not a function of my data: even the demos for the different model
types, e.g. demo("ls.mixed") fail to work properly. If I unload the
armpackage all is well. In the process I updated everything, so this
isn't a
function of not-current packages or R not working together.
Any comments or tests are well-appreciated!
Brad Epperly
PhD Candidate
Department of Political Science
University of Washington
Box 353530
Seattle, WA 98195
http://sites.google.com/a/uw.edu/epperly/
Hi!
I use Zelig's plot.ci() function quite a lot to generate plots like the
one shown in the Zelig tutorial on p. 53 ("Effect of Education and Age
on Voting Behavior"). (the one generated by "> demo(vertci)")
Is it possible to generate a plot of the estimated Zelig models that
looks more like ggplot2's "stat_smooth"?
http://had.co.nz/ggplot2/stat_smooth.html
What I'm looking for is something that looks like this:
http://had.co.nz/ggplot2/graphics/8953194646b79f7e28d5bebd58b18616.png
Cheers,
Chris
Hello all:
I have replicated this with the current (stable) and alpha releases of
Zelig. I cannot simulate quantities of interest using a mixed-effects
model estimated on data imputed with Ameila. setx() works fine, but
the sim command runs for a while and then reports it is unable to find
one of my predictor variables (variable names changed as they are
irrelevant). Code below:
model.full <- zelig(attitude ~ age + married + male + income + tag(1 |
state), model = "ls.mixed", data = imp$imputations, REML = FALSE,
subset = wave4)
x.out <- setx(model.full)
simout <- sim(x.out, x = x.out)
The model estimates fine with the zelig() function, setx() works fine
in setting the explanatory variables at their means, but when I
attempt to use sim(), I get:
Error in eval(expr, envir, enclos) : object 'age' not found
A traceback produces this:
13: eval(expr, envir, enclos)
12: eval(predvars, data, env)
11: model.frame.default(object, data, xlev = xlev)
10: model.frame(object, data, xlev = xlev)
9: model.matrix.default(parsefml$fixed, data = D)
8: model.matrix(parsefml$fixed, data = D)
7: model.matrix(parsefml$fixed, data = D)
6: is.data.frame(x)
5: colnames(model.matrix(parsefml$fixed, data = D))
4: qi.mer(object[[1]], simpar = simpar, x = as.matrix(x), x1 = if
(!is.null(x1)) as.matrix(x1))
3: qi(object[[1]], simpar = simpar, x = as.matrix(x), x1 = if
(!is.null(x1)) as.matrix(x1))
2: sim.setx.MI(model.full, x = x.out)
1: sim(model.full, x = x.out)
Any suggestions?
Thanks very much,
Trey Causey
The Zelig <http://gking.harvard.edu/zelig> core team is thrilled to
announce the alpha release of Zelig Version 4.
*Summary:* This release includes a complete rewrite of almost every line of
Zelig code. The changes are all infrastructural: If everything works as
planned, users won’t notice any changes today. But this release makes
maintaining and improving Zelig much easier and so users should see major
improvements going forward.
*Shout Out: *The Zelig community owes Matt Owen <mowen(a)iq.harvard.edu> huge
thanks for leading the development effort behind this new version; if a few
percent of the several hundred thousand Zelig users were to fill Matt's
mailbox with messages that said no more than "thanks", we wouldn't object!
*Details*: Designated as a "Developer Update", Zelig 4 offers a wide-range
of improvements to ease the process of adding new statistical models to the
already extensive Zelig statistical software suite. This release is
packaged with a brand-new API, which greatly reduces the complexity and
length of Zelig's development functions - the zelig2, param and qi methods.
Zelig also now includes a package-creator (zelig.skeleton) that operates
in the same vein as R's core function "package.skeleton".
In addition to changes in the development toolkit, Zelig has now been split
across 7 distinct packages. This change has been made to refine the scope
of Zelig and its add-ons. In particular, this restructuring of Zelig into a
full software suite allows developers to contribute, develop and repair
add-on packages without tinkering with the Zelig API and core
functionality. (On the theory that you shouldn’t have to pull out the
spark plugs when you’re filling the tank!)
While this release's prime focus has been improving the developer toolkit
and restructuring the software suite, Zelig 4 offers an end-user experience
completely identical to previous versions. That is, zelig's basic functions
- zelig, setx and sim - remain unchanged in functionality for available
statistical models.
*New Features*
A revised developer API. The primary developer methods - zelig2, param and
sim - have been reimplemented to use a sleeker, simpler API. For
information, please read the Zelig developer's manual found here:
http://zeligdev.github.com/files/booklet.pdf
The core package has been restructured and minimized. In particular, Zelig
core now contains only code essential to its operation, while all
non-essential tasks have been made into specific R-packages. For a complete
list of official Zelig packages, please refer to:
https://github.com/zeligdev
Development tools for contributors have been added to the core package. In
particular, the "zelig.skeleton" function is packaged within Zelig-core in
order to facilitate the rapid development of new Zelig packages.
The Zelig software suite now includes 7 separate R-packages. This change
offers a simple and easy method for ensuring that development and
bug-fixing within any particular Zelig add-on will leave the remainder of
the Zelig software suite unchanged.
A hook API has been integrated into the core package, in order to reduce
the necessity to directly alter the zelig, setx and sim methods.
Roxygen-compliant documentation is now standard in all Zelig packages. This
offers an easy way to manage Rd documentation, dependencies and exports
from within the R code itself. That is, documentation is more tightly
paired with the actual R code. For more information about Roxygen, please
refer to:
http://roxygen.org/
*GitHub*
Zelig is now on GitHub! Fork an add-on package or contribute bug-finds
today!
For a full listing of official packages and their repositories, please see:
https://github.com/zeligdev
*Links
*
The main Zelig site: http://gking.harvard.edu/zelig or j.mp/Zelig
The Zelig 4 development site:
* Website: http://zeligdev.github.com/
* Package Repositories: https://github.com/zeligdev/
* Installation Guide: http://zeligdev.github.com/files/zelig.pdf
* Zelig Manual: http://zeligdev.github.com/#install
* Available and Missing Add-on Packages: http://zeligdev.github.com/#models
*Questions
*
For *all* questions on Zelig, please send all mail to:
zelig(a)lists.gking.harvard.edu
Gary
--
*Gary King* - Albert J. Weatherhead III University Professor - Director,
IQSS - Harvard University
GKing.Harvard.edu <http://gking.harvard.edu/> - King(a)Harvard.edu -
@kinggary<http://twitter.com/kinggary> -
617-500-7570 - Asst 495-9271 - Fax 812-8581
I'm trying to find a way to
have country clusters in a relogit analysis.
I have country-year data
and the countries are grouped
by a numeric id variable "cid".
I've tried including a list
of options for robust such that my model is:
M1 <- zelig(violence ~ dem_age,
model = "relogit", tau = 88/5480,
data = data,
robust = list(
method =
"vcovHAC",
order.by = ~data$cid,
adjust = TRUE
))
However why I run "summary(M1)" I get an error:
Error in meatHAC
(x, order.by = order.by, prewhite = prewhite, weights = weights, :
subscript out of bounds
Any thoughts on what is going on?
ReLogit for zelig would be really useful if it could incorporate clusters.
Thanks
Christopher
Below are a few small typos in the current Zelig documentation, which I downloaded from here:
http://gking.harvard.edu/sites/scholar.iq.harvard.edu/files/zelig.pdf
*The ologit section has two exact (I think) copies:
11.44 and 11.52
*In the ologit section(s), the word "order" is repeated in
"If Y takes discrete integer values, the as.factor() command will order automatically order the values."
*There seems to be a latex/bibtex problem. Do a search for "author?".
Best,
Scott Kostyshak