-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
89 lines (68 loc) · 2.05 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rbmiUtils
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
The goal of rbmiUtils is to provide additional functionality to {rbmi} for clinical trial analysis and reporting. This package is currently under development and is not yet available on CRAN.
## Local installation (for beta-testing only)
You can install the latest version of **rbmiUtils** from GitHub:
``` r
if (!require("remotes")) {
install.packages("remotes")
}
remotes::install_github("openpharma/rbmiUtils")
```
After the official release, the package installation will differ.
## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
# Example usage:
library(dplyr)
library(rbmi)
library(rbmiUtils)
data("ADMI")
N_IMPUTATIONS <- 100
BURN_IN <- 200
BURN_BETWEEN <- 5
# Convert key columns to factors
ADMI$TRT <- factor(ADMI$TRT, levels = c("Placebo", "Drug A"))
ADMI$USUBJID <- factor(ADMI$USUBJID)
ADMI$AVISIT <- factor(ADMI$AVISIT)
# Define key variables for ANCOVA analysis
vars <- set_vars(
subjid = "USUBJID",
visit = "AVISIT",
group = "TRT",
outcome = "CHG",
covariates = c("BASE", "STRATA", "REGION") # Covariates for adjustment
)
# Specify the imputation method (Bayesian) - need for pool step
method <- rbmi::method_bayes(
n_samples = N_IMPUTATIONS,
burn_in = BURN_IN,
burn_between = BURN_BETWEEN
)
# Perform ANCOVA Analysis on Each Imputed Dataset
ana_obj_ancova <- analyse_mi_data(
data = ADMI,
vars = vars,
method = method,
fun = ancova, # Apply ANCOVA
delta = NULL # No sensitivity analysis adjustment
)
pool_obj_ancova <- pool(ana_obj_ancova)
tidy_df <- tidy_pool_obj(pool_obj_ancova)
# Print tidy data frames
print(tidy_df)
```