-
Notifications
You must be signed in to change notification settings - Fork 107
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mice
does not support post-processing for blocks of variables
#326
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) |
Please note that post-processing only works for imputed values; the observations are not processed. |
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. |
mice
does not support post-processing for blocks of variables
Commit 8f78a27 adds the explanation to the documentation. |
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>
.
|
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. |
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) |
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. |
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>
.
|
I would do that by mice(nhanes, blocks = list(c("bmi", "hyp"), "chl"), method = c("jomoImpute", "pmm")) I also tried to set |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
The processing of "post" is missed for multivariate imputation.
The text was updated successfully, but these errors were encountered: