pool: Pool analysis results obtained from the imputed datasets

View source: R/pool.R

poolR Documentation

Pool analysis results obtained from the imputed datasets

Description

Pool analysis results obtained from the imputed datasets

Usage

pool(
  results,
  conf.level = 0.95,
  alternative = c("two.sided", "less", "greater"),
  type = c("percentile", "normal")
)

## S3 method for class 'pool'
as.data.frame(x, ...)

## S3 method for class 'pool'
print(x, ...)

mcse(x, results)

## S3 method for class 'mcse'
as.data.frame(x, ...)

## S3 method for class 'mcse'
print(x, ..., pval_digits = 2, pval_eps = 1e-06, pval_nsmall = 5)

Arguments

results

an analysis object created by analyse().

conf.level

confidence level of the returned confidence interval. Must be a single number between 0 and 1. Default is 0.95.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

type

a character string of either "percentile" (default) or "normal". Determines what method should be used to calculate the bootstrap confidence intervals. See details. Only used if method_condmean(type = "bootstrap") was specified in the original call to draws().

x

a pool object generated by pool().

...

not used.

pval_digits

number of significant digits to print for p-values' MCSE.

pval_eps

the minimum p-values' MCSE to print.

pval_nsmall

the minimum number of digits to print for p-values' MCSE.

Details

The calculation used to generate the point estimate, standard errors and confidence interval depends upon the method specified in the original call to draws(); In particular:

  • method_approxbayes() & method_bayes() both use Rubin's rules to pool estimates and variances across multiple imputed datasets, and the Barnard-Rubin rule to pool degree's of freedom; see Little & Rubin (2002). Here, the mcse() function can compute the Monte Carlo standard error (MCSE) of the pooled estimates, via a Jackknife variance estimator for all parameters; see Efron & Gong (1983) and Royston, Carlin & White (2009).

  • method_condmean(type = "bootstrap") uses percentile or normal approximation; see Efron & Tibshirani (1994). Note that for the percentile bootstrap, no standard error is calculated, i.e. the standard errors will be NA in the object / data.frame.

  • method_condmean(type = "jackknife") uses the standard jackknife variance formula; see Efron & Tibshirani (1994).

  • method_bmlmi uses pooling procedure for Bootstrapped Maximum Likelihood MI (BMLMI). See Von Hippel & Bartlett (2021).

Value

A pool object; a list of class "pool" containing the pooled analysis results with the following elements:

  • pars: a named list with one entry per parameter, each itself a list containing the pooled point estimate (est), confidence interval (ci), standard error (se) and p-value (pvalue).

  • conf.level: the confidence level used for the confidence intervals.

  • alternative: the alternative hypothesis used to derive the p-values.

  • N: the number of analysis results that were combined.

  • method: the pooling method that was used.

The as.data.frame() method returns a data.frame with one row per parameter (columns parameter, est, se, lci, uci, pval) and the print() method returns its input invisibly.

mcse() returns an mcse object; a list of class "mcse" containing pars (the Monte Carlo standard errors of the pooled estimates, in the same structure as the pars element of a pool object) and N (the number of results combined).

References

Bradley Efron and Robert J Tibshirani. An introduction to the bootstrap. CRC press, 1994. [Section 11]

Bradley Efron and Gail Gong. A leisurely look at the bootstrap, the jackknife, and cross-validation. The American Statistician, 37(1):36-48, 1983.

Roderick J. A. Little and Donald B. Rubin. Statistical Analysis with Missing Data, Second Edition. John Wiley & Sons, Hoboken, New Jersey, 2002. [Section 5.4]

Royston, P., Carlin, J. B., & White, I. R. Multiple imputation of missing values: New features for mim. Stata Journal, 9(2): 252-264, 2009.

Von Hippel, Paul T and Bartlett, Jonathan W. Maximum likelihood multiple imputation: Faster imputations and consistent standard errors without posterior draws. 2021.

Examples

# Prepare the data: expand to one row per subject and visit
dat <- expand_locf(
    antidepressant_data,
    PATIENT = levels(antidepressant_data$PATIENT),
    VISIT = levels(antidepressant_data$VISIT),
    vars = c("BASVAL", "THERAPY"),
    group = c("PATIENT"),
    order = c("PATIENT", "VISIT")
)

# Derive data_ice: first missing-outcome visit per patient, imputed under JR.
# Subject 3618 has only an intermittent missing value and is removed.
is_missing <- is.na(dat$CHANGE)
dat_ice <- dat[is_missing, c("PATIENT", "VISIT")]
dat_ice <- dat_ice[!duplicated(dat_ice$PATIENT), ]
dat_ice$strategy <- "JR"
dat_ice <- dat_ice[dat_ice$PATIENT != 3618, ]

vars <- set_vars(
    outcome = "CHANGE",
    visit = "VISIT",
    subjid = "PATIENT",
    group = "THERAPY",
    covariates = c("BASVAL*VISIT", "THERAPY*VISIT")
)


# Approximate Bayesian imputation, so that pooling uses Rubin's rules
set.seed(987)
drawObj <- draws(
    data = dat,
    data_ice = dat_ice,
    vars = vars,
    method = method_approxbayes(n_samples = 20),
    quiet = TRUE
)
imputeObj <- impute(
    drawObj,
    references = c("DRUG" = "PLACEBO", "PLACEBO" = "PLACEBO")
)
anaObj <- analyse(
    imputeObj,
    ancova,
    vars = set_vars(
        subjid = "PATIENT",
        outcome = "CHANGE",
        visit = "VISIT",
        group = "THERAPY",
        covariates = "BASVAL"
    )
)

# Pool the analysis results across the imputed datasets
poolObj <- pool(anaObj)
poolObj

# Monte Carlo standard errors of the pooled estimates
mcse(poolObj, anaObj)


rbmi documentation built on July 23, 2026, 1:08 a.m.