Type: Package
Title: Trial Design in Respiratory Disease Based on the Win Probability
Version: 0.1.0
Description: Provides analysis results and trial simulation functions for the I-SPY Acute Respiratory Disease Syndrome trial based on composite ranked outcomes. The composite ranked outcome is a hierarchical outcome where trial participants are ranked first by 28 day mortality, then ventilator days, then by advanced respiratory support days. A Bayesian win probability approach is used for analysis. Trial design options include group sequential looks for safety, superiority, futility, and adjustment of randomization probabilities.
License: GPL-2
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
Imports: DFBA
NeedsCompilation: no
Packaged: 2025-09-10 21:05:33 UTC; a.chapple
Author: Andrew G Chapple [aut, cre], Andrew Chapple [ctb], Peter Norwood [ctb], Martin Eklund [ctb], Derek Russell [ctb], Phil Beineke [ctb], Quantum Leap Healthcare Collaborative [ctb, cph]
Maintainer: Andrew G Chapple <a.chapple@qlhc.org>
Depends: R (≥ 3.5.0)
Repository: CRAN
Date/Publication: 2025-09-15 09:10:25 UTC

Example of a non-parametric density estimate of advanced respiratory days in participants who were never ventilated used for simulation.

Description

This R object contains a non-parametric Gaussian kernal density estimate of the advanced ventilator days for participants who are never ventilated. It is truncated between 1-28 days. Users can mimic this using any density() object on the range 1-27. Simulation functions that use these objects automatically truncate to 1-27 and round sampled values.

Usage

CONTROL_ADVANCED_DISTRIBUTION_NO_VENT

Format

A density() object for generating advanced respiratory days for non-ventilated participants between 1 and 28 days.

x

Points where nonparametric density has density estimates.

y

Density estimate at each point in x.

...


Example of a non-parametric density estimate of advanced respiratory days in participants who were ventilated used for simulation.

Description

This R object contains a non-parametric Gaussian kernal density estimate of the advanced ventilator days for participants who are never ventilated. It is truncated between 1-(28 minus ventilator days) days. Users can mimic this using any density() object on the range 1-27. Simulation functions that use these objects automatically truncate to 1-27 and round sampled values.

Usage

CONTROL_ADVANCED_DISTRIBUTION_VENT

Format

A density() object for generating advanced respiratory days for ventilated participants between 1 and 28 days.

x

Points where nonparametric density has density estimates.

y

Density estimate at each point in x.

...


Example of a non-parametric density estimate of ventilator days used for simulation.

Description

This R object contains a non-parametric Gaussian kernal density estimate of the ventilator day distribution for participants with ventilator days between 1 and 27 days. Users can mimic this using any density() object on the range 1-27. Simulation functions that use these objects automatically truncate to 1-27 and round sampled values.

Usage

CONTROL_VENT_DENSITY_NON_0_28

Format

A density() object for generating ventilator days between 1 and 27 days.

x

Points where nonparametric density has density estimates.

y

Density estimate at each point in x.

...


Example of dataset used for the I-SPY ARDS win hierarchy

Description

This data contains a dummy example of data from a trial that can be used for the I-SPY ARDS composite win ranking approach. This is what participant data may look like at a given interim look in the group sequential trial.

Usage

Example_Data

Format

A data frame with 247 rows and 4 columns:

Treatment

Binary Treatment Indicator

Time_To_Death

Time to death for each participant. Should be NA if a participant does not die.

Days_On_Ventilator

Days on ventilator for each participant. This is counted as the number of days from the start of ventilation until the last extubation date (or day 28).

Days_On_Advanced_O2

Days on advanced respiratory support for each participant. This is counted as the total number of days on advanced respiratory support within 28 days.

...


Provides analysis results related to the I-SPY ARDS composite ranking.

Description

Provides analysis results related to the I-SPY ARDS composite ranking.

Usage

Get_ARDS_Win_Probability(
  TRT,
  Time_To_Death,
  Days_On_Ventilator,
  Days_On_Advanced_O2
)

Arguments

TRT

Treatment vs control indicator Vector (1s and 0s).

Time_To_Death

Vector containing time to death for participants from study entry.

Days_On_Ventilator

Vector containing the number of days on ventilator for participants within the first 28 days of study enrollment. The I-SPY ARDS trial counts days on ventilator as the number of days from study entry until the day that ventilator is discontinued for good in the first 28 days.

Days_On_Advanced_O2

Vector containing the number of days that each participant was on advanced respiratory support within the first 28 days of study enrollment.

Value

A list of 4 results based on the hierarchical composite ARDS ranking including: (1) The posterior probability and p-value used for graduation, (2) The Bayesian Wilcoxon/Mann-Whitney U test results along with posterior summaries on the Win Probability, (3) Frequentist summaries of the Win Probability, Win Ratio, and 2 sided Wilcoxon P-value, and (4) Component-wise interpretation of the composite win-ranking. This includes frequentist comparisons of the 28 day mortality rate, ventilator days in survivors, how many ties there were based on mortality and ventilation, and the advanced respiratory day distribution in tied patients.

Examples

###load("Example_ARDS.rda")
library(DFBA)
Get_ARDS_Win_Probability(Example_Data$Treatment,Example_Data$Time_To_Death,
Example_Data$Days_On_Ventilator,Example_Data$Days_On_Advanced_O2)

Gives the true win probability, mean ventilator days, and advanced respiratory days for a set of simulation parameters.

Description

Gives the true win probability, mean ventilator days, and advanced respiratory days for a set of simulation parameters.

Usage

Get_True_Win_Probability(
  Prob_Death,
  P_Vent_28,
  P_Vent_0,
  CONTROL_VENT_DENSITY_NON_0_28,
  P_ADVANCED_0_NO_VENT,
  CONTROL_ADVANCED_DISTRIBUTION_NO_VENT,
  P_ADVANCED_0_VENT,
  CONTROL_ADVANCED_DISTRIBUTION_VENT,
  Prob_Death_Treatment,
  P_Vent_28_Treatment,
  P_Vent_0_Treatment,
  CHANGE_MEAN_VENTILATION_TREATMENT,
  P_ADVANCED_0_NO_VENT_Treatment,
  CHANGE_MEAN_ADVANCED_TREATMENT_NO_VENT,
  P_ADVANCED_0_VENT_Treatment,
  CHANGE_MEAN_ADVANCED_TREATMENT_VENT
)

Arguments

Prob_Death

Probability of death within 28 days for control patients.

P_Vent_28

Probability of being ventilated for 28 days or more in control participants who do not die in 28 days.

P_Vent_0

Probability of being ventilated for 0 days in control participants who do not die in 28 days.

CONTROL_VENT_DENSITY_NON_0_28

Nonparametric density estimate of ventilator days between 1 and 27 days for control participants who do not die in 28 days.

P_ADVANCED_0_NO_VENT

Probability of 0 advanced respiratory days in control participants who did not die in 28 days and are never ventilated.

CONTROL_ADVANCED_DISTRIBUTION_NO_VENT

Nonparametric density estimate of advanced respiratory days between 1 and 28 days for control participants who do not die in 28 days and are never ventilated.

P_ADVANCED_0_VENT

Probability of 0 advanced respiratory days in control participants who did not die in 28 days and are ventilated.

CONTROL_ADVANCED_DISTRIBUTION_VENT

Nonparametric density estimate of advanced respiratory days between 1 and 28 days for control participants who do not die in 28 days and are never ventilated.

Prob_Death_Treatment

Probability of death within 28 days for treatment patients.

P_Vent_28_Treatment

Probability of being ventilated for 28 days or more in treatment participants who do not die in 28 days.

P_Vent_0_Treatment

Probability of being ventilated for 0 days in treatment participants who do not die in 28 days.

CHANGE_MEAN_VENTILATION_TREATMENT

Shift in the nonparametric density estimate of ventilator days between 1 and 27 for treatment patients relative to controls in those who did not die in 28 days.

P_ADVANCED_0_NO_VENT_Treatment

Probability of 0 advanced respiratory days in treatment participants who did not die in 28 days and are never ventilated.

CHANGE_MEAN_ADVANCED_TREATMENT_NO_VENT

Shift in the nonparametric density estimate of advanced respiratory days between 1 and 28 for treatment patients relative to controls in those who do not die in 28 days and are never ventilated.

P_ADVANCED_0_VENT_Treatment

Probability of 0 advanced respiratory days in treatment participants who did not die in 28 days and are ventilated.

CHANGE_MEAN_ADVANCED_TREATMENT_VENT

Shift in the nonparametric density estimate of advanced respiratory days between 1 and 28 for treatment patients relative to controls in those who do not die in 28 days and are ventilated.

Value

A vector containing the true win probability of a scenario. It also returns the implied mean ventilator days in treatment and control participants and the implied mean advanced respiratory days.

Examples

##Load in the nonparametric densities
##load("Control_Ventilator_Non0_28_Density.rda")
##load("Control_Advanced_Distribution_No_Ventilated.rda")
##load("Control_Advanced_Distribution_Ventilated.rda")
library(DFBA)
###Control Parameters
Prob_Death=.25
P_Vent_0 = .48
P_Vent_28 = .05
P_ADVANCED_0_NO_VENT = .31
P_ADVANCED_0_VENT = .62
###Treatment Parameters
Prob_Death_Treatment = Prob_Death-.05
P_Vent_28_Treatment = P_Vent_28-.01
P_Vent_0_Treatment = P_Vent_0 + .1
CHANGE_MEAN_VENTILATION_TREATMENT = -2
P_ADVANCED_0_NO_VENT_Treatment = P_ADVANCED_0_NO_VENT + .1
CHANGE_MEAN_ADVANCED_TREATMENT_NO_VENT = -2
P_ADVANCED_0_VENT_Treatment = P_ADVANCED_0_VENT + .1
CHANGE_MEAN_ADVANCED_TREATMENT_VENT = -2
Get_True_Win_Probability(Prob_Death,P_Vent_28,P_Vent_0,CONTROL_VENT_DENSITY_NON_0_28,
P_ADVANCED_0_NO_VENT,CONTROL_ADVANCED_DISTRIBUTION_NO_VENT,
P_ADVANCED_0_VENT,CONTROL_ADVANCED_DISTRIBUTION_VENT,
Prob_Death_Treatment,P_Vent_28_Treatment,P_Vent_0_Treatment,CHANGE_MEAN_VENTILATION_TREATMENT,
P_ADVANCED_0_NO_VENT_Treatment,CHANGE_MEAN_ADVANCED_TREATMENT_NO_VENT,
P_ADVANCED_0_VENT_Treatment,CHANGE_MEAN_ADVANCED_TREATMENT_VENT)

Provides operating characteristics for a group sequential design using the I-SPY ARDS hierarchical composite ranked endpoint and gating strategy with gating strategy and Bayesian Wilcoxon Rank-Sum test.

Description

Provides operating characteristics for a group sequential design using the I-SPY ARDS hierarchical composite ranked endpoint and gating strategy with gating strategy and Bayesian Wilcoxon Rank-Sum test.

Usage

Sim_ARDS_Win_Probability(
  CONTROL_TRUTH,
  CONTROL_VENT_DENSITY_NON_0_28,
  CONTROL_ADVANCED_DISTRIBUTION_NO_VENT,
  CONTROL_ADVANCED_DISTRIBUTION_VENT,
  TREATMENT_TRUTH,
  N_LOOK,
  cut_Wilcox,
  cut_gating,
  SAFETY_BOUND,
  Futility_BOUND,
  cut_AR,
  Num_Sims
)

Arguments

CONTROL_TRUTH

List containing control simulation parameters for (1) Mortality, (2) Ventilator day distributions in survivors, and (3) advanced respiratory days in survivors.

CONTROL_VENT_DENSITY_NON_0_28

Nonparametric density estimate of ventilator days between 1 and 27 days for control participants who do not die in 28 days.

CONTROL_ADVANCED_DISTRIBUTION_NO_VENT

Nonparametric density estimate of advanced respiratory days between 1 and 28 days for control participants who do not die in 28 days and are never ventilated.

CONTROL_ADVANCED_DISTRIBUTION_VENT

Nonparametric density estimate of advanced respiratory days between 1 and 28 days for control participants who do not die in 28 days and are never ventilated.

TREATMENT_TRUTH

List containing treatment simulation parameters for (1) Mortality, (2) Ventilator day distributions in survivors, and (3) advanced respiratory days in survivors.

N_LOOK

Sample size at interim looks

cut_Wilcox

Superiority cutoffs for Bayesian Wilcoxon.

cut_gating

Superiority cutoffs for Frequentist 1-sided Fisher test.

SAFETY_BOUND

Safety threshold for a mortality increase in treatment participants.

Futility_BOUND

Bounds for stopping for futility based on Bayesian Wilcoxon.

cut_AR

Windows for AR truncation. Randomization probabilities are truncated between .5-cut_AR and .5+cut_AR.

Num_Sims

Number of Simulations to run.

Value

A list containing the true simulation scenario, the design parameters, and the operating characteristics of the design. Operating characteristics include the graduation probability (i.e. power), the sample size distribution, and the joint distribution of graduation and sample size.

Examples

####Set up simulation scenario example
##These are example nonparametric densities for ventilator days
##and advanced respiratory day distributions conditional on ventilation
## load("CONTROL_ADVANCED_DISTRIBUTION_NO_VENT.rda")
## load("CONTROL_ADVANCED_DISTRIBUTION_VENT.rda")
## load("CONTROL_VENT_DENSITY_NON_0_28.rda")
library(DFBA)
###Additional simulation parameters in control arm
Prob_Death=.25
P_Vent_0 = .48
P_Vent_28 = .05
P_ADVANCED_0_NO_VENT = .31
P_ADVANCED_0_VENT = .62
###Treatment Parameters
Prob_Death_Treatment = Prob_Death-.05
P_Vent_28_Treatment = P_Vent_28-.01
P_Vent_0_Treatment = P_Vent_0 + .1
CHANGE_MEAN_VENTILATION_TREATMENT = -2
P_ADVANCED_0_NO_VENT_Treatment = P_ADVANCED_0_NO_VENT + .1
CHANGE_MEAN_ADVANCED_TREATMENT_NO_VENT = -2
P_ADVANCED_0_VENT_Treatment = P_ADVANCED_0_VENT + .1
CHANGE_MEAN_ADVANCED_TREATMENT_VENT = -2
###Put all the parameters in a list
CONTROL_TRUTH = as.list(rep(NA,8))
names(CONTROL_TRUTH)=c("Probability of Death","Prob Vent at day 28 in survivors",
"Prob Vent for 0 days in survivors",
"Nonparametric density estimate of day 1-27 ventilation day in survivors",
"Prob of 0 day advanced respiratory support in
  non-ventilated surviving participants",
"Nonparametric density estimate of day 1-28 advanced respiratory
 days in non-ventilated surviving participants",
"Prob of 0 day advanced respiratory support in
 ventilated surviving participants",
"Nonparametric density estimate of day 1-28 advanced
respiratory days in ventilated surviving participants")
CONTROL_TRUTH[[1]] = Prob_Death
CONTROL_TRUTH[[2]] = P_Vent_28
CONTROL_TRUTH[[3]] = P_Vent_0
CONTROL_TRUTH[[4]] = CONTROL_VENT_DENSITY_NON_0_28
CONTROL_TRUTH[[5]] = P_ADVANCED_0_NO_VENT
CONTROL_TRUTH[[6]] = CONTROL_ADVANCED_DISTRIBUTION_NO_VENT
CONTROL_TRUTH[[7]] = P_ADVANCED_0_VENT
CONTROL_TRUTH[[8]] = CONTROL_ADVANCED_DISTRIBUTION_VENT
###Put treatment simulation truth in a matrix
TREATMENT_TRUTH = as.list(rep(NA,8))
names(TREATMENT_TRUTH)=c("Probability of Death",
"Prob Vent at day 28 in survivors",
"Prob Vent for 0 days in survivors",
"Shift in Nonparametric density estimate of
 day 1-27 ventilation day in survivors",
"Prob of 0 day advanced respiratory support
 in non-ventilated surviving participants",
"Shift in Nonparametric density estimate of day 1-28
advanced respiratory days in non-ventilated surviving participants",
"Prob of 0 day advanced respiratory support in
 ventilated surviving participants",
"Shift in Nonparametric density estimate of day 1-28
 advanced respiratory days in ventilated surviving participants")
TREATMENT_TRUTH[[1]] = Prob_Death_Treatment
TREATMENT_TRUTH[[2]] = P_Vent_28_Treatment
TREATMENT_TRUTH[[3]] = P_Vent_0_Treatment
TREATMENT_TRUTH[[4]] = CHANGE_MEAN_VENTILATION_TREATMENT
TREATMENT_TRUTH[[5]] = P_ADVANCED_0_NO_VENT_Treatment
TREATMENT_TRUTH[[6]] = CHANGE_MEAN_ADVANCED_TREATMENT_NO_VENT
TREATMENT_TRUTH[[7]] = P_ADVANCED_0_VENT_Treatment
TREATMENT_TRUTH[[8]] = CHANGE_MEAN_ADVANCED_TREATMENT_VENT

###Setting up decision boundaries
#If NA, this means no interim decision at that look
N_LOOK = c(200,400,600,800)     ##Sample size at interim looks
cut_Wilcox = c(NA,.98,.95,.9)   ##Superiority cutoffs for Bayesian Wilcoxon
cut_gating = c(NA,.02,.02,.05)  ##Superiority cutoffs for Frequentist 1-sided Fisher test
SAFETY_BOUND = c(.1,NA,NA,NA)   ##Safety threshold for a mortality increase
Futility_BOUND = c(.5,.6,.7,NA) ##Bounds for stopping for futility based on Bayesian Wilcoxon
cut_AR = c(.2,.2,.2,.2)         ##Windows for AR truncation
Sim_ARDS_Win_Probability(CONTROL_TRUTH,CONTROL_VENT_DENSITY_NON_0_28,
CONTROL_ADVANCED_DISTRIBUTION_NO_VENT,
CONTROL_ADVANCED_DISTRIBUTION_VENT,
 TREATMENT_TRUTH,N_LOOK,
cut_Wilcox,cut_gating,SAFETY_BOUND, Futility_BOUND,cut_AR,  50)