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/
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,
After running my Zelig relogit model and simulating values from the posterior, I am interested in getting predicted probabilities, first differences, and risk ratios. From my simulation results, I am only able to get expected values and predicted probabilities of my covariates. Am I not able to get risk ratios and first differences from the relogit model? Also, for the plot command, am I not able to get plots of individual posterior densities for each covariate? The plot function gives me just one graph for the Expected Values: E(Y|X). See code below:
MH6 <- zelig(onset ~ L_PC_PRODUCTION + L_PC_RESERVES + L_PC_DIAMONDS
+ L_wdiagdp, data = mhd, model = "relogit", tau = 88/5269,
case.control = "weighting", robust = TRUE)
summary(MH6)
# Setting explanatory variables to mean
x.MH6 <- setx(MH6)
# Simulating data
s.MH6 <- sim(MH6, x = x.MH6, num = 100000)
summary(s.MH6)
plot(s.MH6)
Thank you,
Alero
Glad to help
On Dec 5, 2011, at 10:11 AM, <alero(a)utdallas.edu> wrote:
> Many many many thanks for your prompt response and help. It worked! J
>
> From: Matt Owen [mailto:mowen@iq.harvard.edu]
> Sent: Monday, December 05, 2011 9:08 AM
> To: Akporiaye, Alero
> Cc: zelig(a)lists.gking.harvard.edu
> Subject: Re: [zelig] Help with error using Zelig in R
>
> Try:
>
> MH1 <- zelig(
> onset ~ L_PC_PRODUCTION,
> data = mhd,
> model = "relogit",
> tau = 88/5269,
> case.control = "weighting",
> robust = TRUE
> )
>
> I believe the issue is that the variables should not be prefixed with "mhd$".
>
> - Matt
>
>
> On Dec 5, 2011, at 9:55 AM, <alero(a)utdallas.edu> <alero(a)utdallas.edu> wrote:
>
>
> MH1 <- zelig(mhd$onset ~ mhd$L_PC_PRODUCTION, data = mhd, model = "relogit",
> + tau = 88/5269, case.control = "weighting", robust = TRUE)
>
Good morning,
I am using Zelig to run an relogit model in R (version 2.13.1), but I am running into an error for which I have not found a solution in your archives. Please find below the R syntax
> library(Zelig)
> library(foreign)
> mhd <- read.dta("E:/7390/Paper/Data/MH8JCR05.dta")
# When I run glm and MCMClogit models, I am able to estimate my models, so I know R is reading the data:
> MHR <- glm(mhd$onset ~ mhd$L_PC_PRODUCTION, family=binomial(link="logit"))
> summary(MHR)
Call:
glm(formula = mhd$onset ~ mhd$L_PC_PRODUCTION, family = binomial(link = "logit"))
Deviance Residuals:
Min 1Q Median 3Q Max
-0.1864 -0.1862 -0.1862 -0.1848 3.0293
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -4.0458 0.1123 -36.016 <2e-16 ***
mhd$L_PC_PRODUCTION -3.3181 2.5385 -1.307 0.191
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 869.16 on 5236 degrees of freedom
Residual deviance: 864.88 on 5235 degrees of freedom
(32 observations deleted due to missingness)
AIC: 868.88
Number of Fisher Scoring iterations: 9
> FIprior <- function(beta, location, scale){
+ sum(dcauchy(beta, location, scale, log=TRUE))
+ }
> MH1 <- MCMClogit(mhd$onset ~ mhd$L_PC_PRODUCTION, data = mhd, burnin = 500,
+ mcmc = 1000,user.prior.density = FIprior, logfun = TRUE,
+ seed = 1234, location = 0, scale = 2.5)
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The Metropolis acceptance rate was 0.41133
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>
> summary(MH1)
Iterations = 501:1500
Thinning interval = 1
Number of chains = 1
Sample size per chain = 1000
1. Empirical mean and standard deviation for each variable,
plus standard error of the mean:
Mean SD Naive SE Time-series SE
(Intercept) -4.026 0.1116 0.003528 0.01203
mhd$L_PC_PRODUCTION -2.993 2.1950 0.069413 0.24653
2. Quantiles for each variable:
2.5% 25% 50% 75% 97.5%
(Intercept) -4.236 -4.100 -4.020 -3.943 -3.8330
mhd$L_PC_PRODUCTION -8.746 -3.903 -2.334 -1.469 -0.2813
However, when I run the Zelig relogit model, I get the error below -
> MH1 <- zelig(mhd$onset ~ mhd$L_PC_PRODUCTION, data = mhd, model = "relogit",
+ tau = 88/5269, case.control = "weighting", robust = TRUE)
Error in `[.data.frame`(d, , all.vars(as.expression(formula))) :
undefined columns selected
Could you please help with resolving this error?
Thank you,
Alero
Hi everybody,
I'm having problems with the logit.mixed model, or mixed models in general. I
want to estimate fixed effects parameters for the random effect. The vignette
says that you can do this by specifying gamma with tag(z1, gamma | g), but I get
".deparseTag(TT.vars[[vind]]) : wrong use of tag function!".
Questions: Am I missing something? Is this working as intended, or at all?
Thank you in advance.
Steffen
Here's the full code:
m3a <- zelig(formula= list(mu=abstention ~ age + [...] +dEUdir +
tag(1, gamma | ccode), gamma=~tag(years |ccode)), model="logit.mixed",
data=data04)
Others are having the same problem...
http://article.gmane.org/gmane.comp.lang.r.zelig/728
-
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 trying to run a multilevel probit model using Zelig, but keep receiving
the following error message: " in .deparseTag(TT.vars[[vind]]) : wrong use
of tag function!!"
A simplified version of the model I am trying to run is:
z.out <- zelig(formula= list(mu=investment.binary ~ edlevel +
tag(1 + edlevel, gamma | country),
gamma = ~ tag(GDPpc06.full| country)), data=data2006.mod1,
model="probit.mixed")
What I would like to do is allow the intercept and the edlevel variable
listed within the first tag() to vary by country as a function of the
GDPpc06.full variable, all of which are included in the same dataframe. I
followed the syntax here - http://cran.r-project.org/web/packages/Zelig
/vignettes/probit.mixed.pdf - but I think that I am incorrectly specifying
the gamma part of the syntax, which may be causing the error.
I *am* able to get the model to run when I allow the intercept and edlevel
variable to vary using the following syntax:
z.out <- zelig(investment.binary ~ edlevel +
+ tag(1 + edlevel | country),
data=data2006.mod1, model="probit.mixed")
However, this syntax does not allow me to specify that the intercept and
edlevel variable should vary as a function of GDPpc06.full, as in the first
model specified above. I have tried including multiple tags at the
non-group level of the model specification - i.e. one for the intercept and
one for the edlevel variable - but this does not seem to work either.
Do you have any suggestions for how to fix the syntax?
Sincerely,
Jason
--
Jason I. McMann
PhD Student | Department of Politics
Princeton University | jmcmann(a)princeton.edu