Hello Glenys,
Once you have the .csv files, it is relatively easy to put them into
Zelig. The quickest way is a bit of hack, but it works.
#### begin code ####
library(Zelig)
m <- 5 # number of imputations
imp.data <- list() # where we store the datasets
for (i in 1:m) {
file.name <- paste("outdata",i,".csv",sep="") #where
"outdata" is
the root of the filename
imp.data[[i]] <- read.csv(file=file.name)
}
class(imp.data) <- c("mi","list")
zelig(formula=y~x, model=foo, data=imp.data)
##### end code #####
this code loops through each filename and makes a list of $m$
datasets, where $m$ is the number of imputations you ran. Zelig has a
slightly awkward way of bringing those datasets together (you have to
list them one by one), so line with "class(imp.data)" makes the list
proper for Zelig. now you can feed it to the "zelig" function along
with your formula and model and it should report back combined
estimates for all your quantities of interest.
I hope that was clear. If you have any question, feel free to get back
to the list. Or if anyone has a cleaner way of implementing the same
thing, please let us know.
Thanks,
matt.
On 10/15/07, Glenys Lafrance <glenys.lafrance(a)sympatico.ca> wrote:
Dear Amelia enthusiasts,
James Honacker was kind enough to answer my queries re Amelia and combining
datasets; but unfortunately, no one has picked up the thread to help me get
the job done. I have R and Zelig…I can get Zelig to open AmeliaView, then I
can create the imputation files, get back to Zelig and I think it reads the
.csv files (not totally sure about that), but afterwards I don't know how to
write the output commands so I end up with the 1 complete file I can then
convert back to SPSS. Is there any chance someone could help me get this
last bit nailed? It would be greatly appreciated…as I am running out of
time to complete my degree..;(
Take care,
Glenys Lafrance
PhD Candidate
OISE/UT
-
Amelia mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia