Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

write.mice.imputation

Export Multiply Imputed Datasets from a mids Object


Description

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.

Usage

write.mice.imputation(mi.res, name, include.varnames=TRUE,
      long=TRUE, mids2spss=TRUE, spss.dec=",", dattype=NULL)

Arguments

mi.res

Object of class mids or mids.1chain

name

Name of created subdirectory and datasets

include.varnames

An optional logical indicating whether variable names should be included in the imputed dataset. The default is TRUE.

long

An optional logical indicating whether the dataset should also be saved in a long format?

mids2spss

An optional logical indicating whether a syntax for reading imputed datasets in SPSS should be included

spss.dec

SPSS decimal separator (can be "," or ".")

dattype

Format of the saved dataset: csv or csv2

Value

Several files are saved using impxxx (the name) as the prefix:

impxxx.Rdata

Saved object of class mids

impxxx__DATALIST.Rdata

Saved object of a list containing multiply imputed datasets

impxxx__IMP_LIST

File with list of multiply imputed datasets

impxxx__IMP_SUMMARY

Summary file of the imputation

impxxx__IMPDATA_nn

Imputed datasets nn

impxxx__IMPMETHOD

File containing imputation methods

impxxx__LEGENDE

File with variable names of the dataset

impxxx__LONG

Imputed datasets in long format

impxxx__PREDICTORMATRIX

File containing the predictor matrix

impxxx__SPSS.sps

SPSS syntax for reading the corresponding txt file into SPSS format.

See Also

Examples

## Not run: 
#############################################################################
# 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" )

## End(Not run)

miceadds

Some Additional Multiple Imputation Functions, Especially for 'mice'

v3.11-6
GPL (>= 2)
Authors
Alexander Robitzsch [aut,cre] (<https://orcid.org/0000-0002-8226-3132>), Simon Grund [aut] (<https://orcid.org/0000-0002-1290-8986>), Thorsten Henke [ctb]
Initial release
2021-01-21 11:48:47

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.