Dear listers, I am running some OLS on multiply imputed data using Amelia. I first imputed the data with Amelia. than I run a OLS using Zelig to obtain a table of results accounting for the multiply imputed data-sets. And I'd like to do this for various models. Finally, I want to output all the models in a table of results for latex. I've tried with Stargazer because it seems to support Zelig output, but when I run stargazer on a set of objects containing the output of zelig, I get the following error: Error: unrecognized object type. this message is repeated for each model I passed to Stargazer. I am sorry I can't provide a working example, because I should make up some multiply imputed data first. Hoewever, summarizing what I did is: imputed1 <- amelia(x=data1, m=10) imputed2 <- amelia(x=data2, m=10) lm.imputed1 <- zelig(Y ~ X + Z, data = imputed1) lm.imputed2 <- zelig(Y ~ X + Z, data = imputed2) stargazer(lm.imputed1, lm.imputed2) The outcome is the error I mentioned above. Thanks in advance for all the support you can offer. Regards, f. [[alternative HTML version deleted]]
Does this do what you want?
library(Amelia)
library(Zelig)
library(stargazer)
library(xtable)
data(africa)
m = 10
imp1 <- amelia(x = africa,cs="country",m=m)
imp2 <- amelia(x = africa,cs="country",m=m)
lm.imputed1 <- zelig(infl ~ trade + civlib, model="ls",data = imp1)
lm.imputed2 <- zelig(infl ~ trade + civlib, model="ls",data = imp2)
# Stargazer
for(i in 1:m){
print(stargazer(as.data.frame(summary(lm.imputed1[[i]])$coef),as.data.frame(summary(lm.imputed2[[i]])$coef)))
}
# xtable
for(i in 1:m){
print(xtable(summary(lm.imputed1[[i]])))
print(xtable(summary(lm.imputed2[[i]])))
}
On Sat, Aug 17, 2013 at 6:37 AM, Francesco Sarracino
<f.sarracino@gmail.com>wrote:
> Dear listers,
>
> I am running some OLS on multiply imputed data using Amelia.
> I first imputed the data with Amelia.
> than I run a OLS using Zelig to obtain a table of results accounting for
> the multiply imputed data-sets. And I'd like to do this for various
models.
> Finally, I want to output all the models in a table of results for latex.
>
> I've tried with Stargazer because it seems to support Zelig output,
but
> when I run stargazer on a set of objects containing the output of zelig, I
> get the following error: Error: unrecognized object type.
>
> this message is repeated for each model I passed to Stargazer.
>
> I am sorry I can't provide a working example, because I should make up
some
> multiply imputed data first. Hoewever, summarizing what I did is:
>
> imputed1 <- amelia(x=data1, m=10)
> imputed2 <- amelia(x=data2, m=10)
> lm.imputed1 <- zelig(Y ~ X + Z, data = imputed1)
> lm.imputed2 <- zelig(Y ~ X + Z, data = imputed2)
> stargazer(lm.imputed1, lm.imputed2)
> The outcome is the error I mentioned above.
> Thanks in advance for all the support you can offer.
> Regards,
> f.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
Hi Christopher, thanks for your reply. Unfortunately, that's not what I am looking for. I would like to have a table with the results of the two models (lm.imputed1 and lm.imputed2) in two separate columns. According to stargazer syntax I should type something like: stargazer(lm.imputed1, lm.imputed2, summary = FALSE) but then I get my error: Error: Unrecognized object type. Even though your example is insightful, I can't figure out how to solve my problem. Any advice is very welcome. Regards, f. On 17 August 2013 17:02, Christopher Desjardins <cddesjardins@gmail.com>wrote:> Does this do what you want? > > library(Amelia) > library(Zelig) > library(stargazer) > library(xtable) > > data(africa) > > m = 10 > imp1 <- amelia(x = africa,cs="country",m=m) > imp2 <- amelia(x = africa,cs="country",m=m) > lm.imputed1 <- zelig(infl ~ trade + civlib, model="ls",data = imp1) > lm.imputed2 <- zelig(infl ~ trade + civlib, model="ls",data = imp2) > > # Stargazer > for(i in 1:m){ > > print(stargazer(as.data.frame(summary(lm.imputed1[[i]])$coef),as.data.frame(summary(lm.imputed2[[i]])$coef))) > } > > # xtable > for(i in 1:m){ > print(xtable(summary(lm.imputed1[[i]]))) > print(xtable(summary(lm.imputed2[[i]]))) > } > > > On Sat, Aug 17, 2013 at 6:37 AM, Francesco Sarracino < > f.sarracino@gmail.com> wrote: > >> Dear listers, >> >> I am running some OLS on multiply imputed data using Amelia. >> I first imputed the data with Amelia. >> than I run a OLS using Zelig to obtain a table of results accounting for >> the multiply imputed data-sets. And I'd like to do this for various >> models. >> Finally, I want to output all the models in a table of results for latex. >> >> I've tried with Stargazer because it seems to support Zelig output, but >> when I run stargazer on a set of objects containing the output of zelig, I >> get the following error: Error: unrecognized object type. >> >> this message is repeated for each model I passed to Stargazer. >> >> I am sorry I can't provide a working example, because I should make up >> some >> multiply imputed data first. Hoewever, summarizing what I did is: >> >> imputed1 <- amelia(x=data1, m=10) >> imputed2 <- amelia(x=data2, m=10) >> lm.imputed1 <- zelig(Y ~ X + Z, data = imputed1) >> lm.imputed2 <- zelig(Y ~ X + Z, data = imputed2) >> stargazer(lm.imputed1, lm.imputed2) >> The outcome is the error I mentioned above. >> Thanks in advance for all the support you can offer. >> Regards, >> f. >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > >-- Francesco Sarracino, Ph.D. https://sites.google.com/site/fsarracino/ [[alternative HTML version deleted]]