Creates imputed dataset from a mids.nmi or mids.1chain object.

# S3 method for mids.nmi
complete(data, action=c(1,1), ...)

# S3 method for mids.1chain
complete(data, action=1, ...)

Arguments

data

Object of class mids.nmi (for complete.mids.nmi) or mids.1chain (for complete.mids.1chain)

action

A vector of length two indicating to indices of between and within imputed dataset for for complete.mids.nmi and an integer for the index of imputed dataset for complete.mids.1chain.

...

More arguments to be passed

See also

See also the corresponding mice::complete function and mitml::mitmlComplete.

Imputation methods: mice.nmi, mice.1chain

Examples

if (FALSE) {
#############################################################################
# EXAMPLE 1: Nested multiple imputation and dataset extraction for TIMSS data
#############################################################################

library(BIFIEsurvey)
data(data.timss2, package="BIFIEsurvey" )
datlist <- data.timss2

# remove first four variables
M <- length(datlist)
for (ll in 1:M){
    datlist[[ll]] <- datlist[[ll]][, -c(1:4) ]
}

#***************
# (1) nested multiple imputation using mice
imp1 <- miceadds::mice.nmi( datlist,  m=4, maxit=3 )
summary(imp1)

#***************
# (2) nested multiple imputation using mice.1chain
imp2 <- miceadds::mice.nmi( datlist, Nimp=4, burnin=10,iter=22, type="mice.1chain")
summary(imp2)

#**************
# extract dataset for third orginal dataset the second within imputation
dat32a <- miceadds::complete.mids.nmi( imp1, action=c(3,2) )
dat32b <- miceadds::complete.mids.nmi( imp2, action=c(3,2) )

#############################################################################
# EXAMPLE 2: Imputation from one chain and extracting dataset for nhanes data
#############################################################################

library(mice)
data(nhanes, package="mice")

# nhanes data in one chain
imp1 <- miceadds::mice.1chain( nhanes, burnin=5, iter=40, Nimp=4,
            method=rep("norm", 4 ) )

# extract first imputed dataset
dati1 <- miceadds::complete.mids.1chain( imp1, action=1 )
}