| Title: | Bayesian Hierarchical Models for Basket Trials |
|---|---|
| Description: | Provides functions for the evaluation of basket trial designs with binary endpoints. Operating characteristics of a basket trial design are assessed by simulating trial data according to scenarios, analyzing the data with Bayesian hierarchical models (BHMs), and assessing decision probabilities on stratum and trial-level based on Go / No-go decision making. The package is build for high flexibility regarding decision rules, number of interim analyses, number of strata, and recruitment. The BHMs proposed by Berry et al. (2013) <doi:10.1177/1740774513497539> and Neuenschwander et al. (2016) <doi:10.1002/pst.1730>, as well as a model that combines both approaches are implemented. Functions are provided to implement Bayesian decision rules as for example proposed by Fisch et al. (2015) <doi:10.1177/2168479014533970>. In addition, posterior point estimates (mean/median) and credible intervals for response rates and some model parameters can be calculated. For simulated trial data, bias and mean squared errors of posterior point estimates for response rates can be provided. |
| Authors: | Stephan Wojciekowski [aut, cre], Tathagata Chattopadhyay [aut] |
| Maintainer: | Stephan Wojciekowski <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.0 |
| Built: | 2026-05-14 09:21:38 UTC |
| Source: | https://github.com/boehringer-ingelheim/bhmbasket |
This function combines prior parameters from different sources and returns them
for use in performAnalyses.
combinePriorParameters(list_of_prior_parameters)combinePriorParameters(list_of_prior_parameters)
list_of_prior_parameters |
A list of items with class |
This function is intended to combine the prior parameters set with the functions
setPriorParametersBerry,
setPriorParametersExNex,
setPriorParametersExNexAdj,
setPriorParametersPooled, or
setPriorParametersStratified,
in case more than one analysis method should be applied with
performAnalyses.
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
performAnalyses
setPriorParametersBerry
setPriorParametersExNex
setPriorParametersExNexAdj
setPriorParametersPooled
setPriorParametersStratified
getPriorParameters
getMuVar
prior_parameters_stratified <- setPriorParametersStratified(c(1, 2), c(3, 4)) prior_parameters_berry <- setPriorParametersBerry(0, 1, 2) prior_parameters_list <- combinePriorParameters( list(prior_parameters_berry, prior_parameters_stratified))prior_parameters_stratified <- setPriorParametersStratified(c(1, 2), c(3, 4)) prior_parameters_berry <- setPriorParametersBerry(0, 1, 2) prior_parameters_list <- combinePriorParameters( list(prior_parameters_berry, prior_parameters_stratified))
This function continues the recruitment of subjects for a set of scenarios based on the Go / NoGo decisions in the simulated trial outcomes of said scenarios.
continueRecruitment(n_subjects_add_list, decisions_list, method_name = NULL)continueRecruitment(n_subjects_add_list, decisions_list, method_name = NULL)
n_subjects_add_list |
A list that contains for each scenario an integer vector for the number of subjects per cohort to be additionally recruited. |
decisions_list |
A list with decisions per scenario created with
|
method_name |
A string for the method name of the analysis the decisions are based on.
Can be |
This function is intended to be used for analyses with the following work flow:simulateScenarios() -> performAnalyses() -> getGoDecisions()-> continueRecruitment() -> performAnalyses() -> getGoDecisions()-> continueRecruitment() -> ...
Note that n_subjects_add_list takes the additional number of subjects to be recruited,
not the overall number of subjects.
This way the work flow can be repeated as often as
required, which can be useful e.g. for interim analyses.
An object of class scenario_list with the scenario data for each specified scenario.
Stephan Wojciekowski
simulateScenarios
performAnalyses
getGoDecisions
interim_scenarios <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) interim_analyses <- performAnalyses( scenario_list = interim_scenarios, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) interim_gos <- getGoDecisions( analyses_list = interim_analyses, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.8, 0.5), boundary_rules = quote(c(x[1] > 0.8, x[2] > 0.6, x[3] > 0.7))) scenarios_list <- continueRecruitment( n_subjects_add_list = list(c(30, 20, 10)), decisions_list = interim_gos, method_name = "exnex_adj")interim_scenarios <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) interim_analyses <- performAnalyses( scenario_list = interim_scenarios, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) interim_gos <- getGoDecisions( analyses_list = interim_analyses, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.8, 0.5), boundary_rules = quote(c(x[1] > 0.8, x[2] > 0.6, x[3] > 0.7))) scenarios_list <- continueRecruitment( n_subjects_add_list = list(c(30, 20, 10)), decisions_list = interim_gos, method_name = "exnex_adj")
This function creates an object of class scenario_list
for a single trial outcome, which can subsequently be analyzed with other functions of
bhmbasket, e.g. performAnalyses
createTrial(n_subjects, n_responders)createTrial(n_subjects, n_responders)
n_subjects |
A vector of integers for the number of subjects in the trial outcome |
n_responders |
A vector of integers for the number of responders in the trial outcome |
This function is a wrapper for simulateScenarios with
simulateScenarios( n_subjects_list = list(n_subjects), response_rates_list = list(n_responders), n_trials = 1)
An object of class scenario_list with the scenario data for a single trial outcome.
Stephan Wojciekowski
simulateScenarios
performAnalyses
trial_outcome <- createTrial(n_subjects = c(10, 20, 30, 40), n_responders = c( 1, 2, 3, 4))trial_outcome <- createTrial(n_subjects = c(10, 20, 30, 40), n_responders = c( 1, 2, 3, 4))
This function calculates the average number of subjects per scenario.
getAverageNSubjects(scenario_list)getAverageNSubjects(scenario_list)
scenario_list |
An object of class |
This function can be useful to assess decision rules with regard to the average number of subjects across scenarios when performing interim analyses.
A named list of vectors for the average number of subjects in each scenario.
Stephan Wojciekowski
simulateScenarios
continueRecruitment
interim_scenarios <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) interim_analyses <- performAnalyses( scenario_list = interim_scenarios, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) interim_gos <- getGoDecisions( analyses_list = interim_analyses, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.8, 0.5), boundary_rules = quote(c(x[1] > 0.8, x[2] > 0.6, x[3] > 0.7))) scenarios_list <- continueRecruitment( n_subjects_add_list = list(c(30, 20, 10)), decisions_list = interim_gos, method_name = "exnex_adj") getAverageNSubjects(scenarios_list)interim_scenarios <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) interim_analyses <- performAnalyses( scenario_list = interim_scenarios, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) interim_gos <- getGoDecisions( analyses_list = interim_analyses, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.8, 0.5), boundary_rules = quote(c(x[1] > 0.8, x[2] > 0.6, x[3] > 0.7))) scenarios_list <- continueRecruitment( n_subjects_add_list = list(c(30, 20, 10)), decisions_list = interim_gos, method_name = "exnex_adj") getAverageNSubjects(scenarios_list)
This function calculates the point estimates and credible intervals per cohort, as well as estimates of the biases and the mean squared errors of the point estimates per cohort.
getEstimates( analyses_list, add_parameters = NULL, point_estimator = "median", alpha_level = 0.05 )getEstimates( analyses_list, add_parameters = NULL, point_estimator = "median", alpha_level = 0.05 )
analyses_list |
An object of class |
add_parameters |
A vector of strings naming additional parameters
from the Bayesian hierarchical models, e.g. |
point_estimator |
A string indicating the type of estimator used for calculation of
bias and MSE. Must be one of |
alpha_level |
A numeric in (0, 1) for the level of the credible interval.
Only values corresponding to quantiles saved in |
Bias and MSE will only be calculated for response rate estimates of simulated trials. For additional parameters, bias and MSE will not be calculated.
Possible additional parameters for the Bayesian hierarchical models are
c('mu', 'tau') for 'berry', 'exnex', 'exnex_mix', 'exnex_adj',
and 'exnex_adj_mix'.
The ExNex-based models can also access posterior weights.
paste0("w_", seq_len(n_cohorts)).
A named list of matrices of estimates of response rates and credible intervals. Estimates of bias and MSE are included for response rate estimates of simulated trials.
Stephan Wojciekowski
createTrial
simulateScenarios
performAnalyses
scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(c(0.1, 0.2, 3)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = c(0.1, 0.1, 0.1), calc_differences = matrix(c(3, 2, 2, 1), ncol = 2), n_mcmc_iterations = 100) getEstimates(analyses_list) getEstimates(analyses_list = analyses_list, add_parameters = c("mu", "tau", "w_1", "w_2", "w_3"), point_estimator = "mean", alpha_level = 0.1) outcome <- createTrial( n_subjects = c(10, 20, 30), n_responders = c( 1, 2, 3)) outcome_analysis <- performAnalyses( scenario_list = outcome, target_rates = c(0.1, 0.1, 0.1), n_mcmc_iterations = 100) getEstimates(outcome_analysis) getEstimates(analyses_list = outcome_analysis, add_parameters = c("mu", "w_1", "w_2", "w_3"))scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(c(0.1, 0.2, 3)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = c(0.1, 0.1, 0.1), calc_differences = matrix(c(3, 2, 2, 1), ncol = 2), n_mcmc_iterations = 100) getEstimates(analyses_list) getEstimates(analyses_list = analyses_list, add_parameters = c("mu", "tau", "w_1", "w_2", "w_3"), point_estimator = "mean", alpha_level = 0.1) outcome <- createTrial( n_subjects = c(10, 20, 30), n_responders = c( 1, 2, 3)) outcome_analysis <- performAnalyses( scenario_list = outcome, target_rates = c(0.1, 0.1, 0.1), n_mcmc_iterations = 100) getEstimates(outcome_analysis) getEstimates(analyses_list = outcome_analysis, add_parameters = c("mu", "w_1", "w_2", "w_3"))
This function applies decision rules to the analyzed trials.
The resulting decision_list can be further processed with
getGoProbabilities or
continueRecruitment.
getGoDecisions( analyses_list, cohort_names, evidence_levels, boundary_rules, overall_min_gos = 1 )getGoDecisions( analyses_list, cohort_names, evidence_levels, boundary_rules, overall_min_gos = 1 )
analyses_list |
An object of class |
cohort_names |
A vector of strings with the names of the cohorts, e.g.
|
evidence_levels |
A vector of numerics in |
boundary_rules |
A quote of a vector for the boundary rules,
|
overall_min_gos |
A positive integer for the minimum number of
cohort-wise go decisions required for an overall go decision
Default: |
This function applies decision rules of the following type to the outcomes of (simulated) basket trials with binary endpoints:
where is the posterior response rate of cohort ,
is the response rate boundary of cohort ,
and is the evidence level.
This rule can equivalently be written as
where is the -quantile of the posterior
response rate of cohort .
The arguments cohort_names and evidence_levels determine
, where the entries of cohort_names and
evidence_levels are matched corresponding to their order.
The argument boundary_rules provides the rules that describe what
should happen with the posterior quantiles .
The first posterior quantile determined by the first items of
cohort_names and evidence_levels is referred to as x[1],
the second as x[2], etc.
Using the quote(c(...))-notation,
many different rules can be implemented.
A decision rule for only one cohort would be
boundary_rules = quote(c(x[1] > 0.1)),
cohort_names = 'p_1', and evidence_levels = 0.5,
which implements the rule .
The number of decisions to be taken must match the number of cohorts, i.e.
for each cohort there must be a decision rule in the vector separated by a comma.
See the example section for a decision rule for more than one cohort and
the example of negateGoDecisions
for the implementation of a more complex decision rule.
An object of class decision_list
Stephan Wojciekowski
performAnalyses
getGoProbabilities
negateGoDecisions
continueRecruitment
scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(c(0.1, 0.1, 0.9)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) ## Decision rule for more than one cohort decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.8), boundary_rules = quote(c(x[1] > 0.7, x[2] < 0.3, x[3] < 0.6))) ## Decision rule for only two of the three cohorts decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_3"), evidence_levels = c(0.5, 0.8), boundary_rules = quote(c(x[1] > 0.7, TRUE, x[3] < 0.6)), overall_min_gos = 2L) ## Different decision rules for each method ## This works the same way for the different evidence_levels decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.8), boundary_rules = list( quote(c(x[1] > 0.1, x[2] < 0.5, x[3] < 0.1)), # "berry" quote(c(x[1] > 0.2, x[2] < 0.4, x[3] < 0.2)), # "exnex" quote(c(x[1] > 0.25, x[2] < 0.35, x[3] < 0.25)), # "exnex_adj" quote(c(x[1] > 0.3, x[2] < 0.3, x[3] < 0.3)), # "exnex_adj_mix" quote(c(x[1] > 0.35, x[2] < 0.25, x[3] < 0.35)), # "exnex_mix" quote(c(x[1] > 0.4, x[2] < 0.2, x[3] < 0.4)), # "pooled" quote(c(x[1] > 0.45, x[2] < 0.15, x[3] < 0.45)), # "stratified" quote(c(x[1] > 0.5, x[2] < 0.1, x[3] < 0.5)) # "stratified_mix" ))scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(c(0.1, 0.1, 0.9)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) ## Decision rule for more than one cohort decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.8), boundary_rules = quote(c(x[1] > 0.7, x[2] < 0.3, x[3] < 0.6))) ## Decision rule for only two of the three cohorts decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_3"), evidence_levels = c(0.5, 0.8), boundary_rules = quote(c(x[1] > 0.7, TRUE, x[3] < 0.6)), overall_min_gos = 2L) ## Different decision rules for each method ## This works the same way for the different evidence_levels decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.8), boundary_rules = list( quote(c(x[1] > 0.1, x[2] < 0.5, x[3] < 0.1)), # "berry" quote(c(x[1] > 0.2, x[2] < 0.4, x[3] < 0.2)), # "exnex" quote(c(x[1] > 0.25, x[2] < 0.35, x[3] < 0.25)), # "exnex_adj" quote(c(x[1] > 0.3, x[2] < 0.3, x[3] < 0.3)), # "exnex_adj_mix" quote(c(x[1] > 0.35, x[2] < 0.25, x[3] < 0.35)), # "exnex_mix" quote(c(x[1] > 0.4, x[2] < 0.2, x[3] < 0.4)), # "pooled" quote(c(x[1] > 0.45, x[2] < 0.15, x[3] < 0.45)), # "stratified" quote(c(x[1] > 0.5, x[2] < 0.1, x[3] < 0.5)) # "stratified_mix" ))
Calculates the Go probabilities for given decisions
getGoProbabilities(go_decisions_list, nogo_decisions_list = NULL)getGoProbabilities(go_decisions_list, nogo_decisions_list = NULL)
go_decisions_list |
An object of class |
nogo_decisions_list |
An object of class |
If only go_decisions_list is provided
(i.e. nogo_decisions_list is NULL),
only Go probabilities will be calculated.
If both go_decisions_list and nogo_decisions_list are provided,
Go, Consider, and NoGo probabilities will be calculated.
A list of matrices of Go (and Consider and NoGo) probabilities
Stephan Wojciekowski
scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20)), response_rates_list = list(rep(0.9, 2)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 2), n_mcmc_iterations = 100) go_decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2"), evidence_levels = c(0.5, 0.8), boundary_rules = quote(c(x[1] > 0.8, x[2] > 0.6))) nogo_decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2"), evidence_levels = c(0.5, 0.8), boundary_rules = quote(c(x[1] < 0.5, x[2] < 0.3))) getGoProbabilities(go_decisions_list) getGoProbabilities(go_decisions_list, nogo_decisions_list)scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20)), response_rates_list = list(rep(0.9, 2)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 2), n_mcmc_iterations = 100) go_decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2"), evidence_levels = c(0.5, 0.8), boundary_rules = quote(c(x[1] > 0.8, x[2] > 0.6))) nogo_decisions_list <- getGoDecisions( analyses_list = analyses_list, cohort_names = c("p_1", "p_2"), evidence_levels = c(0.5, 0.8), boundary_rules = quote(c(x[1] < 0.5, x[2] < 0.3))) getGoProbabilities(go_decisions_list) getGoProbabilities(go_decisions_list, nogo_decisions_list)
This function returns the variance of that is worth a certain number
of subjects for the distribution of the response rates.
getMuVar(response_rate, tau_scale, n_worth = 1)getMuVar(response_rate, tau_scale, n_worth = 1)
response_rate |
A numeric for the response rate |
tau_scale |
A numeric for the scale parameter of the Half-normal distribution of |
n_worth |
An integer for the number of subjects the variance of |
Calculates the variance mu_var in
for n_worth number of observations, as in Neuenschwander et al. (2016).
Returns a numeric for the variance of
Stephan Wojciekowski
Neuenschwander, Beat, et al. "Robust exchangeability designs for early phase clinical trials with multiple strata." Pharmaceutical statistics 15.2 (2016): 123-134.
getMuVar(response_rate = 0.3, tau_scale = 1) getMuVar(response_rate = 0.3, tau_scale = 1, n_worth = 2)getMuVar(response_rate = 0.3, tau_scale = 1) getMuVar(response_rate = 0.3, tau_scale = 1, n_worth = 2)
This function provides default prior parameters for the analysis methods
that can be used in performAnalyses.
getPriorParameters( method_names, target_rates, n_worth = 1, tau_scale = 1, w_j = 0.5 )getPriorParameters( method_names, target_rates, n_worth = 1, tau_scale = 1, w_j = 0.5 )
method_names |
A vector of strings for the names of the methods to be used.
Available methods: |
target_rates |
A vector of numerics in |
n_worth |
An integer for the number of subjects the variability of the prior should reflect
response rate scale, Default: |
tau_scale |
A numeric for the scale parameter of the Half-normal distribution of |
w_j |
A numeric in |
Regarding the default prior parameters for "berry", "exnex", "exnex_mix", "exnex_adj" and "exnex_adj_mix":
"berry": The mean of is set to 0.
Its variance is calculated as proposed in "Robust exchangeability designs for early
phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
with regard to n_worth.
The scale parameter of is set to tau_scale.
"exnex": The weight of the Ex component is set to w_j.
For the Ex component:
The target rate that results in the greatest variance is determined.
The mean of is set to that target rate.
The variance of is calculated as proposed in "Robust exchangeability designs for early
phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
with regard to n_worth.
The scale parameter of is set to tau_scale.
For the Nex components:
The means of are set to the respective target rates.
The variances of are calculated as proposed in "Robust exchangeability designs for early
phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
with regard to n_worth, see also getMuVar.
"exnex_adj": The weight of the Ex component is set to w_j.
For the Ex component:
The target rate that results in the greatest variance is determined.
The mean of is set to 0.
The variance of is calculated as proposed in "Robust exchangeability designs for early
phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
with regard to n_worth, see also getMuVar.
The scale parameter of is set to tau_scale.
For the Nex components:
The means of are set to the 0.
The variances of are calculated as proposed in "Robust exchangeability designs for early
phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
with regard to n_worth, see also getMuVar.
"exnex_mix": Uses the same default Ex prior construction as "exnex".
The Nex part default parameters are specified as a one-component mixture prior with
w_nex = 1, mean_nex = matrix(logit(target_rates), nrow = 1),
and sd_nex = matrix(sqrt(getMuVar(target_rates, 0, n_worth)), nrow = 1).
This keeps the default mixture representation compatible with the getPriorParameter()'s input.
"exnex_adj_mix": Uses the same default Ex prior construction as "exnex_adj".
The Nex part is specified as a one-component mixture prior with
w_nex = 1, mean_nex = matrix(logit(target_rates), nrow = 1),
and sd_nex = matrix(sqrt(getMuVar(target_rates, 0, n_worth)), nrow = 1).
The Ex component is centered as in "exnex_adj".
"pooled": The target rate that results in the greatest variance is determined.
The scale parameter is set to that target rate times n_worth.
The scale parameter is set to 1 - that target rate times n_worth.
"stratified":
The scale parameters are set to target_rates * n_worth.
The scale parameters are set to (1 - target_rates) * n_worth.
"stratified_mix":
A two-component beta mixture prior is created by default for each cohort.
The first component uses a_j = target_rates * n_worth and
b_j = (1 - target_rates) * n_worth.
The second component is a vague prior with a_j = 1 and b_j = 1.
The default mixture weights are c(0.8, 0.2).
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
Berry, Scott M., et al. "Bayesian hierarchical modeling of patient subpopulations: efficient designs of phase II oncology clinical trials." Clinical Trials 10.5 (2013): 720-734.
Neuenschwander, Beat, et al. "Robust exchangeability designs for early phase clinical trials with multiple strata." Pharmaceutical statistics 15.2 (2016): 123-134.
performAnalyses
setPriorParametersBerry
setPriorParametersExNex
setPriorParametersExNexAdj
setPriorParametersPooled
setPriorParametersStratified
setPriorParametersStratifiedMix
combinePriorParameters
getMuVar
prior_parameters_list <- getPriorParameters( method_names = c("berry", "exnex", "exnex_mix", "exnex_adj", "exnex_adj_mix", "pooled", "stratified", "stratified_mix"), target_rates = c(0.1, 0.2, 0.3))prior_parameters_list <- getPriorParameters( method_names = c("berry", "exnex", "exnex_mix", "exnex_adj", "exnex_adj_mix", "pooled", "stratified", "stratified_mix"), target_rates = c(0.1, 0.2, 0.3))
This function returns the inverse logit of the input argument.
invLogit(theta)invLogit(theta)
theta |
A numeric |
This function is an alias for 'stats::binomial()$linkinv'
Inverse logit of theta
Stephan Wojciekowski
invLogit(logit(0.3)) invLogit(c(-Inf, 0, Inf))invLogit(logit(0.3)) invLogit(c(-Inf, 0, Inf))
This function loads an analysis performed with
performAnalyses
loadAnalyses( scenario_numbers, analysis_numbers = rep(1, length(scenario_numbers)), load_path = tempdir() )loadAnalyses( scenario_numbers, analysis_numbers = rep(1, length(scenario_numbers)), load_path = tempdir() )
scenario_numbers |
A (vector of) positive integer(s) for the scenario number(s) |
analysis_numbers |
A (vector of) positive integer(s) for the analysis number(s),
Default: |
load_path |
A string providing a path where the scenarios are being stored,
Default: |
Returns an object of class analysis_list
Stephan Wojciekowski
performAnalyses
saveAnalyses
tempfile
trial_data <- createTrial( n_subjects = c(10, 20, 30), n_responders = c(1, 2, 3)) analysis_list <- performAnalyses( scenario_list = trial_data, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) save_info <- saveAnalyses(analysis_list) analysis_list <- loadAnalyses(scenario_numbers = save_info$scenario_numbers, analysis_numbers = save_info$analysis_numbers, load_path = save_info$path)trial_data <- createTrial( n_subjects = c(10, 20, 30), n_responders = c(1, 2, 3)) analysis_list <- performAnalyses( scenario_list = trial_data, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) save_info <- saveAnalyses(analysis_list) analysis_list <- loadAnalyses(scenario_numbers = save_info$scenario_numbers, analysis_numbers = save_info$analysis_numbers, load_path = save_info$path)
This function loads scenarios saved with saveScenarios
loadScenarios(scenario_numbers, load_path = tempdir())loadScenarios(scenario_numbers, load_path = tempdir())
scenario_numbers |
A vector of integers naming the scenario to be loaded |
load_path |
A string for the directory where the scenarios are being stored,
Default: |
Returns an object of class scenario_list
Stephan Wojciekowski
simulateScenarios
saveScenarios
tempfile
scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) save_info <- saveScenarios(scenarios_list) scenarios_list <- loadScenarios(scenario_numbers = save_info$scenario_numbers, load_path = save_info$path)scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) save_info <- saveScenarios(scenarios_list) scenarios_list <- loadScenarios(scenario_numbers = save_info$scenario_numbers, load_path = save_info$path)
This function returns the logit of the input argument.
logit(p)logit(p)
p |
A numeric in (0, 1) |
This function is an alias for 'stats::binomial()$linkfun'
logit of p
Stephan Wojciekowski
logit(invLogit(0.3)) logit(c(0, 0.5, 1))logit(invLogit(0.3)) logit(c(0, 0.5, 1))
Negates the go decisions derived with
getGoDecisions.
negateGoDecisions(go_decisions_list, overall_min_nogos = "all")negateGoDecisions(go_decisions_list, overall_min_nogos = "all")
go_decisions_list |
An object of class |
overall_min_nogos |
Either a non-negative integer or the string |
This function is intended for implementing decision rules with a consider zone as e.g. proposed in "Bayesian design of proof-of-concept trials" by Fisch et al. (2015). This approach involves two criteria, Significance and Relevance.
Significance: high evidence that the treatment effect is greater than some smaller value (e.g. treatment effect under H0)
Relevance: moderate evidence that the treatment effect is greater than some larger value (e.g. treatment effect under a certain alternative)
The decision for a cohort is then taken as follows:
Go decision: Significance and Relevance
Consider decision: either Significance, or Relevance, but not both
NoGo decision: no Significance and no Relevance
In the example below, the following criteria for are implemented for each of the three cohorts:
Significance:
Relevance:
A list of NoGo decisions of class decision_list
Stephan Wojciekowski
Fisch, Roland, et al. "Bayesian design of proof-of-concept trials." Therapeutic innovation & regulatory science 49.1 (2015): 155-162.
scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) analysis_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) go_decisions_list <- getGoDecisions( analyses_list = analysis_list, cohort_names = c("p_1", "p_2", "p_3", "p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.5, 0.95, 0.95, 0.95), boundary_rules = quote(c(x[1] > 0.8 & x[4] > 0.4, x[2] > 0.8 & x[5] > 0.4, x[3] > 0.8 & x[6] > 0.4))) nogo_decisions <- negateGoDecisions(getGoDecisions( analyses_list = analysis_list, cohort_names = c("p_1", "p_2", "p_3", "p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.5, 0.95, 0.95, 0.95), boundary_rules = quote(c(x[1] > 0.8 | x[4] > 0.4, x[2] > 0.8 | x[5] > 0.4, x[3] > 0.8 | x[6] > 0.4)))) getGoProbabilities(go_decisions_list, nogo_decisions)scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) analysis_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) go_decisions_list <- getGoDecisions( analyses_list = analysis_list, cohort_names = c("p_1", "p_2", "p_3", "p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.5, 0.95, 0.95, 0.95), boundary_rules = quote(c(x[1] > 0.8 & x[4] > 0.4, x[2] > 0.8 & x[5] > 0.4, x[3] > 0.8 & x[6] > 0.4))) nogo_decisions <- negateGoDecisions(getGoDecisions( analyses_list = analysis_list, cohort_names = c("p_1", "p_2", "p_3", "p_1", "p_2", "p_3"), evidence_levels = c(0.5, 0.5, 0.5, 0.95, 0.95, 0.95), boundary_rules = quote(c(x[1] > 0.8 | x[4] > 0.4, x[2] > 0.8 | x[5] > 0.4, x[3] > 0.8 | x[6] > 0.4)))) getGoProbabilities(go_decisions_list, nogo_decisions)
This function performs the analysis of simulated or observed trial data with the specified methods and returns the quantiles of the posterior response rates
performAnalyses( scenario_list, evidence_levels = c(0.025, 0.05, 0.5, 0.8, 0.9, 0.95, 0.975), method_names = c("berry", "exnex", "exnex_mix", "exnex_adj", "exnex_adj_mix", "pooled", "stratified", "stratified_mix"), target_rates = NULL, prior_parameters_list = NULL, calc_differences = NULL, n_mcmc_iterations = 10000, n_cores = 1, seed = 1, verbose = TRUE )performAnalyses( scenario_list, evidence_levels = c(0.025, 0.05, 0.5, 0.8, 0.9, 0.95, 0.975), method_names = c("berry", "exnex", "exnex_mix", "exnex_adj", "exnex_adj_mix", "pooled", "stratified", "stratified_mix"), target_rates = NULL, prior_parameters_list = NULL, calc_differences = NULL, n_mcmc_iterations = 10000, n_cores = 1, seed = 1, verbose = TRUE )
scenario_list |
An object of class |
evidence_levels |
A vector of numerics in |
method_names |
A vector of strings for the names of the methods to be used. Must
be one of the default values, Default:
|
target_rates |
A vector of numerics in |
prior_parameters_list |
An object of class |
calc_differences |
A matrix of positive integers with 2 columns.
For each row the differences will be calculated.
Also a vector of positive integers can be provided for a single difference.
The integers are the numbers for the cohorts to be subtracted from one another.
E.g. providing |
n_mcmc_iterations |
A positive integer for the number of MCMC iterations,
see Details, Default: |
n_cores |
Argument is deprecated and does nothing as of version 0.9.3.
A positive integer for the number of cores for the parallelization,
Default: |
seed |
Argument is deprecated and does nothing as of version 0.9.3.
A numeric for the random seed, Default: |
verbose |
A logical indicating whether messages should be printed, Default: |
This function applies the following analysis models to (simulated) scenarios of class
scenario_list:
Bayesian hierarchical model (BHM) proposed by Berry et al. (2013): "berry"
BHM proposed by Neuenschwander et al. (2016): "exnex"
BHM that combines above approaches: "exnex_adj"
Pooled beta-binomial approach: "pooled"
Stratified beta-binomial approach: "stratified"
BHM with mixture prior on the Nex component: "exnex_mix"
Adjusted BHM with mixture prior on the Nex component: "exnex_adj_mix"
Stratified beta-binomial approach with mixture beta prior: "stratified_mix"
The posterior distributions of the BHMs are approximated with Markov chain Monte Carlo (MCMC)
methods implemented in JAGS.
Two independent chains are used with each n_mcmc_iterations number of MCMC iterations.
The first floor(n_mcmc_iterations / 3) number of iterations are discarded as burn-in period.
No thinning is applied.
Note that the value for n_mcmc_iterations required for a good approximation of the posterior
distributions depends on the analysis model, the investigated scenarios, and the use case.
The default value might be a good compromise between run-time and approximation for
the estimation of decision probabilities, but
it should definitively be increased for the analysis of a single trial's outcome.
The analysis models will only be applied to the unique trial realizations across
all simulated scenarios.
The models can be applied in parallel by registering a parallel backend for the 'foreach'
framework, e.g. with doFuture::registerDoFuture() and future::plan(future::multisession).
The parallelization is nested, so that the resources of a HPC environment can be used
efficiently.
For more on this topic, kindly see the respective vignette.
The tasks that are to be performed in parallel are chunked according to the number of workers
determined with foreach::getDoParWorkers().
The JAGS code for the BHM "exnex" was taken from Neuenschwander et al. (2016).
The JAGS code for the BHM "exnex_adj" is based on the JAGS code for "exnex".
The JAGS code for the BHM "exnex_mix" extends the "exnex" model by using
a mixture prior for the Nex component.
The JAGS code for the BHM "exnex_adj_mix" extends the "exnex_adj" model by using
a mixture prior for the Nex component.
An object of class analysis_list.
Stephan Wojciekowski
Berry, Scott M., et al. "Bayesian hierarchical modeling of patient subpopulations: efficient designs of phase II oncology clinical trials." Clinical Trials 10.5 (2013): 720-734.
Neuenschwander, Beat, et al. "Robust exchangeability designs for early phase clinical trials with multiple strata." Pharmaceutical statistics 15.2 (2016): 123-134.
Plummer, Martyn. "JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling." Proceedings of the 3rd international workshop on distributed statistical computing. Vol. 124. No. 125.10. 2003.
simulateScenarios
createTrial
getPriorParameters
trial_data <- createTrial( n_subjects = c(10, 20, 30), n_responders = c(1, 2, 3)) analysis_list <- performAnalyses( scenario_list = trial_data, target_rates = rep(0.5, 3), calc_differences = matrix(c(3, 2, 1, 1), ncol = 2), n_mcmc_iterations = 100)trial_data <- createTrial( n_subjects = c(10, 20, 30), n_responders = c(1, 2, 3)) analysis_list <- performAnalyses( scenario_list = trial_data, target_rates = rep(0.5, 3), calc_differences = matrix(c(3, 2, 1, 1), ncol = 2), n_mcmc_iterations = 100)
This function saves an object of class analysis_list
saveAnalyses(analyses_list, save_path = tempdir(), analysis_numbers = NULL)saveAnalyses(analyses_list, save_path = tempdir(), analysis_numbers = NULL)
analyses_list |
An object of class |
save_path |
A string for the path where the scenarios are being stored,
Default: |
analysis_numbers |
A positive integer naming the analysis number.
If |
A named list of length 3 of vectors with scenario and analysis numbers and
the save_path
Stephan Wojciekowski
performAnalyses
loadAnalyses
tempfile
trial_data <- createTrial( n_subjects = c(10, 20, 30), n_responders = c(1, 2, 3)) analysis_list <- performAnalyses( scenario_list = trial_data, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) save_info <- saveAnalyses(analysis_list) analysis_list <- loadAnalyses(scenario_numbers = save_info$scenario_numbers, analysis_numbers = save_info$analysis_numbers, load_path = save_info$path)trial_data <- createTrial( n_subjects = c(10, 20, 30), n_responders = c(1, 2, 3)) analysis_list <- performAnalyses( scenario_list = trial_data, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) save_info <- saveAnalyses(analysis_list) analysis_list <- loadAnalyses(scenario_numbers = save_info$scenario_numbers, analysis_numbers = save_info$analysis_numbers, load_path = save_info$path)
Saves the scenario data in a newly created or existing directory
saveScenarios(scenario_list, save_path = tempdir())saveScenarios(scenario_list, save_path = tempdir())
scenario_list |
An object of class |
save_path |
A string providing the path of the directory in which the scenario data
should be saved, Default: |
A named list of length 2 with the scenario numbers and the save_path
Stephan Wojciekowski
simulateScenarios
loadScenarios
tempfile
scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) save_info <- saveScenarios(scenarios_list) scenarios_list <- loadScenarios(scenario_numbers = save_info$scenario_numbers, load_path = save_info$path)scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(rep(0.9, 3)), n_trials = 10) save_info <- saveScenarios(scenarios_list) scenarios_list <- loadScenarios(scenario_numbers = save_info$scenario_numbers, load_path = save_info$path)
This function applies scaling and rounding to each item of a list of numerics
scaleRoundList(list, scale_param = 1, round_digits = NULL)scaleRoundList(list, scale_param = 1, round_digits = NULL)
list |
The list to which the scaling and rounding should be applied to. |
scale_param |
A numeric for the scaling of each item of the list, Default: '1' |
round_digits |
An integer for the number of digits. If 'NULL', no rounding will be applied, Default: 'NULL' |
A list of scaled and rounded numerics
Stephan Wojciekowski
some_list <- as.list(runif(5)) scaleRoundList(some_list, scale_param = 100, round_digits = 2) scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(c(0.1, 0.2, 0.3)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) scaleRoundList( list = getEstimates(analyses_list), scale_param = 100, round_digits = 2)some_list <- as.list(runif(5)) scaleRoundList(some_list, scale_param = 100, round_digits = 2) scenarios_list <- simulateScenarios( n_subjects_list = list(c(10, 20, 30)), response_rates_list = list(c(0.1, 0.2, 0.3)), n_trials = 10) analyses_list <- performAnalyses( scenario_list = scenarios_list, target_rates = rep(0.5, 3), n_mcmc_iterations = 100) scaleRoundList( list = getEstimates(analyses_list), scale_param = 100, round_digits = 2)
This function sets prior parameters for the analysis method "berry"
for use in performAnalyses.
setPriorParametersBerry(mu_mean, mu_sd, tau_scale)setPriorParametersBerry(mu_mean, mu_sd, tau_scale)
mu_mean |
A numeric for the mean of |
mu_sd |
A positive numeric for the standard deviation of |
tau_scale |
A positive numeric for the scale parameter of |
This function sets the prior parameters for the method proposed by Berry et al. (2013).
Note that the implemented distribution of is half-normal.
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
Berry, Scott M., et al. "Bayesian hierarchical modeling of patient subpopulations: efficient designs of phase II oncology clinical trials." Clinical Trials 10.5 (2013): 720-734.
performAnalyses
getPriorParameters
combinePriorParameters
setPriorParametersExNex
setPriorParametersExNexAdj
setPriorParametersPooled
setPriorParametersStratified
getMuVar
prior_parameters_berry <- setPriorParametersBerry(0, 1, 2)prior_parameters_berry <- setPriorParametersBerry(0, 1, 2)
This function sets prior parameters for the analysis method "exnex"
for use in performAnalyses.
It supports two specifications for the Nex part:
the standard ExNex specification with cohort-specific Nex priors via mu_j and tau_j
an extended specification with a mixture prior on the Nex part via w_nex, mean_nex, and sd_nex
setPriorParametersExNex( mu_mean, mu_sd, tau_scale, mu_j = NULL, tau_j = NULL, w_j, w_nex = NULL, mean_nex = NULL, sd_nex = NULL )setPriorParametersExNex( mu_mean, mu_sd, tau_scale, mu_j = NULL, tau_j = NULL, w_j, w_nex = NULL, mean_nex = NULL, sd_nex = NULL )
mu_mean |
A numeric for the mean of |
mu_sd |
A positive numeric for the standard deviation of |
tau_scale |
A positive numeric for the scale parameter of |
mu_j |
A vector of numerics for the means |
tau_j |
A vector of positive numerics for the standard deviations |
w_j |
A numeric in |
w_nex |
An optional numeric vector of mixture weights in |
mean_nex |
An optional numeric matrix of Nex mixture means with one row per Nex mixture component and one column per cohort. |
sd_nex |
An optional positive numeric matrix of Nex mixture standard deviations with one row per Nex mixture component and one column per cohort. |
This function sets the prior parameters for the method proposed by Neuenschwander et al. (2016).
If w_nex, mean_nex, and sd_nex are all NULL, the standard ExNex formulation is used.
Otherwise, the Nex part is specified as a finite mixture prior.
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
Neuenschwander, Beat, et al. "Robust exchangeability designs for early phase clinical trials with multiple strata." Pharmaceutical statistics 15.2 (2016): 123-134.
performAnalyses
getPriorParameters
combinePriorParameters
setPriorParametersBerry
setPriorParametersExNexAdj
setPriorParametersPooled
setPriorParametersStratified
getMuVar
## standard ExNex prior_parameters_exnex <- setPriorParametersExNex( mu_mean = 0, mu_sd = 1, tau_scale = 2, mu_j = c(4, 5), tau_j = c(6, 7), w_j = 0.8 ) ## ExNex with Nex mixture prior prior_parameters_exnex_mix <- setPriorParametersExNex( mu_mean = 0, mu_sd = 1, tau_scale = 2, w_j = 0.8, w_nex = c(0.7, 0.3), mean_nex = rbind(c(4, 5), c(2, 3)), sd_nex = rbind(c(6, 7), c(8, 9)) )## standard ExNex prior_parameters_exnex <- setPriorParametersExNex( mu_mean = 0, mu_sd = 1, tau_scale = 2, mu_j = c(4, 5), tau_j = c(6, 7), w_j = 0.8 ) ## ExNex with Nex mixture prior prior_parameters_exnex_mix <- setPriorParametersExNex( mu_mean = 0, mu_sd = 1, tau_scale = 2, w_j = 0.8, w_nex = c(0.7, 0.3), mean_nex = rbind(c(4, 5), c(2, 3)), sd_nex = rbind(c(6, 7), c(8, 9)) )
This function sets prior parameters for the analysis method "exnex_adj"
for use in performAnalyses.
It supports two specifications for the Nex part:
the standard ExNex Adjusted specification with cohort-specific Nex priors via mu_j and tau_j
an extended specification with a mixture prior on the Nex part via w_nex, mean_nex, and sd_nex
setPriorParametersExNexAdj( mu_mean, mu_sd, tau_scale, mu_j = NULL, tau_j = NULL, w_j, w_nex = NULL, mean_nex = NULL, sd_nex = NULL )setPriorParametersExNexAdj( mu_mean, mu_sd, tau_scale, mu_j = NULL, tau_j = NULL, w_j, w_nex = NULL, mean_nex = NULL, sd_nex = NULL )
mu_mean |
numeric Mean of |
mu_sd |
numeric Positive standard deviation of |
tau_scale |
numeric Positive scale parameter of |
mu_j |
numeric Vector of means |
tau_j |
numeric Vector of positive standard deviations |
w_j |
numeric Weight of the Ex component in |
w_nex |
numeric Optional vector of mixture weights in |
mean_nex |
numeric Optional matrix of Nex mixture means with one row per Nex mixture component and one column per cohort. |
sd_nex |
numeric Optional positive matrix of Nex mixture standard deviations with one row per Nex mixture component and one column per cohort. |
This function sets prior parameters for the ExNex Adjusted method, which combines
the approach proposed by Neuenschwander et al. (2016) and the approach proposed by
Berry et al. (2013). If w_nex, mean_nex, and sd_nex are all NULL, the standard
ExNex Adjusted formulation is used. Otherwise, the Nex part is specified as a finite
mixture prior.
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
Neuenschwander, Beat, et al. "Robust exchangeability designs for early phase clinical trials with multiple strata." Pharmaceutical statistics 15.2 (2016): 123-134.
performAnalyses
getPriorParameters
combinePriorParameters
setPriorParametersBerry
setPriorParametersExNex
setPriorParametersPooled
setPriorParametersStratified
getMuVar
## standard ExNex Adjusted prior_parameters_exnex_adj <- setPriorParametersExNexAdj( mu_mean = 0, mu_sd = 1, tau_scale = 2, mu_j = c(4, 5), tau_j = c(6, 7), w_j = 0.8 ) ## ExNex Adjusted with Nex mixture prior prior_parameters_exnex_adj_mix <- setPriorParametersExNexAdj( mu_mean = 0, mu_sd = 1, tau_scale = 2, w_j = 0.8, w_nex = c(0.7, 0.3), mean_nex = rbind(c(0, 0), c(-1, -1)), sd_nex = rbind(c(6, 7), c(8, 9)) )## standard ExNex Adjusted prior_parameters_exnex_adj <- setPriorParametersExNexAdj( mu_mean = 0, mu_sd = 1, tau_scale = 2, mu_j = c(4, 5), tau_j = c(6, 7), w_j = 0.8 ) ## ExNex Adjusted with Nex mixture prior prior_parameters_exnex_adj_mix <- setPriorParametersExNexAdj( mu_mean = 0, mu_sd = 1, tau_scale = 2, w_j = 0.8, w_nex = c(0.7, 0.3), mean_nex = rbind(c(0, 0), c(-1, -1)), sd_nex = rbind(c(6, 7), c(8, 9)) )
This function sets prior parameters for the analysis method "pooled"
for use in performAnalyses.
setPriorParametersPooled(a, b)setPriorParametersPooled(a, b)
a |
A positive numeric for |
b |
A positive numeric for |
The method "pooled" is a beta-binomial model that pools all cohorts.
The prior parameters are the scale parameters of the beta prior distribution.
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
performAnalyses
getPriorParameters
combinePriorParameters
setPriorParametersBerry
setPriorParametersExNex
setPriorParametersExNexAdj
setPriorParametersStratified
getMuVar
prior_parameters_pooled <- setPriorParametersPooled(1, 2)prior_parameters_pooled <- setPriorParametersPooled(1, 2)
This function sets prior parameters for the analysis method "stratified"
for use in performAnalyses.
setPriorParametersStratified(a_j, b_j)setPriorParametersStratified(a_j, b_j)
a_j |
A vector of positive numerics for |
b_j |
A vector of positive numerics for |
The method "stratified" is a beta-binomial model that assesses each cohort individually.
The prior parameters are the scale parameters of the beta prior distributions.
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
performAnalyses
getPriorParameters
combinePriorParameters
setPriorParametersBerry
setPriorParametersExNex
setPriorParametersExNexAdj
setPriorParametersPooled
getMuVar
prior_parameters_pooled <- setPriorParametersStratified(c(1, 2), c(3, 4))prior_parameters_pooled <- setPriorParametersStratified(c(1, 2), c(3, 4))
This function sets prior parameters for the analysis method "stratified_mix"
for use in performAnalyses.
setPriorParametersStratifiedMix(w, a_j, b_j)setPriorParametersStratifiedMix(w, a_j, b_j)
w |
A numeric vector of mixture weights in |
a_j |
A positive numeric matrix of beta shape parameters |
b_j |
A positive numeric matrix of beta shape parameters |
The method "stratified_mix" is a beta-binomial model that assesses each cohort
individually with a finite mixture beta prior.
See also the R package RBesT.
A list with prior parameters of class prior_parameters_list
Stephan Wojciekowski
performAnalyses
getPriorParameters
combinePriorParameters
setPriorParametersStratified
prior_parameters_stratified_mix <- setPriorParametersStratifiedMix( w = c(0.8, 0.2), a_j = rbind(c(2, 3), c(1, 1)), b_j = rbind(c(8, 7), c(1, 1)) )prior_parameters_stratified_mix <- setPriorParametersStratifiedMix( w = c(0.8, 0.2), a_j = rbind(c(2, 3), c(1, 1)), b_j = rbind(c(8, 7), c(1, 1)) )
This function creates scenarios for the analysis with
performAnalyses.
simulateScenarios( n_subjects_list, response_rates_list, scenario_numbers = seq_along(response_rates_list), n_trials = 10000 )simulateScenarios( n_subjects_list, response_rates_list, scenario_numbers = seq_along(response_rates_list), n_trials = 10000 )
n_subjects_list |
A list that contains for each scenario a vector for the number of subjects per cohort. A single vector can be provided if all scenarios should have the same number of subjects. |
response_rates_list |
A list that contains for each scenario a vector for the response rates per cohort. |
scenario_numbers |
A vector of positive integers naming the scenarios,
Default: |
n_trials |
An integer indicating the number of trial simulations per response rates,
Default: |
The function simulates trials with binary outcome for each scenario. Integer values for the response rates will be treated as observed outcomes.
An object of class scenario_list with the scenario data for each specified scenario.
Stephan Wojciekowski
saveScenarios
createTrial
performAnalyses
n_subjects <- c(10, 20, 30) rr_negative <- rep(0.1, 3) rr_nugget <- c(0.9, 0.1, 0.1) rr_positive <- rep(0.9, 3) scenarios_list <- simulateScenarios( n_subjects_list = list(n_subjects, n_subjects, n_subjects), response_rates_list = list(rr_negative, rr_nugget, rr_positive))n_subjects <- c(10, 20, 30) rr_negative <- rep(0.1, 3) rr_nugget <- c(0.9, 0.1, 0.1) rr_positive <- rep(0.9, 3) scenarios_list <- simulateScenarios( n_subjects_list = list(n_subjects, n_subjects, n_subjects), response_rates_list = list(rr_negative, rr_nugget, rr_positive))