Learn R Programming

miceadds (version 1.5-0)

pool.mids.nmi: Pooling for Nested Multiple Imputation

Description

Statistical inference for scalar parameters for nested multiply imputed datasets (Rubin, 2003; Harel & Schafer, 2003; Reiter & Raghanuthan, 2007). The NMIcombine and NMIextract functions are extensions of mitools::MIcombine and mitools::MIextract.

Usage

pool.mids.nmi(object, method = "largesample")

NMIcombine( qhat , u=NULL , NMI=TRUE, comp_cov=TRUE, is_list=TRUE )

NMIextract(results, expr, fun)

## S3 method for class 'mipo.nmi':
summary(object, digits=3, ...)

## S3 method for class 'mipo.nmi':
coef(object, ...)

## S3 method for class 'mipo.nmi':
vcov(object, ...)

Arguments

object
Object of class mids.nmi. For summary it must be an object of class mipo.nmi.
method
Method for calculating degrees of freedom. Until now, only the method "largesample" is available.
qhat
List of lists of parameter estimates. In case of an ordinary imputation it can only be a list.
u
Optional list of lists of covariance matrices of parameter estimates
NMI
Optional logical indicating whether the NMIcombine function should be applied for results of nested multiply imputed datasets. It is set to FALSE if only a list results of multiply imputed datasets is available.
comp_cov
Optional logical indicating whether covariances between parameter estimates should be estimated.
is_list
Optional logical indicating whether qhat and u are provided as lists as an input. If is_list=FALSE, appropriate arrays can be used as inpur.
results
A list of objects
expr
An expression
fun
A function of one argument
digits
Number of digits after decimal for printing results in summary.
...
Further arguments to be passed.

Value

  • Object of class mipo.nmi with following entries
  • qhatEstimated parameters in all imputed datasets
  • uEstimated covariance matrices of parameters in all imputed datasets
  • qbarEstimated parameter
  • ubarAverage estimated variance within imputations
  • TmTotal variance of parameters
  • dfDegrees of freedom
  • lambdaTotal fraction of missing information
  • lambda_BetweenFraction of missing information of between imputed datasets (first stage imputation)
  • lambda_WithinFraction of missing information of within imputed datasets (second stage imputation)

References

Harel, O., & Schafer, J. (2003). Multiple imputation in two stages. In Proceedings of Federal Committee on Statistical Methodology 2003 Conference. Reiter, J. P., & Raghunathan, T. E. (2007). The multiple adaptations of multiple imputation. Journal of the American Statistical Association, 102(480), 1462-1471. Rubin, D. B. (2003). Nested multiple imputation of NMES via partially incompatible MCMC. Statistica Neerlandica, 57(1), 3-18.

See Also

mice.nmi mice::pool, mitools::MIcombine, mitools::MIextract MIcombine.NestedImputationResultList

Examples

Run this code
#############################################################################
# EXAMPLE 1: Nested multiple imputation and statistical inference
#############################################################################

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 <- mice.nmi( datlist ,  m=3 , maxit=2 )
summary(imp1)

#***************
# (2) first linear regression: ASMMAT ~ migrant + female
res1 <- with( imp1 , lm( ASMMAT ~ migrant + female ) ) # fit
pres1 <- pool.mids.nmi( res1 )  # pooling
summary(pres1)  # summary
coef(pres1) 
vcov(pres1)

#***************
# (3) second linear regression: likesc ~ migrant + books
res2 <- with( imp1 , lm( likesc ~ migrant + books  ) )
pres2 <- pool.mids.nmi( res2 ) 
summary(pres2)

#***************
# (4) some descriptive statistics using the mids.nmi object
res3 <- with( imp1 , c( "M_lsc"=mean(likesc) , "SD_lsc"=sd(likesc) ) )
pres3 <- NMIcombine( qhat = res3$analyses )
summary(pres3)

#*************
# (5) apply linear regression based on imputation list

# convert mids object to datlist
datlist2 <- mids2datlist( imp1 )
str(datlist2, max.level=1)

# double application of lapply to the list of list of nested imputed datasets
res4 <- lapply( datlist2 , FUN = function(dl){
    lapply( dl , FUN = function(data){ 
            lm( ASMMAT ~ migrant + books  , data = data )
                                } )
                }  )
                
# extract coefficients
qhat <- lapply( res4 , FUN = function(bb){
            lapply( bb , FUN = function(ww){
                    coef(ww)
                        } )
                } )
# shorter function
NMIextract( results=res4 , fun=coef )                

# extract covariance matrices
u <- lapply( res4 , FUN = function(bb){
            lapply( bb , FUN = function(ww){
                    vcov(ww)
                        } )
                } )        
# shorter function
NMIextract( results=res4 , fun=vcov )                               

# apply statistical inference using the NMIcombine function
pres4 <- NMIcombine( qhat=qhat , u=u )                
summary(pres4)

Run the code above in your browser using DataLab