This function exports completed data from an object of
mi-class in which
data.frames are appended to the end of the raw data. Two additional variables are added which indicate the row number and distinguish the
data.frames. The outputed file is either Stata
(.dta) or comma-separated (.csv) format, and can be easily registered in Stata as multiply imputed data.
The number of completed datasets to append onto the raw data
The filename, either a full path or relative to the working directory, where the file will be saved. Filenames must end in either '.dta' or '.csv'. Files with names ending in '.dta' will be saved as a Stata data file, and files with names ending in '.csv' will be saved as a comma-separated file.
Further arguments passed to
The function calls
complete to construct
data.frames, and uses
rbind to append them to the bottom of the raw data that still contains all of the missing values.
Two new variables are added:
_mi, which contains the observation numbers; and
_mj, which indexes the
To save a Stata .dta file, end the filename with '.dta'. To save a comma-separated file, end the filename with
.csv'. Stata files are loaded into Stata using Stata's
use command, and comma-separated files can be loaded
insheet using filename
, comma names clear. Once the file is loaded into Stata, the
data must be registered as multiply imputed before any subsequent analyses can be performed. In Stata version 11 or
mi import mice to register the data. The
_mj variables will be replaced
by variables named
_mi_m respectively. In Stata version 10 or earlier, install the
MIM package by typing
findit mim and installing package
st0139_1. Then the prefix
must be added to any command using the multiply imputed data.
Any observations which are unpossible (legitimately skipped, and are not imputed, see
missing_variable) will remain missing in the complete data, but will not be indicated as missing by these variables. If there are
any unpossible values, missing indicators are included automatically.
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.
1 2 3 4 5
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. Note: after loading the data into Stata, version 11 or later, type 'mi import ice' to register the data as being multiply imputed. For Stata 10 and earlier, install MIM by typing 'findit mim' and include 'mim:' as a prefix for any command using the MI data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.