mids
Objectwrite.mice.imputation.Rd
Exports multiply imputed datasets and information about the imputation.
Objects of class mids
(generated by mice::mice
)
and mids.1chain
(generated by mice.1chain
) are supported.
write.mice.imputation(mi.res, name, include.varnames=TRUE,
long=TRUE, mids2spss=TRUE, spss.dec=",", dattype=NULL)
Object of class mids
or mids.1chain
Name of created subdirectory and datasets
An optional logical indicating whether variable names should be included
in the imputed dataset. The default is TRUE
.
An optional logical indicating whether the dataset should also be saved in a long format?
An optional logical indicating whether a syntax for reading imputed datasets in SPSS should be included
SPSS decimal separator (can be ","
or "."
)
Format of the saved dataset: csv
or csv2
Several files are saved using impxxx
(the name
)
as the prefix:
Saved object of class mids
Saved object of a list containing multiply imputed datasets
File with list of multiply imputed datasets
Summary file of the imputation
Imputed datasets nn
File containing imputation methods
File with variable names of the dataset
Imputed datasets in long format
File containing the predictor matrix
SPSS syntax for reading the corresponding
txt
file into SPSS format.
See also mice::mids2mplus
and
mice::mids2spss
if (FALSE) {
#############################################################################
# EXAMPLE 1: Imputation of nhanes data and write imputed datasets on disk
#############################################################################
data(nhanes,package="mice")
#**********
# Model 1: Imputation using mice
imp1 <- mice::mice( nhanes, m=3, maxit=5 )
# write results
write.mice.imputation(mi.res=imp1, name="mice_imp1" )
#**********
# Model 2: Imputation using mice.1chain
imp2 <- miceadds::mice.1chain( nhanes, burnin=10, iter=20, Nimp=4 )
# write results
write.mice.imputation(mi.res=imp2, name="mice_imp2" )
}