jwb133 / smcfcs

R package implementing Substantive Model Compatible Fully Conditional Specification Multiple Imputation
11 stars 7 forks source link

Interpreting the output of the MIcombine models #22

Closed Daniel-Adan-Lopez closed 2 years ago

Daniel-Adan-Lopez commented 2 years ago

Hello,

I had a quick question. When summarizing the models it looks like categorical variables are given a different naming convention. In my case, they are now variablename.L, variablename.Q, variablename.C. What do these stand for? Is it in ascending order with L being the lowest level and C the highest level in this particular example?

If I want to change the reference level should this be done before the imputation? Thank you.

jwb133 commented 2 years ago

MIcombine is from the mitools package, which I didn't write. I've not seen this before. Can you reply with the syntax/call to MIcombine?

To change the reference level of a variable you'd normally use something like relevel. You could certainly do this before imputation, but I think it should also be possible to do it after - the imputed datasets are stored in a list, so you'd have to loop through each imputed dataset in the list and apply relevel to the variable in each one.

Best wishes Jonathan

On Mon, 25 Jul 2022, 22:24 DLopez_URMC, @.***> wrote:

Hello,

I had a quick question. When summarizing the models it looks like categorical variables are given a different naming convention. In my case, they are now variablename.L, variablename.Q, variablename.C. What do these stand for? Is it in ascending order with L being the lowest level and C the highest level in this particular example?

If I want to change the reference level should this be done before the imputation? Thank you.

— Reply to this email directly, view it on GitHub https://github.com/jwb133/smcfcs/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPU7BQVJ4BDXX3Y57P4ZMTVV3SU7ANCNFSM54TL3NEA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

edbonneville commented 2 years ago

@Daniel-Adan-Lopez I would guess that you have an ordered factor, for which the default in R is to use polynomial contrasts (see options()$contrasts in your console) - so the .L/.Q/.C are not factor recodings but just respectively the linear/quadratic/cubic parts of the contrast matrix.

So this is not an issue with mitools::MICombine(), and the simplest way to move forward is just to set options(contrasts = rep("contr.treatment", 2)) at the top of your script before running imputations/pooling :)

Daniel-Adan-Lopez commented 2 years ago

Thanks Jonathan and Ed. It indeed was only doing it for ordered factors.

Best,

Daniel

Daniel-Adan-Lopez commented 2 years ago

Just wanted to update that the above worked. Thanks!