IQSS / Zelig

A statistical framework that serves as a common interface to a large range of models
http://zeligproject.org
109 stars 43 forks source link

extracting individual (or pooled) imputed datasets #312

Closed nmbrodnax closed 6 years ago

nmbrodnax commented 6 years ago

Email from a user:

I have imputed twenty datasets using Amelia, and subsequently used Zelig to perform a logit GEE analysis on the datasets. This works very well, but I would now like to do some model selection using QIC or MLIC. There appear to be some packages available in R which will give me QIC values, but they do not seem to work on a Zelig object. Is there a method of extracting individual (or pooled) imputed datasets from Zelig as, for example, geeglm objects, in order to use these packages for calculation of QIC?

christophergandrud commented 6 years ago

from_zelig_model would be my place to start. It extracts the fitted model object from the zelig object.

However, I haven't tested it in this case. So please give it a shot and report back.

idglover commented 6 years ago

Yep, this worked a treat thankyou. The from_zelig_model extracted the fitted models, and then I used the following function from the MESS package to get the QIC:

ExtWisModel<-from_zelig_model(GeeWisModel) QIC(ExtWisModel[[1]])

where 1 is the 1st imputed dataset of the twenty.

Many thanks!!!!!

christophergandrud commented 6 years ago

Glad to hear the solution worked!