https://github.com/openpharma/rbmiutils
Repository for the development of the rbmiUtils package which extends the {rbmi} package for use within clinical trials.
https://github.com/openpharma/rbmiutils
multiple-imputation r rbmi
Last synced: 3 months ago
JSON representation
Repository for the development of the rbmiUtils package which extends the {rbmi} package for use within clinical trials.
- Host: GitHub
- URL: https://github.com/openpharma/rbmiutils
- Owner: openpharma
- License: gpl-3.0
- Created: 2024-11-06T12:36:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-12T08:41:00.000Z (about 1 year ago)
- Last Synced: 2024-12-12T09:19:47.100Z (about 1 year ago)
- Topics: multiple-imputation, r, rbmi
- Language: R
- Homepage:
- Size: 921 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)

[](https://github.com/openpharma/rbmiUtils/actions/workflows/R-CMD-check.yaml)
[](https://github.com/openpharma/rbmiUtils/actions/workflows/test-coverage.yaml)
`rbmiUtils` extends the functionality of [`rbmi`](https://github.com/insightsengineering/rbmi) to support more streamlined workflows for multiple imputation in clinical trials. It is designed to simplify key tasks such as analysis execution, pooling, result tidying, and imputed data handling.
## Table of Contents
* [Installation](#installation)
* [Example](#example)
* [Dataset](#dataset)
* [Utilities](#utilities)
* [Development Status](#development-status)
## Installation
You can install the package from cran or the development version of `rbmiUtils` from GitHub:
Type | Source | Command
---|---|---
Release | CRAN | `install.packages("rbmiUtils")`
Development | GitHub | `remotes::install_github("openpharma/rbmiUtils")`
## Example
This example shows how to run a covariate-adjusted ANCOVA on imputed datasets using Bayesian multiple imputation:
```{r example, message = FALSE, warning = FALSE}
library(dplyr)
library(rbmi)
library(rbmiUtils)
data("ADMI")
# Setup
N_IMPUTATIONS <- 100
WARMUP <- 200
THIN <- 5
# Preprocessing
ADMI <- ADMI %>%
mutate(
TRT = factor(TRT, levels = c("Placebo", "Drug A")),
USUBJID = factor(USUBJID),
AVISIT = factor(AVISIT)
)
# Define analysis variables
vars <- set_vars(
subjid = "USUBJID",
visit = "AVISIT",
group = "TRT",
outcome = "CHG",
covariates = c("BASE", "STRATA", "REGION")
)
# Specify imputation method
method <- rbmi::method_bayes(
n_samples = N_IMPUTATIONS,
control = rbmi::control_bayes(
warmup = WARMUP,
thin = THIN
)
)
# Run analysis
ana_obj <- analyse_mi_data(
data = ADMI,
vars = vars,
method = method,
fun = ancova
)
# Pool results and tidy
pool_obj <- pool(ana_obj)
tidy_df <- tidy_pool_obj(pool_obj)
# View results
print(tidy_df)
```
## Datasets
The package includes two example datasets for demonstrating imputation and analysis:
* `ADEFF`: An example efficacy dataset for with missing data.
* `ADMI`: A large multiple imputation dataset with 100,000 rows and multiple visits, treatment arms, and stratification variables.
Use `?ADEFF` and `?ADMI` to view full dataset documentation.
## Utilities
Key exported functions include:
* `analyse_mi_data()`: Applies an analysis function (e.g., ANCOVA) to all imputed datasets.
* `tidy_pool_obj()`: Tidies and annotates pooled results for reporting.
* `get_imputed_data()`: Extracts long-format imputed datasets with original subject IDs mapped.
These utilities wrap standard `rbmi` workflows for improved reproducibility and interpretability.
## Development Status
This package is experimental and under active development. Feedback and contributions are welcome via [GitHub issues](https://github.com/openpharma/rbmiUtils/issues) or pull requests.