MyNixOS website logo
Description

Utility Functions to Support and Extend the 'rbmi' Package.

Provides utility functions that extend the capabilities of the reference-based multiple imputation package 'rbmi'. It supports clinical trial analysis workflows with functions for managing imputed datasets, applying analysis methods across imputations, and tidying results for reporting.

rbmiUtils rbmiUtils website

Lifecycle:experimental CRAN status R-CMD-check test-coverage

rbmiUtils bridges rbmi analysis results into publication-ready regulatory tables and forest plots. It extends rbmi for clinical trial workflows, providing additional utilities from data validation, storing imputed data sets, through to formatted efficacy outputs.

Installation

You can install the package from CRAN or the development version from GitHub:

TypeSourceCommand
ReleaseCRANinstall.packages("rbmiUtils")
DevelopmentGitHubremotes::install_github("openpharma/rbmiUtils")

Quick Start

rbmiUtils provides additional support for the rbmi pipeline from raw data to publication-ready outputs. Here is an example workflow to illustrate these utilities using the bundled ADEFF dataset:

library(rbmiUtils)
library(rbmi)
library(dplyr)

# Load example efficacy dataset and prepare factors
data("ADEFF", package = "rbmiUtils")
ADEFF <- ADEFF |>
  mutate(
    TRT = factor(TRT01P, levels = c("Placebo", "Drug A")),
    USUBJID = factor(USUBJID),
    AVISIT = factor(AVISIT, levels = c("Week 24", "Week 48"))
  )

# Define analysis variables
vars <- set_vars(
  subjid = "USUBJID",
  visit = "AVISIT",
  group = "TRT",
  outcome = "CHG",
  covariates = c("BASE", "STRATA", "REGION")
)

# Configure Bayesian imputation method
method <- method_bayes(
  n_samples = 100,
  control = control_bayes(warmup = 200, thin = 2)
)

# Step 1: Fit imputation model (draws)
dat <- ADEFF |> select(USUBJID, STRATA, REGION, TRT, BASE, CHG, AVISIT)
draws_obj <- draws(data = dat, vars = vars, method = method)

# Step 2: Generate imputed datasets
impute_obj <- impute(
  draws_obj,
  references = c("Placebo" = "Placebo", "Drug A" = "Placebo")
)

# Step 3: Extract stacked imputed data
ADMI <- get_imputed_data(impute_obj)

# Modification of the complete data is possible (i.e. collapsing variables).

# Step 4: Analyse each imputed dataset
ana_obj <- analyse_mi_data(data = ADMI, vars = vars, method = method, fun = ancova)

# Step 5: Pool results using Rubin's rules
pool_obj <- pool(ana_obj)

# Publication-ready table
efficacy_table(pool_obj, arm_labels = c(ref = "Placebo", alt = "Drug A"))
Efficacy Table

See the end-to-end pipeline vignette for the complete walkthrough from raw data to these outputs.

Key Features

  • validate_data() – pre-flight checks on data structure before imputation
  • analyse_mi_data() – run ANCOVA (or custom analysis) across all imputations
  • tidy_pool_obj() – tidy pooled results with visit-level annotations
  • efficacy_table() – regulatory-style gt tables (ICH Table 14.2.x format)
  • plot_forest() – three-panel forest plots with estimates, CIs, and p-values
  • pool_to_ard() – convert pool objects to pharmaverse ARD format with optional MI diagnostic enrichment (FMI, lambda, RIV)
  • get_imputed_data() – extract long-format imputed datasets
  • describe_draws() – inspect draws objects (method, samples, convergence diagnostics)
  • describe_imputation() – inspect imputation objects (method, M, missingness breakdown)
  • format_pvalue() / format_estimate() – publication-ready formatting

Learn More

Development Status

This package is experimental and under active development. Feedback and contributions are welcome via GitHub issues or pull requests.

Metadata

Version

0.3.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows