Skip to contents

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"),
  rubin_df_method = c("barnard-rubin", "rubin")
)

# S3 method for class 'pool'
as.data.frame(x, ..., scale = c("auto", "original", "transformed"))

# S3 method for class 'pool'
print(x, ..., scale = c("auto", "original", "transformed"))

mcse(x, results)

# S3 method for class 'mcse'
as.data.frame(x, ..., scale = c("auto", "original", "transformed"))

# S3 method for class 'mcse'
print(
  x,
  ...,
  pval_digits = 2,
  pval_eps = 1e-06,
  pval_nsmall = 5,
  scale = c("auto", "original", "transformed")
)

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().

rubin_df_method

a character string specifying the degrees-of-freedom approximation used when pooling with Rubin's rules. "barnard-rubin" (default) uses the Barnard-Rubin (1999) small-sample adjustment, while "rubin" uses the approximation from Rubin (1987). Ignored for other pooling methods.

x

a pool object generated by pool().

...

not used.

scale

The scale of results returned by as.data.frame.pool() or displayed by print.pool(). Must be "auto" (the default), "original", or "transformed". "auto" uses transformed results when available and original results otherwise.

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.

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).

  • transformed_pars: when analyse(..., transform = ...) was used, a named list of the corresponding transformed results. Point estimates and confidence limits are transformed directly and standard errors use the delta method. The transform$scale label identifies the scale when printing transformed results. The transformation must be monotone over each confidence interval; otherwise pool() errors. P-values are unchanged.

  • 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. When the analysis function attached per-parameter metadata (as ancova() does), as.data.frame() additionally appends the metadata columns (estimate_type, group, group_level_1, group_level_2, visit); the print() method still shows only the six classic columns for a compact display.

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). When a reporting transformation was supplied to analyse(), transformed_pars contains MCSEs computed by applying the same transformation (including its delta-method standard error) to every jackknife replicate.

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. Confidence intervals and p-values use a t distribution with the pooled degrees of freedom for all outcome types, including when the complete-data degrees of freedom are infinite. By default, the Barnard-Rubin (1999) rule is used to pool the degrees of freedom for the t distribution; set rubin_df_method = "rubin" to use the original approximation from Rubin (1987). See Little & Rubin (2002) for more details. 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).

References

John Barnard and Donald B. Rubin. Small-Sample Degrees of Freedom with Multiple Imputation. Biometrika, 86(4):948-955, 1999.

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]

Donald B. Rubin. Multiple Imputation for Nonresponse in Surveys. John Wiley & Sons, New York, 1987. [Section 3.3]

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")
)

# \donttest{
# 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
#> 
#> Pool Object
#> -----------
#> Number of Results Combined: 20
#> Method: rubin
#> Rubin df method: barnard-rubin
#> Confidence Level: 0.95
#> Alternative: two.sided
#> 
#> Results:
#> 
#>   ===============================================================================================================================
#>    parameter   est     se     lci     uci     pval   estimate_type   group   group_level_1  group_level_2  contrast_label  visit 
#>   -------------------------------------------------------------------------------------------------------------------------------
#>      trt_4    -0.092  0.683  -1.439  1.256   0.893     contrast     THERAPY     PLACEBO         DRUG            <NA>         4   
#>    lsm_ref_4  -1.616  0.486  -2.576  -0.656  0.001        lsm       THERAPY      DRUG           <NA>            <NA>         4   
#>    lsm_alt_4  -1.708  0.475  -2.645  -0.77   <0.001       lsm       THERAPY     PLACEBO         <NA>            <NA>         4   
#>      trt_5    1.317   0.945  -0.552  3.185   0.166     contrast     THERAPY     PLACEBO         DRUG            <NA>         5   
#>    lsm_ref_5  -4.127  0.674  -5.459  -2.795  <0.001       lsm       THERAPY      DRUG           <NA>            <NA>         5   
#>    lsm_alt_5  -2.81   0.651  -4.095  -1.525  <0.001       lsm       THERAPY     PLACEBO         <NA>            <NA>         5   
#>      trt_6    1.956   1.02   -0.06   3.973   0.057     contrast     THERAPY     PLACEBO         DRUG            <NA>         6   
#>    lsm_ref_6  -6.122  0.722  -7.55   -4.694  <0.001       lsm       THERAPY      DRUG           <NA>            <NA>         6   
#>    lsm_alt_6  -4.166  0.714  -5.579  -2.752  <0.001       lsm       THERAPY     PLACEBO         <NA>            <NA>         6   
#>      trt_7    2.084   1.122  -0.136  4.303   0.066     contrast     THERAPY     PLACEBO         DRUG            <NA>         7   
#>    lsm_ref_7  -7.058  0.857  -8.761  -5.355  <0.001       lsm       THERAPY      DRUG           <NA>            <NA>         7   
#>    lsm_alt_7  -4.974  0.78   -6.518  -3.43   <0.001       lsm       THERAPY     PLACEBO         <NA>            <NA>         7   
#>   -------------------------------------------------------------------------------------------------------------------------------
#> 

# Monte Carlo standard errors of the pooled estimates
mcse(poolObj, anaObj)
#> 
#> Monte Carlo Standard Errors for Pooled Estimates (mcse Object)
#> -----------
#> Number of Results Combined: 20
#> 
#> Results:
#> 
#>   ===================================================
#>    parameter   est    se     lci    uci      pval    
#>   ---------------------------------------------------
#>      trt_4      0      0      0      0    < 0.000001 
#>    lsm_ref_4    0      0      0      0    < 0.000001 
#>    lsm_alt_4    0      0      0      0    < 0.000001 
#>      trt_5    0.061  0.017  0.076  0.063   0.02205   
#>    lsm_ref_5  0.044  0.011  0.04   0.057  < 0.000001 
#>    lsm_alt_5  0.037  0.008  0.035  0.044  0.0000098  
#>      trt_6    0.074  0.022  0.066  0.104   0.00818   
#>    lsm_ref_6  0.05   0.012  0.06   0.051  < 0.000001 
#>    lsm_alt_6  0.054  0.016  0.054  0.071  < 0.000001 
#>      trt_7    0.088  0.018  0.103  0.087   0.01287   
#>    lsm_ref_7  0.093  0.028  0.099  0.119  < 0.000001 
#>    lsm_alt_7  0.061  0.024  0.089  0.069  < 0.000001 
#>   ---------------------------------------------------
#> 
# }