To illustrate, let’s construct the Potthoff-Roy data following the example code in ?potthoffroy within the mice package: # create missing values at age 10 as in Little and Rubin (1987) If you instead want to do it manually, you can do so by making using of the rbind function within the mice package. One approach is to use the function in the miceadds package, a package which extends functionality for mice in various directions. Compared to Stata, one has to do a little bit more work. Last week someone asked me how to do it in R, ideally with the mice package. Stata will then impute separately in groups defined by this variable(s), and then assemble the imputations of each strata back together so you have your desired number of imputed datasets. You simply tell the mi impute command what variable (or variables) you want to perform the imputation stratified on. ![]() ![]() ![]() In Stata, this is made very easy through use of the by() option. When using multiple imputation to impute missing values there are often situations where one wants to perform the imputation process completely separately in groups of subjects defined by some fully observed variable (e.g.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |