bootImputeAnalyse {bootImpute}R Documentation

Analyse bootstrapped and imputed estimates

Description

Applies the user specified analysis function to each imputed dataset contained in imps, then calculates estimates, confidence intervals and p-values for each parameter, as proposed by von Hippel and Bartlett (2021).

Usage

bootImputeAnalyse(imps, analysisfun, nCores = 1, quiet = FALSE, ...)

Arguments

imps

The list of imputed datasets returned by bootImpute

analysisfun

A function which when applied to a single dataset returns the estimate of the parameter(s) of interest. The dataset to be analysed is passed to analysisfun as its first argument.

nCores

The number of CPU cores to use. If specified greater than one, bootImputeAnalyse will impute using the number of cores specified. The number of bootstrap samples in imps should be divisible by nCores.

quiet

Specify whether to print a table of estimates, confidence intervals and p-values.

...

Other parameters that are to be passed through to analysisfun.

Details

Multiple cores can be used by using the nCores argument, which may be useful for reducing computation times.

Value

A vector containing the point estimate(s), variance estimates, and degrees of freedom.

References

von Hippel PT, Bartlett JW. Maximum likelihood multiple imputation: faster, more efficient imputation without posterior draws. Statistical Science, 2021, 36(3):400-420. doi:10.1214/20-STS793

Examples

library(mice)

set.seed(564764)

#bootstrap twice and impute each twice
#in practice you should bootstrap many more times, e.g. at least 200
imps <- bootMice(ex_linquad, nBoot=2, nImp=2)

#analyse estimates
#write a wapper to analyse an imputed dataset
analyseImp <- function(inputData) {
  coef(lm(y~z+x+xsq,data=inputData))
}
ests <- bootImputeAnalyse(imps, analyseImp)

[Package bootImpute version 1.2.1 Index]