Following on Ista's comment, if you wanted to do
this in Zelig, the newest
version 5 on CRAN is now pretty seamless with Amelia output. In your
example for linear regression it would be:
library(Amelia)
library(Zelig)
DataImputed <- amelia(x=GroupData,incheck=TRUE)
Zelig.out <- zelig(DepVar ~ IndVar1 + IndVar2 + IndVar3 + IndVar4 +
IndVar5, model="ls", data=DataImputed)
summary(Zelig.out)
Notice, you just pass Amelia output to the data argument in Zelig, as if
it was a dataset (it is really just a very complicated dataset object, with
lots of other useful things in there). Zelig recognizes it's an imputed
dataset, runs the model on each, and then combines the results. You can
see some further details on the
Zelig is under very active development, and if you see any problems, or
have suggestions, or things aren't obvious, do please let me know. In fact
there are changes in the Beta version of Zelig (version 5.0-8) for
summarizing and plotting with imputed datasets, that aren't yet on CRAN
(version 5.0-7), so I might suggest you give the Beta a shot. You can
install from our repository as:
install.packages("Zelig", type="source",
)
Best,
James
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
------------------------------
*From:* amelia-bounces(a)lists.gking.harvard.edu
<javascript:_e(%7B%7D,'cvml','amelia-bounces@lists.gking.harvard.edu');>
[
amelia-bounces(a)lists.gking.harvard.edu
<javascript:_e(%7B%7D,'cvml','amelia-bounces@lists.gking.harvard.edu');>]
on behalf of Ista Zahn [istazahn(a)gmail.com
<javascript:_e(%7B%7D,'cvml','istazahn@gmail.com');>]
*Sent:* Saturday, November 14, 2015 5:14 PM
*To:* W. D.
*Cc:* amelia(a)lists.gking.harvard.edu
<javascript:_e(%7B%7D,'cvml','amelia@lists.gking.harvard.edu');>
*Subject:* Re: [amelia] Example for ameliabind?
It doesn't make sense statistically to fit models to the combined data
like that. Instead you should fit your model separately to each imputed
dataset and then aggregate the estimates and standard errors across the
model fits. There are R packages that will do this for you, see e.g., Zelig
and mitools packages and section 4.10 in the Amelia package vignette.
Best,
Ista
On Nov 14, 2015 3:29 PM, "W. D." <WD(a)a7h.com
<javascript:_e(%7B%7D,'cvml','WD@a7h.com');>> wrote:
At 22:40 11/12/2015, W. D. wrote:
At 21:30 11/12/2015, Matt Blackwell wrote:
Hi there,Â
I actually don't think you actually need to use ameliabind() here.
The amelia
output already has all of the datasets together. It might
help us to know what is it that you want to accomplish with
ameliabind() in this case.
Cheers,
Matt
Thanks, Matt.
I'm just trying to do a plain old linear regression.
I had to export the data to 5 text files and
combine them manually, deleting the extra header
records. I then imported the combined,
imputed data and ran a regression:
lm.ImputedDataAll5 <- lm(DepVar ~ IndVar1 + IndVar2 +
IndVar3 + IndVar4 + IndVar5, data=ImputedDataAll5)
Is there some way to skip the manual editing steps
and use the imputed data structure with lm?
Thanks for any light you can shed.
I tried going the ameliabind() route because when
trying to use lm() with the 5 sets of imputed data,
I get the following error:
Error in as.data.frame.default(data) :
cannot coerce class ""amelia"" to a data.frame
Would you please let me know the proper way to regress
these 5 datasets?
Thanks!
>On Thu, Nov 12, 2015 at 10:11 PM, W. D. <<mailto:WD@a7h.com
<javascript:_e(%7B%7D,'cvml','WD@a7h.com');>>WD@a7h.com
<javascript:_e(%7B%7D,'cvml','WD@a7h.com');>> wrote:
At 06:47
11/11/2015, Matt Blackwell wrote:
>Hi there,Â
>
>The 5 imputed datasets are actually contained in the DataImputed
object and you
can access each imputed dataset like so:
>
>DataImputed$imputations[[1]]
>DataImputed$imputations[[2]]
>
>And so on. ameliabind() will merge the output of two amelia() calls
into 1 so
that if each had 5 imputed datasets, then the binded object
will have 10.Â
Thanks for the clue, Matt.
However when I run:
DataImputedAll <- ameliabind(DataImputed$imputations[[1]],
DataImputed$imputations[[2]], DataImputed$imputations[[3]],
DataImputed$imputations[[4]], DataImputed$imputations[[5]])
It rudely spits out:
"All arguments must be amelia output."
When searching for that particular error, there isn't anything
useful.
What do you suggest?
Thanks for your assistance!
>Hope that helps!
>
>Cheers,
>Matt
>
>~~~~~~~~~~~
>Matthew Blackwell
>Assistant Professor of Government
>Harvard University
>url:
<<http://www.mattblackwell.org
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mattblackwell.org&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=eXW2PPwk59E6x0Nd1dQkgdFkJwJaWpA-1DYqidfSMac&e=>
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mattblackwell.org&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=eXW2PPwk59E6x0Nd1dQkgdFkJwJaWpA-1DYqidfSMac&e=>
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=-Du6TT8LOfmvMTZ8o13WP_gWc2xYamy_Zrnjjm_hf4A&e=>
.mattblackwell.orgÂ
>
>On Wed, Nov 11, 2015 at 1:14 AM, W. D.
<<mailto:WD@a7h.com
<javascript:_e(%7B%7D,'cvml','WD@a7h.com');>
<mailto:WD@a7h.com
<javascript:_e(%7B%7D,'cvml','WD@a7h.com');>>
WD(a)a7h.com <javascript:_e(%7B%7D,'cvml','WD@a7h.com');>>
wrote:
>If 5
sets of data are generated using a command like
>this:
>
>DataImputed <- amelia(x=GroupData,incheck=TRUE)
>
>What would be the names of the 5 sets of data in order
>to use ameliabind?
>
>DataImputedAll <- ameliabind(set1?, set2?, set3?, set4?, set5?)
>
>There seem to be a dearth of examples online.
>
>Thanks for your help.
>
>--
>Amelia mailing list served by HUIT
>[Un]Subscribe/View Archive:
<<http://lists.gking.harvard.edu/?info=amelia>http://lists.gking.harva
<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.gking.harva&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=Tm-ld5Uz-SAPdD3xesCy3x7cwEKu28E5LVTjz6Iuhwg&e=>
<https://urldefense.proofpoint.com/v2/url?u=http-3A__rd.edu_-3Finfo-3Damelia&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=iOIo47YnwXUKw24iDbVD7TDL8Y9ldGrjQsZOs2N1WYY&e=>
http://lists.gking.harvard.edu/?info=amelia
>More info about Amelia:
<<http://gking.harvard.edu/amelia>http://gking.harvard.edu/amelia>http
://gking.harvard.edu/amelia
>>Amelia mailing list
>><mailto:Amelia@lists.gking.harvard.edu
<javascript:_e(%7B%7D,'cvml','Amelia@lists.gking.harvard.edu');>><mailto:
Amelia(a)lists.gking.ha
<javascript:_e(%7B%7D,'cvml','Amelia@lists.gking.ha');>>rvard.edu
<https://urldefense.proofpoint.com/v2/url?u=http-3A__rvard.edu&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=H64z4J-wJYfL-wNJ58EmiHDNCma-E8ZWtWY8A8FrlEI&e=>
Amelia(a)lists.gking.harvard.edu
<javascript:_e(%7B%7D,'cvml','Amelia@lists.gking.harvard.edu');>
>>
>>To unsubscribe from this list or get other information:
>>
>><<https://lists.gking.harvard.edu/mailman/listinfo/amelia>https://li
<https://urldefense.proofpoint.com/v2/url?u=https-3A__li&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=AwuvOSjBW8MbfmWVBKKIIxLx6Ski-VBpLu15AdWWERM&e=>
<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.gking.harv&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=uRealWqVgtwjdl_wchuDe2rS0VmuDFUX4jopSCyq8wA&e=>
<https://urldefense.proofpoint.com/v2/url?u=http-3A__ard.edu_mailman_listinfo_amelia&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=vKy-EsvURsbv0l2INFeCgRyXqzbaAyEFxuMtgYHVEpo&m=ARD-CRyJMFMm33TLIIFik4d8eLugb8Uqhrjf2bo5TB4&s=kV0HHdDDyvUlhOTE-ICtXMuOSZvzIVRKosQhga4xwgc&e=>
>>>
>>
>
>--
>Amelia mailing list served by HUIT
>[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia
>More info about Amelia:
http://gking.harvard.edu/amelia
>Amelia mailing list
Amelia(a)lists.gking.harvard.edu
<javascript:_e(%7B%7D,'cvml','Amelia@lists.gking.harvard.edu');>
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/amelia
--
Amelia mailing list served by HUIT
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia
More info about Amelia:
http://gking.harvard.edu/amelia
Amelia mailing list
Amelia(a)lists.gking.harvard.edu
<javascript:_e(%7B%7D,'cvml','Amelia@lists.gking.harvard.edu');>
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/amelia