tips:multiple_imputation_with_mice_and_metafor
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tips:multiple_imputation_with_mice_and_metafor [2020/03/06 16:53] – Wolfgang Viechtbauer | tips:multiple_imputation_with_mice_and_metafor [2020/12/02 17:10] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 133: | Line 133: | ||
One way of dealing with missing data is to make use of imputation techniques. The advantage of using [[wp> | One way of dealing with missing data is to make use of imputation techniques. The advantage of using [[wp> | ||
- | The mice package allows us to automate this process and can be used in combination with the metafor package. First, we install and load the mice package | + | The [[https:// |
<code rsplus> | <code rsplus> | ||
install.packages(" | install.packages(" | ||
library(mice) | library(mice) | ||
- | eval(metafor:::.mice) | + | </ |
+ | |||
+ | Also, due to a recent change in the mice package | ||
+ | |||
+ | <code rsplus> | ||
+ | withold <- function (data, expr) { | ||
+ | call <- match.call() | ||
+ | analyses <- as.list(seq_len(data$m)) | ||
+ | for (i in seq_along(analyses)) { | ||
+ | data.i <- complete(data, | ||
+ | analyses[[i]] <- eval(expr = substitute(expr), | ||
+ | if (is.expression(analyses[[i]])) | ||
+ | analyses[[i]] <- eval(expr = analyses[[i]], | ||
+ | } | ||
+ | object <- list(call = call, call1 = data$call, nmis = data$nmis, analyses = analyses) | ||
+ | oldClass(object) <- c(" | ||
+ | object | ||
+ | } | ||
</ | </ | ||
tips/multiple_imputation_with_mice_and_metafor.txt · Last modified: 2022/08/03 11:35 by Wolfgang Viechtbauer