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
***
Hi,
I recently updated to 4.0.-11 and was not able to run my scripts
anymore. I noticed that quantities of interest are no longer stored in
$qi$ev, but as a list at $qi. Simulating multiple covariate vectors [eg
setx(m1, var1=seq(1,100,1)] doesn't seem to work, $qi is empty.
I reverted back to 3.5.3 so no big deal and still have to take a closer
look at the documentation for 4.0... Is this a bug or a feature of Zelig
4.0?
Thanks
Steffen
Hi,
Running the latest CRAN releases of Zelig and Amelia I find that the
amelia() function does not work properly when Zelig is loaded.
Reproducible example and session info are below.
Best,
Ista
## Amelia works as long as Zelig is not loaded:
> library(Amelia)
Loading required package: foreign
##
## Amelia II: Multiple Imputation
## (Version 1.6.3, built: 2012-06-21)
## Copyright (C) 2005-2012 James Honaker, Gary King and Matthew Blackwell
## Refer to http://gking.harvard.edu/amelia/ for more information
##
> example(amelia)
amelia> data(africa)
amelia> a.out <- amelia(x = africa, cs = "country", ts = "year", logs
= "gdp_pc")
-- Imputation 1 --
1 2
-- Imputation 2 --
1 2 3
-- Imputation 3 --
1 2 3
-- Imputation 4 --
1 2 3
-- Imputation 5 --
1 2 3
amelia> summary(a.out)
Amelia output with 5 imputed datasets.
Return code: 1
Message: Normal EM convergence.
Chain Lengths:
--------------
Imputation 1: 2
Imputation 2: 3
Imputation 3: 3
Imputation 4: 3
Imputation 5: 3
Rows after Listwise Deletion: 115
Rows after Imputation: 120
Patterns of missingness in the data: 3
Fraction Missing for original variables:
-----------------------------------------
Fraction Missing
year 0.00000000
country 0.00000000
gdp_pc 0.01666667
infl 0.00000000
trade 0.04166667
civlib 0.00000000
population 0.00000000
amelia> plot(a.out)
Hit <Return> to see next plot:
## amelia() does not work if the Zelig package is loaded
> library(Zelig)
Loading required package: boot
Loading required package: MASS
Loading required package: sandwich
Loading required package: zoo
Attaching package: ‘zoo’
The following object(s) are masked from ‘package:base’:
as.Date, as.Date.numeric
Loading required package: survival
Loading required package: splines
Attaching package: ‘survival’
The following object(s) are masked from ‘package:boot’:
aml
ZELIG (Versions 4.0-11, built: 2012-08-31)
+----------------------------------------------------------------+
| Please refer to http://gking.harvard.edu/zelig for full |
| documentation or help.zelig() for help with commands and |
| models support by Zelig. |
| |
| Zelig project citations: |
| Kosuke Imai, Gary King, and Olivia Lau. (2009). |
| ``Zelig: Everyone's Statistical Software,'' |
| http://gking.harvard.edu/zelig |
| and |
| Kosuke Imai, Gary King, and Olivia Lau. (2008). |
| ``Toward A Common Framework for Statistical Analysis |
| and Development,'' Journal of Computational and |
| Graphical Statistics, Vol. 17, No. 4 (December) |
| pp. 892-913. |
| |
| To cite individual Zelig models, please use the citation |
| format printed with each model run and in the documentation. |
+----------------------------------------------------------------+
> example(amelia)
amelia> data(africa)
amelia> a.out <- amelia(x = africa, cs = "country", ts = "year", logs
= "gdp_pc")
-- Imputation 1 --
1 2
-- Imputation 2 --
1 2 3
-- Imputation 3 --
1 2
-- Imputation 4 --
1 2 3 4
-- Imputation 5 --
1 2
amelia> summary(a.out)
Amelia output with imputed datasets.
Return code: 1
Message: Normal EM convergence.
Chain Lengths:
--------------
Error in 1:m : argument of length 0
> sessionInfo()
R version 2.15.1 (2012-06-22)
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] splines stats graphics grDevices utils datasets
methods base
other attached packages:
[1] Zelig_4.0-11 survival_2.36-14 sandwich_2.2-9 zoo_1.7-8
MASS_7.3-22
[6] boot_1.3-7 Amelia_1.6.3 foreign_0.8-51
loaded via a namespace (and not attached):
[1] grid_2.15.1 lattice_0.20-10 tools_2.15.1
I have a data frame called t:
dput(t)
structure(list(Volume = c(2625941L, 4685483L, 3160694L, 2627816L,
2430273L, 2498011L), SLA = c(28L, 44L, 12L, 28L, 4L, 28L), Duration = c(21L,
25L, 15L, 13L, 15L, 20L)), .Names = c("Volume", "SLA", "Duration"
), row.names = 2:7, class = "data.frame")
I would like to create a linear model and also prection using zelig library. When I do this:
Ø z.out1 <- zelig(Duration ~ Volume, model = "ls", data = t)
I get this error. I also tried gamma, logit, the same error:
Error in `rownames<-`(`*tmp*`, value = c(1L, 0L)) :
attempt to set rownames on object with no dimensions
Any ideas what I am doing wrong?
===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
===============================================================================
Dear All,
I am estimating a binomial logistic regression using grouped data. I have a
large data and grouping it seems to speed the estimation greatly. Can Zelig
handle this? The equivalent R code is something like:
out <- glm(cbind(damage, 6-damage) ~ temp, family=binomial, data=orings)
Thanks.
Best,
Shige
Dear all,
I just updated Zelig and am running R 2.15.1 and have run into the following error with polt.ci:
Error: could not find function "plot.ci"
Is plot.ci no depreciated?
I have tried the following script from the web and recieve the same error:
> data(turnout)
> z.out <- zelig(vote ~ race + educate + age + I(age^2) + income,
+ model = "logit", data = turnout)
.
.
.
> summary(z.out)
Call:
glm(formula = formula, family = binomial(link = "logit"), data = data,
weights = w, model = F)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.7413 -0.8156 0.5564 0.7780 1.8218
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -4.3416816 0.4763159 -9.115 < 2e-16 ***
racewhite 0.2721490 0.1470441 1.851 0.064199 .
educate 0.1764168 0.0203024 8.689 < 2e-16 ***
age 0.0945198 0.0177067 5.338 9.39e-08 ***
I(age^2) -0.0006835 0.0001783 -3.833 0.000126 ***
income 0.1517485 0.0278442 5.450 5.04e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 2266.7 on 1999 degrees of freedom
Residual deviance: 2009.6 on 1994 degrees of freedom
AIC: 2021.6
Number of Fisher Scoring iterations: 5
> 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")
Error: could not find function "plot.ci"
------------------------------
Anthony A. Pezzola
Profesor Asistente
Jefe del Magíster en Ciencia Política
Instituto de Ciencia Política
Pontificia Universidad Católica de Chile
Santiago, Chile
(56) 2 354-7823
To be sure of hitting the target, shoot first and call whatever you hit the target.
Dear List Members,
I am running R 1.15.1 64 bit on Windows 7 64bit, and
'Zelig' version 4.0-11
'ZeligGEE' version 0.2
I wish to use Zelig to estimate mean effects from logistic regression models with confidence intervals, and differences between mean effects with confidence intervals. Both standard and GEE logistic regression models are operating in R packages base and geepack, respectively, but in Zelig are returning the below messages:
> z.out.1 <- zelig(cons1~rxgroup_id+herd_id, model = "logit", data = dat)
Error in data.frame(visible = rep.int(FALSE, n2), from = rep.int(msg, :
duplicate row.names: nobs.lm
> library("ZeligGEE")
Loading required package: gee
> z.out.1 <- zelig(cons1~rxgroup_id, model = "logit.gee", id = "herd_id", data = dat, corstr="exchangeable")
Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
running glm to get initial regression estimate
(Intercept) rxgroup_idGPG + P4 rxgroup_idGPG + P4 CoSynch
-0.08068891 -0.03956022 0.36057671
Error in data.frame(visible = rep.int(FALSE, n2), from = rep.int(msg, :
duplicate row.names: nobs.default
I have run similar models in the past on previous versions of Zelig.
Look as I might, I can't find a problem with the dataframe. There are no duplicate subject identifiers. I have tried using the subject identifier in the first column in ascending order also. Any help on this problem would be much appreciated.
Chris Compton BVSc MVS (Epi) (Hons)
Research Project Manager
Cognosco
Research division of Anexa Animal Health
PO Box 21 Morrinsville, New Zealand 3340
Ph +64 07 889 5159
Fax +64 07 889 3681
M +64 021 800 146