mice
does not support post-processing for blocks of variables
#378
Replies: 10 comments
-
Cannot reproduce on set.seed(123)
library(mice)
library(magrittr)
version()
#> [1] "mice 3.13.0 2021-01-26 /Library/Frameworks/R.framework/Versions/4.0/Resources/library"
ini <- mice(boys, maxit = 0)
meth <- ini$meth
meth["tv"] <- "norm"
post <- ini$post
post["tv"] <- "imp[[j]][, i] <- squeeze(imp[[j]][, i], c(3, 7))"
post["bmi"] <- "imp[[j]][, i] <- squeeze(imp[[j]][, i], c(28, Inf))"
post["hgt"] <- "imp[[j]][, i] <- squeeze(imp[[j]][, i], c(50, 55))"
imp <- mice(boys, meth=meth, post=post, print=FALSE)
imp$imp$tv %>% range
#> [1] 3 7
imp$imp$bmi %>% range
#> [1] 28 28
imp$imp$hgt %>% range
#> [1] 50 55 Created on 2021-03-25 by the reprex package (v1.0.0) |
Beta Was this translation helpful? Give feedback.
-
Please note that post-processing only works for imputed values; the observations are not processed. |
Beta Was this translation helpful? Give feedback.
-
This is not a bug. I found it hard to imagine a generic way to implement post-processing under block-wise imputation models. I'll be interested to hear of any suggestions, preferably including practical examples that illustrate the need for such block-wise post-processing. |
Beta Was this translation helpful? Give feedback.
-
Commit 8f78a27 adds the explanation to the documentation. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your response. I also have the following questions.
As pointed out in the block notes, variables within a block are imputed by
a multivariate imputation method. The problem is that the "make.method"
function picks up a univariate imputation method. So my questions are as
follows.
1) In that default method case, is there any difference between blocks with
more than 1 variable setting and 1 variable in 1 block setting?
2) If the results are similar. Using blocks plus default methods will have
the drawback that only 1 default method can be applied to a block.
Also, it is confusing that the default methods don't contain a multivariate
one. And the univariate methods can be applied to the blocks with more than
1 variable.
Looking forward to your response. Thank you.
Best,
Gary
…On Wed, Mar 31, 2021 at 10:54 AM Stef van Buuren ***@***.***> wrote:
Commit 8f78a27
<8f78a27>
adds the explanation to the documentation.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#326 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARN45ODSOCNPRZGAVLIUSEDTGMZRRANCNFSM4Z2A7NYQ>
.
|
Beta Was this translation helpful? Give feedback.
-
The The blocks facility is more of an experimental feature meant for cases where you wish model two or more variables jointly, so you would impute two or more values per row by one method. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Question: In that default method case, is there any difference between blocks with more than 1 variable setting and 1 variable in 1 block setting? No difference. suppressPackageStartupMessages(library(mice))
imp1 <- mice(nhanes, seed = 1, m = 1, maxit = 2, print = FALSE)
imp2 <- mice(nhanes, blocks = list(c("bmi", "hyp"), "chl"), m = 1, maxit = 2, seed = 1, print = FALSE)
identical(complete(imp1, 1), complete(imp2, 1))
#> [1] TRUE
imp3 <- mice(nhanes, blocks = list(c("hyp", "bmi"), "chl"), m = 1, maxit = 2, seed = 1, print = FALSE)
identical(complete(imp1, 1), complete(imp3, 1))
#> [1] FALSE
imp4 <- mice(nhanes, visitSequence = c("hyp", "bmi", "chl"), m = 1, maxit = 2, seed = 1, print = FALSE)
identical(complete(imp3, 1), complete(imp4, 1))
#> [1] TRUE Created on 2021-04-01 by the reprex package (v1.0.0) |
Beta Was this translation helpful? Give feedback.
-
Comment: If the results are similar. Using blocks plus default methods will have the drawback that only 1 default method can be applied to a block. That's correct, but you should think of it as a feature rather than as a drawback. The whole idea of block imputation is that you can use one method (be it univariate or multivariate) to impute multiple variables at the same time. |
Beta Was this translation helpful? Give feedback.
-
Yes. For the users who want to use blocks, is it possible to assign a
default multivariate imputation method (jomoImpute) to the blocks with more
than 1 variable?
Best,
Gary
…On Thu, Apr 1, 2021 at 9:00 AM Stef van Buuren ***@***.***> wrote:
Comment: *If the results are similar. Using blocks plus default methods
will have the drawback that only 1 default method can be applied to a
block.*
That's correct, but you should think of it as a feature rather than as a
drawback. The whole idea of block imputation is that you can use one method
(be it univariate or multivariate) to impute multiple variables at the same
time.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#326 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARN45OAYN2TXVHRTT5FBXMLTGRU5FANCNFSM4Z2A7NYQ>
.
|
Beta Was this translation helpful? Give feedback.
-
I would do that by mice(nhanes, blocks = list(c("bmi", "hyp"), "chl"), method = c("jomoImpute", "pmm")) I also tried to set |
Beta Was this translation helpful? Give feedback.
-
The processing of "post" is missed for multivariate imputation.
Beta Was this translation helpful? Give feedback.
All reactions