The metafor Package

A Meta-Analysis Package for R

User Tools

Site Tools


tips:multiple_imputation_with_mice_and_metafor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tips:multiple_imputation_with_mice_and_metafor [2019/10/09 12:36]
Wolfgang Viechtbauer
tips:multiple_imputation_with_mice_and_metafor [2019/10/09 12:46] (current)
Wolfgang Viechtbauer
Line 187: Line 187:
 </​code>​ </​code>​
  
-Next, I create a vector that specifies the method used to predict each variable:+Next, I create a vector that specifies the method used to predict ​(and hence impute) ​each variable:
 <code rsplus> <code rsplus>
 impMethod <- make.method(dat) impMethod <- make.method(dat)
Line 197: Line 197:
  
 </​code>​ </​code>​
-Here''​pmm''​ stands for predictive mean matching, which will be used to impute the numeric ​''​length'' ​variable. For the two-level factors, logistic regression ​will be used (as indicated by ''​logreg''​). ​Finally, ​''​""​'' ​indicates ​that no imputation method ​will be used for the ''​yi'',​ ''​vi'',​ and ''​imag''​ variables ​(since these variables do not contain any missing values).+By default, predictive mean matching ​(''​pmm''​) is used for numeric variableswhile logistic regression (''​logreg''​) ​is used for two-level factorsOne could change these defaults to other methods (see ''​help(mice)'' ​for other imputation methods that could be used), but we will stick to the (usually sensible) defaults here. Note that no imputation method ​is specified ​for the ''​yi'',​ ''​vi'',​ and ''​imag''​ variablessince these variables do not contain any missing values.
  
 Now we are ready to generate the multiple imputations. Often (and by default), only 5 datasets are generated, but I increase this to 20 below. I also set the seed (for the random number generator) to make the following results fully reproducible:​ Now we are ready to generate the multiple imputations. Often (and by default), only 5 datasets are generated, but I increase this to 20 below. I also set the seed (for the random number generator) to make the following results fully reproducible:​
tips/multiple_imputation_with_mice_and_metafor.txt ยท Last modified: 2019/10/09 12:46 by Wolfgang Viechtbauer