07complete: Extract the Completed Data

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function extracts several multiply imputed data.frames from an object of mi-class.

Usage

1
complete(y, m, ...)

Arguments

y

An object of mi-class (typically) or missing_data.frame-class or missing_variable-class

m

If y is an object of mi-class, then m must be a specified integer indicating how many multiply imputed data.frames to return or, if missing, the number of data.frames will be equal to the length of the data slot in y. If y is not an object of mi-class, then m must be a specified integer indicating which iteration to use in the resulting data.frame, where any non-positive integer is a short hand for the last iteration.

...

Other arguments, not currently utilized

Details

Several functions within mi use complete, although the only reason in principle why a user should need to call complete is to create data.frames to export to another program. For analysis, it is better to use the pool function, although currently pool might not offer all the necessary functionality.

Value

If y is an object of mi-class and m > 1, a list of m data.frames is returned. Otherwise, a single data.frame is returned.

Author(s)

Ben Goodrich and Jonathan Kropko, for this version, based on earlier versions written by Yu-Sung Su, Masanao Yajima, Maria Grazia Pittau, Jennifer Hill, and Andrew Gelman.

See Also

mi-class

Examples

1
2
3
4
5
if(!exists("imputations", env = .GlobalEnv)) {
  imputations <- mi:::imputations # cached from example("mi-package")
}
data.frames <- complete(imputations, 3)
lapply(data.frames, summary)

Example output

Loading required package: Matrix
Loading required package: stats4
mi (Version 1.0, packaged: 2015-04-16 14:03:10 UTC; goodrich)
mi  Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Trustees of Columbia University
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under the General Public License version 2 or later.
Execute RShowDoc('COPYING') for details.
[[1]]
    ppvtr.36      first   b.marr      income              momage      momed  
 Min.   : 41.00   0:226   0:123   Min.   :   -144.1   Min.   :16.00   1:125  
 1st Qu.: 73.79   1:174   1:277   1st Qu.:   8254.1   1st Qu.:22.00   2:157  
 Median : 87.00                   Median :  17453.6   Median :24.00   3: 88  
 Mean   : 86.13                   Mean   :  30533.4   Mean   :23.75   4: 30  
 3rd Qu.: 99.06                   3rd Qu.:  30994.2   3rd Qu.:26.00          
 Max.   :138.13                   Max.   :1057448.0   Max.   :32.00          
 momrace missing_ppvtr.36 missing_b.marr  missing_income  missing_momed  
 1: 86   Mode :logical    Mode :logical   Mode :logical   Mode :logical  
 2:103   FALSE:325        FALSE:388       FALSE:318       FALSE:360      
 3:211   TRUE :75         TRUE :12        TRUE :82        TRUE :40       
                                                                         
                                                                         
                                                                         
 missing_momrace
 Mode :logical  
 FALSE:283      
 TRUE :117      
                
                
                

[[2]]
    ppvtr.36      first   b.marr      income              momage      momed  
 Min.   : 41.00   0:226   0:126   Min.   :   -188.2   Min.   :16.00   1:133  
 1st Qu.: 73.98   1:174   1:274   1st Qu.:   7835.4   1st Qu.:22.00   2:152  
 Median : 86.90                   Median :  16665.0   Median :24.00   3: 87  
 Mean   : 85.71                   Mean   :  29166.0   Mean   :23.75   4: 28  
 3rd Qu.: 98.12                   3rd Qu.:  29618.5   3rd Qu.:26.00          
 Max.   :132.00                   Max.   :1057448.0   Max.   :32.00          
 momrace missing_ppvtr.36 missing_b.marr  missing_income  missing_momed  
 1: 86   Mode :logical    Mode :logical   Mode :logical   Mode :logical  
 2:116   FALSE:325        FALSE:388       FALSE:318       FALSE:360      
 3:198   TRUE :75         TRUE :12        TRUE :82        TRUE :40       
                                                                         
                                                                         
                                                                         
 missing_momrace
 Mode :logical  
 FALSE:283      
 TRUE :117      
                
                
                

[[3]]
    ppvtr.36      first   b.marr      income              momage      momed  
 Min.   : 28.77   0:226   0:126   Min.   :   -127.4   Min.   :16.00   1:125  
 1st Qu.: 73.78   1:174   1:274   1st Qu.:   7778.0   1st Qu.:22.00   2:157  
 Median : 86.00                   Median :  16722.5   Median :24.00   3: 88  
 Mean   : 85.79                   Mean   :  28877.8   Mean   :23.75   4: 30  
 3rd Qu.: 99.00                   3rd Qu.:  29767.1   3rd Qu.:26.00          
 Max.   :133.20                   Max.   :1057448.0   Max.   :32.00          
 momrace missing_ppvtr.36 missing_b.marr  missing_income  missing_momed  
 1: 90   Mode :logical    Mode :logical   Mode :logical   Mode :logical  
 2:115   FALSE:325        FALSE:388       FALSE:318       FALSE:360      
 3:195   TRUE :75         TRUE :12        TRUE :82        TRUE :40       
                                                                         
                                                                         
                                                                         
 missing_momrace
 Mode :logical  
 FALSE:283      
 TRUE :117      
                
                
                

mi documentation built on May 1, 2019, 10:13 p.m.