Possible improvement to D1 function #641
Replies: 2 comments 2 replies
-
Thanks a lot for your deep analysis and suggested action. It is both surprising and odd that Your suggestion to bypass
In the case that However, if we do know A slighly better approach is to temporarily set In cases where Such changes might best go into |
Beta Was this translation helpful? Give feedback.
-
Dear Simon, and Stef, many thanks for your response. I dont have the background to comment on the best solution but i agree the best would be to warn the user to use more imputations (which is what we decided to do in our project) many thanks! |
Beta Was this translation helpful? Give feedback.
-
I would like to propose a small change to the D1 function in mice.
In specific situations it can produce wrong results that can go undetected:
Here is a reproducible example explaining the source of the issue:
if we look at each imputed dataset individually, each of the 5 imputation sets produce similar p-values to the original data...so the pooled p-value with D1 doesnt look right in this case
the issue appears to be the degrees of freedom df1 and df2 getting much lower (1 and 4) than they should be. this is caused by the mitmt::d1() called by mice to compute D1. MITML::D1 uses the Reiter Vf Degree of freedom correction for small samples by default when a dfcom is passed, and mice::d1 always passes a dfcom to mitml....(even if we set dfcom to null)
There is nothing wrong with using the Reiter formula, except that if we have:
-5 imputed sets and
-only 1 extra parameter between the nested models (interaction between two continuous, one binary and one continuous and two binary variables) the Reiter formula cant be used (results in divisions by zero)...
this happens whenever t =4 , (where t = k(m-1) , k = number of new parameters in fit1, m = number of imputations)
if t = 4 the c0 parameter in the Reiter formula will include divisions by zero (c0 = 1 / (t-4)). c0 is then used in the Reiter formula, producing wrong 'corrected degrees of freedom'.*
currently, there is no way to prevent Reiter formula from being used using mice::D1. I would like to suggest a small change to D1 conde to include a warning (either advsing to increase the number of imputations or giving the options to skip the Reiter correction).
using mitml itself it is possible to prevent the Reiter vf formula from being used:
we can confirm this is the case by repeating the analysis but using 6 instead of 5 imputations
ROOT CAUSE
Suggestion
I think the most logical ways to avoid this issue would be to print a warning whenever mice::d1 is called with a 't' value equal to 4...
The warning can instruct users to either increase the number of imputations, if they want to procced Reiter correction cannot be used... (then D1 code has to change to no pass df.com to mitml::testmodel()
it would be easy to calculate T within the mice::D1 call and adjust the following line in the mice::D1() call to only pass dfcom if t>4:
tmr <- mitml::testModels(fit1, fit0, method = "D1", df.com = dfcom)
final note
as it is probably clear by now, i am not in any way a statistician, possibly I made some mistakes in my explanation and if something is really stupid please accept my apologies and feel free to correct me
Beta Was this translation helpful? Give feedback.
All reactions