Title: | Simulation-Based Calculation of Basket Trial Operating Characteristics |
---|---|
Description: | Provides a unified syntax for the simulation-based comparison of different single-stage basket trial designs with a binary endpoint and equal sample sizes in all baskets. Methods include the designs by Baumann et al. (2024) <doi:10.48550/arXiv.2309.06988>, Fujikawa et al. (2020) <doi:10.1002/bimj.201800404>, Berry et al. (2020) <doi:10.1177/1740774513497539>, Neuenschwander et al. (2016) <doi:10.1002/pst.1730> and Psioda et al. (2021) <doi:10.1093/biostatistics/kxz014>. For the latter three designs, the functions are mostly wrappers for functions provided by the packages 'bhmbasket' and 'bmabasket'. |
Authors: | Lukas Baumann [aut, cre] , Lukas Sauer [ctb] |
Maintainer: | Lukas Baumann <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.0 |
Built: | 2024-11-10 03:44:35 UTC |
Source: | https://github.com/lbau7/basksim |
Adjust Lambda
adjust_lambda(design, ...)
adjust_lambda(design, ...)
design |
An object created with one of the |
... |
Further arguments. |
The default method for adjust_lambda
uses a combination
of uniroot
and grid search and calls toer
in every iteration. For methods implemented in the bhmbasket
package
there are separate methods that are computationally more efficient.
A list containing the greatest estimated value for lambda
with
prec_digits
decimal places which controls the family wise error rate
at level alpha
(one-sided) and the estimated family wise error rate
for the estimated lambda
.
design <- setup_cpp(k = 3, p0 = 0.2) adjust_lambda(design = design, n = 20, alpha = 0.05, design_params = list(tune_a = 1, tune_b = 1), iter = 1000)
design <- setup_cpp(k = 3, p0 = 0.2) adjust_lambda(design = design, n = 20, alpha = 0.05, design_params = list(tune_a = 1, tune_b = 1), iter = 1000)
Adjust Lambda for the BHM Design
## S3 method for class 'bhm' adjust_lambda( design, n, p1 = NULL, alpha = 0.05, design_params = list(), iter = 1000, n_mcmc = 10000, prec_digits = 3, data = NULL, ... )
## S3 method for class 'bhm' adjust_lambda( design, n, p1 = NULL, alpha = 0.05, design_params = list(), iter = 1000, n_mcmc = 10000, prec_digits = 3, data = NULL, ... )
design |
An object created with one of the |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
alpha |
The one-sided significance level. |
design_params |
A list of params that is specific to the class of
|
iter |
The number of iterations in the simulation. Is ignored if
|
n_mcmc |
Number of MCMC samples. |
prec_digits |
Number of decimal places that are considered when adjusting lambda. |
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the greatest estimated value for lambda
with
prec_digits
decimal places which controls the family wise error rate
at level alpha
(one-sided) and the estimated family wise error rate
for the estimated lambda
.
design <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5) adjust_lambda(design = design, n = 15, design_params = list(tau_scale = 1), iter = 100, n_mcmc = 5000)
design <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5) adjust_lambda(design = design, n = 15, design_params = list(tau_scale = 1), iter = 100, n_mcmc = 5000)
Adjust Lambda
## Default S3 method: adjust_lambda( design, n, p1 = NULL, alpha = 0.05, design_params = list(), iter = 1000, prec_digits = 3, data = NULL, ... )
## Default S3 method: adjust_lambda( design, n, p1 = NULL, alpha = 0.05, design_params = list(), iter = 1000, prec_digits = 3, data = NULL, ... )
design |
An object created with one of the |
n |
The sample size per basket. |
p1 |
Probabilities under the alternative hypothesis. If |
alpha |
The one-sided significance level. |
design_params |
A list of params that is specific to the class of
|
iter |
The number of iterations in the simulation. Is ignored if
|
prec_digits |
Number of decimal places that are considered when adjusting lambda. |
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
It is recommended to use data
and then use the same simulated
data set for all further calculations. If data = NULL
then
new data is generated in each step of the algorithm, so lambda
doesn't
necessarily protect the family wise error rate for different simulated data
due to Monte Carlo simulation error.
A list containing the greatest estimated value for lambda
with
prec_digits
decimal places which controls the family wise error rate
at level alpha
(one-sided) and the estimated family wise error rate
for the estimated lambda
.
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) adjust_lambda(design = design, n = 20, alpha = 0.05, design_params = list(epsilon = 2, tau = 0), iter = 1000)
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) adjust_lambda(design = design, n = 20, alpha = 0.05, design_params = list(epsilon = 2, tau = 0), iter = 1000)
Adjust Lambda for the EXNEX Design
## S3 method for class 'exnex' adjust_lambda( design, n, p1 = NULL, alpha = 0.05, design_params = list(), iter = 1000, n_mcmc = 10000, prec_digits = 3, data = NULL, ... )
## S3 method for class 'exnex' adjust_lambda( design, n, p1 = NULL, alpha = 0.05, design_params = list(), iter = 1000, n_mcmc = 10000, prec_digits = 3, data = NULL, ... )
design |
An object created with one of the |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
alpha |
The one-sided significance level. |
design_params |
A list of params that is specific to the class of
|
iter |
The number of iterations in the simulation. Is ignored if
|
n_mcmc |
Number of MCMC samples. |
prec_digits |
Number of decimal places that are considered when adjusting lambda. |
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the greatest estimated value for lambda
with
prec_digits
decimal places which controls the family wise error rate
at level alpha
(one-sided) and the estimated family wise error rate
for the estimated lambda
.
design <- setup_exnex(k = 3, p0 = 0.2) adjust_lambda(design = design, n = 15, design_params = list(tau_scale = 1, w = 0.5), iter = 100, n_mcmc = 5000)
design <- setup_exnex(k = 3, p0 = 0.2) adjust_lambda(design = design, n = 15, design_params = list(tau_scale = 1, w = 0.5), iter = 100, n_mcmc = 5000)
Calculate the Expected Number of Correct Decisions for a Basket Trial Design
ecd( design, n, p1, lambda, design_params = list(), iter = 1000, data = NULL, ... )
ecd( design, n, p1, lambda, design_params = list(), iter = 1000, data = NULL, ... )
design |
An object created with one of the |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
design_params |
A list of params that is specific to the class of
|
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A numeric value.
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) ecd(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, design_params = list(epsilon = 2, tau = 0), iter = 1000)
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) ecd(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, design_params = list(epsilon = 2, tau = 0), iter = 1000)
Simulate Data Based on a Binomial Distribution
get_data(k, n, p, iter, type = c("matrix", "bhmbasket"))
get_data(k, n, p, iter, type = c("matrix", "bhmbasket"))
k |
The number of baskets. |
n |
The sample size per basket. |
p |
Probabilities used to simulate the data |
iter |
The number of iterations in the simulation. Is ignored if
|
type |
Type of output. Use |
For type = "bhmbasket"
this is simply a wraper for
bhmbasket::simulateScenarios
.
If type = "matrix"
then a matrix is returned, if
type = "bhmbasket"
then an element with class scenario_list
.
get_data(k = 3, n = 20, p = c(0.2, 0.2, 0.5), iter = 1000)
get_data(k = 3, n = 20, p = c(0.2, 0.2, 0.5), iter = 1000)
Get Details of a Basket Trial Simulation
get_details(design, ...)
get_details(design, ...)
design |
An object created with one of the |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors of all baskets and the family-wise error rate. For some methods the mean limits of HDI intervals are also returned.
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
Get Details of a BHM Basket Trial Simulation
## S3 method for class 'bhm' get_details( design, n, p1 = NULL, lambda, level = 0.95, tau_scale, iter = 1000, n_mcmc = 10000, data = NULL, ... )
## S3 method for class 'bhm' get_details( design, n, p1 = NULL, lambda, level = 0.95, tau_scale, iter = 1000, n_mcmc = 10000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
tau_scale |
Standard deviation of the half normal prior distribution for the variance of the thetas. |
iter |
The number of iterations in the simulation. Is ignored if
|
n_mcmc |
Number of MCMC samples. |
data |
An object of class |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate.
design <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, iter = 100)
design <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, iter = 100)
Get Details of a BMA Basket Trial Simulation
## S3 method for class 'bma' get_details(design, n, p1 = NULL, lambda, pmp0, iter = 1000, data = NULL, ...)
## S3 method for class 'bma' get_details(design, n, p1 = NULL, lambda, pmp0, iter = 1000, data = NULL, ...)
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
pmp0 |
Power parameter that is used to compute prior probabilities. See
|
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, and mean squared errors for all baskets as well as the family-wise error rate.
design <- setup_bma(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = 0.5, lambda = 0.95, pmp0 = 1, iter = 100)
design <- setup_bma(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = 0.5, lambda = 0.95, pmp0 = 1, iter = 100)
Get Details of a Basket Trial Simulation with the Calibrated Power Prior Design
## S3 method for class 'cpp' get_details( design, n, p1 = NULL, lambda, level = 0.95, tune_a, tune_b, iter = 1000, data = NULL, ... )
## S3 method for class 'cpp' get_details( design, n, p1 = NULL, lambda, level = 0.95, tune_a, tune_b, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
tune_a |
First tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
tune_b |
Second tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate.
design <- setup_cpp(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, iter = 100)
design <- setup_cpp(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, iter = 100)
Get Details of a Basket Trial Simulation with the Global Calibrated Power Prior Design
## S3 method for class 'cppglobal' get_details( design, n, p1 = NULL, lambda, level = 0.95, tune_a, tune_b, epsilon, iter = 1000, data = NULL, ... )
## S3 method for class 'cppglobal' get_details( design, n, p1 = NULL, lambda, level = 0.95, tune_a, tune_b, epsilon, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
tune_a |
First tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
tune_b |
Second tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
epsilon |
Tuning parameter that determines the amount of borrowing based on overall heterogeneity. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate.
design <- setup_cppglobal(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, epsilon = 2, iter = 100)
design <- setup_cppglobal(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, epsilon = 2, iter = 100)
Get Details of a Basket Trial Simulation with the EXNEX Design
## S3 method for class 'exnex' get_details( design, n, p1 = NULL, lambda, level = 0.95, tau_scale, w, iter = 1000, n_mcmc = 10000, data = NULL, ... )
## S3 method for class 'exnex' get_details( design, n, p1 = NULL, lambda, level = 0.95, tau_scale, w, iter = 1000, n_mcmc = 10000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
tau_scale |
Standard deviation of the half normal prior exchangeability distribution for the variance of the thetas. |
w |
Fixed prior weight for the exchangeability part of the model. |
iter |
The number of iterations in the simulation. Is ignored if
|
n_mcmc |
Number of MCMC samples. |
data |
An object of class |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate.
design <- setup_exnex(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, w = 0.5, iter = 100)
design <- setup_exnex(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, w = 0.5, iter = 100)
Get Details of a Basket Trial Simulation with Fujikawa's Design
## S3 method for class 'fujikawa' get_details( design, n, p1 = NULL, lambda, level = 0.95, epsilon, tau, logbase = 2, iter = 1000, data = NULL, ... )
## S3 method for class 'fujikawa' get_details( design, n, p1 = NULL, lambda, level = 0.95, epsilon, tau, logbase = 2, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
epsilon |
Tuning parameter that determines the amount of borrowing.
See |
tau |
Tuning parameter that determines how similar the baskets
have to be that information is shared. See |
logbase |
Tuning parameter. The base of the logarithm that is used to calculate the Jensen-Shannon divergence. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate and the experiment-wise power.
design <- setup_fujikawa(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
design <- setup_fujikawa(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
Get Details of a Basket Trial Simulation with the Power Prior Design Based on Global JSD Weights
## S3 method for class 'jsdglobal' get_details( design, n, p1 = NULL, lambda, level = 0.95, eps_pair, tau = 0, eps_all, logbase = 2, iter = 1000, data = NULL, ... )
## S3 method for class 'jsdglobal' get_details( design, n, p1 = NULL, lambda, level = 0.95, eps_pair, tau = 0, eps_all, logbase = 2, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
eps_pair |
Tuning parameter that determines the amount of borrowing based on pairwise similarity. |
tau |
Tuning parameter that determines how similar the baskets have to be that information is shared. |
eps_all |
Tuning parameter that determines the amount of borrowing based on overall heterogeneity. |
logbase |
Tuning parameter. The base of the logarithm that is used to calculate the Jensen-Shannon divergence. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate.
design <- setup_jsdglobal(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, eps_pair = 2, eps_all = 2, iter = 100)
design <- setup_jsdglobal(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, eps_pair = 2, eps_all = 2, iter = 100)
Get Details of a Basket Trial Simulation with the MML Design
## S3 method for class 'mml' get_details( design, n, p1 = NULL, lambda, level = 0.95, iter = 1000, data = NULL, ... )
## S3 method for class 'mml' get_details( design, n, p1 = NULL, lambda, level = 0.95, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate.
design <- setup_mml(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, iter = 100)
design <- setup_mml(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, iter = 100)
Get Details of a Basket Trial Simulation with the Global MML Design
## S3 method for class 'mmlglobal' get_details( design, n, p1 = NULL, lambda, level = 0.95, iter = 1000, data = NULL, ... )
## S3 method for class 'mmlglobal' get_details( design, n, p1 = NULL, lambda, level = 0.95, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
level |
Level of the credibility intervals. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A list containing the rejection probabilites, posterior means, mean squared errors and mean limits of HDI intervals for all baskets as well as the family-wise error rate.
design <- setup_mmlglobal(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = 0.5, lambda = 0.95, iter = 100)
design <- setup_mmlglobal(k = 3, p0 = 0.2) get_details(design = design, n = 20, p1 = 0.5, lambda = 0.95, iter = 100)
Get Results for Simulation of Basket Trial Designs
get_results(design, ...)
get_results(design, ...)
design |
An object created with one of the |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
Get Results for Simulation of a Basket Trial with the BHM Design
## S3 method for class 'bhm' get_results( design, n, p1 = NULL, lambda, tau_scale, iter = 1000, n_mcmc = 10000, data = NULL, ... )
## S3 method for class 'bhm' get_results( design, n, p1 = NULL, lambda, tau_scale, iter = 1000, n_mcmc = 10000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
tau_scale |
Standard deviation of the half normal prior distribution for the variance of the thetas. |
iter |
The number of iterations in the simulation. Is ignored if
|
n_mcmc |
Number of MCMC samples. |
data |
An object of class |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, iter = 100)
design <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, iter = 100)
Get Results for Simulation of a Basket Trial with the BMA Design
## S3 method for class 'bma' get_results(design, n, p1 = NULL, lambda, pmp0, iter = 1000, data = NULL, ...)
## S3 method for class 'bma' get_results(design, n, p1 = NULL, lambda, pmp0, iter = 1000, data = NULL, ...)
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
pmp0 |
Power parameter that is used to compute prior probabilities. See
|
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_bma(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, pmp0 = 1, iter = 100)
design <- setup_bma(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, pmp0 = 1, iter = 100)
Get Results for Simulation of a Basket Trial with a Calibrated Power Prior Design
## S3 method for class 'cpp' get_results( design, n, p1 = NULL, lambda, tune_a, tune_b, iter = 1000, data = NULL, ... )
## S3 method for class 'cpp' get_results( design, n, p1 = NULL, lambda, tune_a, tune_b, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
tune_a |
First tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
tune_b |
Second tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_cpp(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, iter = 100)
design <- setup_cpp(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, iter = 100)
Get Results for Simulation of a Basket Trial with a Global Calibrated Power Prior Design
## S3 method for class 'cppglobal' get_results( design, n, p1 = NULL, lambda, tune_a, tune_b, epsilon, iter = 1000, data = NULL, ... )
## S3 method for class 'cppglobal' get_results( design, n, p1 = NULL, lambda, tune_a, tune_b, epsilon, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
tune_a |
First tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
tune_b |
Second tuning parameter that determines the amount of borrowing based on pairwise similarity between baskets. |
epsilon |
Tuning parameter that determines the amount of borrowing based on overall heterogeneity. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_cppglobal(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, epsilon = 2, iter = 100)
design <- setup_cppglobal(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tune_a = 1, tune_b = 1, epsilon = 2, iter = 100)
Get Results for Simulation of a Basket Trial with the EXNEX Design
## S3 method for class 'exnex' get_results( design, n, p1 = NULL, lambda, tau_scale, w, iter = 1000, n_mcmc = 10000, data = NULL, ... )
## S3 method for class 'exnex' get_results( design, n, p1 = NULL, lambda, tau_scale, w, iter = 1000, n_mcmc = 10000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
tau_scale |
Standard deviation of the half normal prior exchangeability distribution for the variance of the thetas. |
w |
Fixed prior weight for the exchangeability part of the model. |
iter |
The number of iterations in the simulation. Is ignored if
|
n_mcmc |
Number of MCMC samples. |
data |
An object of class |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_exnex(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, w = 0.5, iter = 100)
design <- setup_exnex(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, tau_scale = 1, w = 0.5, iter = 100)
Get Results for Simulation of a Basket Trial with Fujikawa's Design
## S3 method for class 'fujikawa' get_results( design, n, p1 = NULL, lambda, epsilon, tau, logbase = 2, iter = 1000, data = NULL, ... )
## S3 method for class 'fujikawa' get_results( design, n, p1 = NULL, lambda, epsilon, tau, logbase = 2, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
epsilon |
Tuning parameter that determines the amount of borrowing.
See |
tau |
Tuning parameter that determines how similar the baskets
have to be that information is shared. See |
logbase |
Tuning parameter. The base of the logarithm that is used to calculate the Jensen-Shannon divergence. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_fujikawa(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
design <- setup_fujikawa(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, epsilon = 2, tau = 0, iter = 100)
Get Results for Simulation of a Basket Trial with the Power Prior Design Based on Global JSD Weights
## S3 method for class 'jsdglobal' get_results( design, n, p1 = NULL, lambda, eps_pair, tau = 0, eps_all, logbase = 2, iter = 1000, data = NULL, ... )
## S3 method for class 'jsdglobal' get_results( design, n, p1 = NULL, lambda, eps_pair, tau = 0, eps_all, logbase = 2, iter = 1000, data = NULL, ... )
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
eps_pair |
Tuning parameter that determines the amount of borrowing based on pairwise similarity. |
tau |
Tuning parameter that determines how similar the baskets have to be that information is shared. |
eps_all |
Tuning parameter that determines the amount of borrowing based on overall heterogeneity. |
logbase |
Tuning parameter. The base of the logarithm that is used to calculate the Jensen-Shannon divergence. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_jsdglobal(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, eps_pair = 2, eps_all = 2, iter = 100)
design <- setup_jsdglobal(k = 3, p0 = 0.2) get_results(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, eps_pair = 2, eps_all = 2, iter = 100)
Get Results for Simulation of a Basket Trial with the MML Design
## S3 method for class 'mml' get_results(design, n, p1 = NULL, lambda, iter = 1000, data = NULL, ...)
## S3 method for class 'mml' get_results(design, n, p1 = NULL, lambda, iter = 1000, data = NULL, ...)
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_mml(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, iter = 100)
design <- setup_mml(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, iter = 100)
Get Results for Simulation of a Basket Trial with the Global MML Design
## S3 method for class 'mmlglobal' get_results(design, n, p1 = NULL, lambda, iter = 1000, data = NULL, ...)
## S3 method for class 'mmlglobal' get_results(design, n, p1 = NULL, lambda, iter = 1000, data = NULL, ...)
design |
An object of class |
n |
The sample size per basket. |
p1 |
Probabilities used for the simulation. If |
lambda |
The posterior probability threshold. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A matrix of results with iter
rows. A 0 means, that the
null hypothesis that the response probability exceeds p0
was not
rejected, a 1 means, that the null hypothesis was rejected.
design <- setup_mmlglobal(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, iter = 100)
design <- setup_mmlglobal(k = 3, p0 = 0.2) get_results(design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, iter = 100)
Creates a default scenario matrix.
get_scenarios(design, p1)
get_scenarios(design, p1)
design |
An object created with one of the |
p1 |
Probability under the alternative hypothesis. |
get_scenarios
creates a default scenario matrix
that can be used for opt_design
. The function creates
k + 1
scenarios, from a global null to a global alternative scenario.
A matrix with k
rows and k + 1
columns.
design <- setup_fujikawa(k = 3, p0 = 0.2) get_scenarios(design = design, p1 = 0.5)
design <- setup_fujikawa(k = 3, p0 = 0.2) get_scenarios(design = design, p1 = 0.5)
Optimize a Basket Trial Design
opt_design( design, n, alpha, design_params = list(), scenarios, prec_digits, iter = 1000, data = NULL, ... )
opt_design( design, n, alpha, design_params = list(), scenarios, prec_digits, iter = 1000, data = NULL, ... )
design |
An object created with one of the |
n |
The sample size per basket. |
alpha |
The one-sided significance level. |
design_params |
A list of params that is specific to the class of
|
scenarios |
A matrix of scenarios. |
prec_digits |
Number of decimal places that are considered when adjusting lambda. |
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A list of data matrices generated with |
... |
Further arguments. |
A matrix with the expected number of correct decisions.
design <- setup_fujikawa(k = 3, p0 = 0.2) scenarios <- get_scenarios(design, p1 = 0.5) # Without simulated data opt_design(design, n = 20, alpha = 0.05, design_params = list(epsilon = c(1, 2), tau = c(0, 0.5)), scenarios = scenarios, prec_digits = 3) # With simulated data scenario_list <- as.list(data.frame(scenarios)) data_list <- lapply(scenario_list, function(x) get_data(k = 3, n = 20, p = x, iter = 1000)) opt_design(design, n = 20, alpha = 0.05, design_params = list(epsilon = c(1, 2), tau = c(0, 0.5)), scenarios = scenarios, prec_digits = 3, data = data_list)
design <- setup_fujikawa(k = 3, p0 = 0.2) scenarios <- get_scenarios(design, p1 = 0.5) # Without simulated data opt_design(design, n = 20, alpha = 0.05, design_params = list(epsilon = c(1, 2), tau = c(0, 0.5)), scenarios = scenarios, prec_digits = 3) # With simulated data scenario_list <- as.list(data.frame(scenarios)) data_list <- lapply(scenario_list, function(x) get_data(k = 3, n = 20, p = x, iter = 1000)) opt_design(design, n = 20, alpha = 0.05, design_params = list(epsilon = c(1, 2), tau = c(0, 0.5)), scenarios = scenarios, prec_digits = 3, data = data_list)
Setup BHM Design Object
setup_bhm(k, p0, p_target, mu_mean = NULL, mu_sd = 100)
setup_bhm(k, p0, p_target, mu_mean = NULL, mu_sd = 100)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
p_target |
The response rate of interest. See details. |
mu_mean |
Mean of the normal prior distribution for the mean of the thetas. See details. |
mu_sd |
Standard deviation of the normal prior distribution for the mean of the thetas. |
The class bhm
implements the Bayesian Hierarchical Model
proposed by Berry et al. (2013). Methods for this class are
mostly wrappers for functions from the package bhmbasket
.
In the BHM the thetas of all baskets are modeled, where theta_i =
logit(p_i) - logit(p_target). These thetas are assumed to come from
a normal distribution with mean mu_mean and standard deviation mu_sd.
If mu_mean = NULL
then mu_mean is determined as logit(p0) -
logit(p_target), hence the mean of the normal distribution corresponds
to the null hypothesis.
An S3 object of class bhm
Berry, S. M., Broglio, K. R., Groshen, S., & Berry, D. A. (2013). Bayesian hierarchical modeling of patient subpopulations: efficient designs of phase II oncology clinical trials. Clinical Trials, 10(5), 720-734.
design_bhm <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5)
design_bhm <- setup_bhm(k = 3, p0 = 0.2, p_target = 0.5)
Creates an object of class bma
.
setup_bma(k, p0, shape1 = 1, shape2 = 1)
setup_bma(k, p0, shape1 = 1, shape2 = 1)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
shape1 |
First common shape parameter of the beta prior. |
shape2 |
Second common shape parameter of the beta prior. |
The class bma
implements the Bayesian Model Averaging
design by Pisoda et al. (2021). Functions for this class are mostly
wrappers for functions of the bmabasket
package.
An S3 object of class bma
Psioda, M. A., Xu, J., Jiang, Q. I., Ke, C., Yang, Z., & Ibrahim, J. G. (2021). Bayesian adaptive basket trial design using model averaging. Biostatistics, 22(1), 19-34.
design_bma <- setup_bma(k = 3, p0 = 0.2)
design_bma <- setup_bma(k = 3, p0 = 0.2)
Setup Calibrated Power Prior Design Object
setup_cpp(k, p0, shape1 = 1, shape2 = 1)
setup_cpp(k, p0, shape1 = 1, shape2 = 1)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
shape1 |
First common shape parameter of the beta prior. |
shape2 |
Second common shape parameter of the beta prior. |
The class cpp
implements a version of the power prior design,
in which the amount of information that is shared between baskets is
determined by the Kolmogorov-Smirnov test statistic between baskets (which
is equivalent to the absolut difference in response rates).
An S3 object of class cpp
Baumann, L., Sauer, L., & Kieser, M. (2024). A basket trial design based on power priors. arXiv:2309.06988.
design_cpp <- setup_cpp(k = 3, p0 = 0.2)
design_cpp <- setup_cpp(k = 3, p0 = 0.2)
Setup Global Calibrated Power Prior Design Object
setup_cppglobal(k, p0, shape1 = 1, shape2 = 1)
setup_cppglobal(k, p0, shape1 = 1, shape2 = 1)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
shape1 |
First common shape parameter of the beta prior. |
shape2 |
Second common shape parameter of the beta prior. |
The class cppglobal
implements a version of the power prior
design, in which the amount of information that is shared between baskets is
determined by the Kolmogorov-Smirnov test statistic between basekts and
a function based on response rate differences that quantifies the
overall heterogeneity.
An S3 object of class cppglobal
Baumann, L., Sauer, L., & Kieser, M. (2024). A basket trial design based on power priors. arXiv:2309.06988.
design_cppglobal <- setup_cppglobal(k = 3, p0 = 0.2)
design_cppglobal <- setup_cppglobal(k = 3, p0 = 0.2)
Setup EXNEX Design Object
setup_exnex( k, p0, basket_mean = NULL, basket_sd = 100, mu_mean = NULL, mu_sd = 100 )
setup_exnex( k, p0, basket_mean = NULL, basket_sd = 100, mu_mean = NULL, mu_sd = 100 )
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
basket_mean |
Mean of the normal prior distribution of the individual thetas (NEX part). See details. |
basket_sd |
Standard deviation of the normal prior distribution of the individual thetas (NEX part). |
mu_mean |
Mean of the normal prior exchangeability distribution for the mean of the thetas (EX part). See details. |
mu_sd |
Standard deviation of the normal prior exchangeability distribution for the mean of the thetas (EX part). |
The class exnex
implements the EXNEX model proposed by
Neuenschwander et al. (2016). Methods for this class are mostly wrappers
for functions from the package bhmbasket
.
In the EXNEX model the thetas of all baskets are modeled as a mixture
of individual models and a Bayesian Hierarchical Model with a fixed
mixture weight w. If mu_mean
and basket_mean
are NULL
then they are set to logit(p0).
Note that Neuenschwander et al. (2016) use different prior means and
standard deviations. The default values here are used for better comparison
with the BHM model (see setup_bhm
).
An S3 object of class exnex
Neuenschwander, B., Wandel, S., Roychoudhury, S., & Bailey, S. (2016). Robust exchangeability designs for early phase clinical trials with multiple strata. Pharmaceutical statistics, 15(2), 123-134.
design_exnex <- setup_exnex(k = 3, p0 = 0.2)
design_exnex <- setup_exnex(k = 3, p0 = 0.2)
Setup Fujikawa Design Object
setup_fujikawa(k, p0, shape1 = 1, shape2 = 1)
setup_fujikawa(k, p0, shape1 = 1, shape2 = 1)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
shape1 |
First common shape parameter of the beta prior. |
shape2 |
Second common shape parameter of the beta prior. |
The class fujikawa
implements a design by Fujikawa et al.
(2020) in which information is shared based on the pairwise similarity
between baskets which is quantified using the Jensen-Shannon divergence
between the individual posterior distributions between baskets.
An S3 object of class fujikawa
Fujikawa, K., Teramukai, S., Yokota, I., & Daimon, T. (2020). A Bayesian basket trial design that borrows information across strata based on the similarity between the posterior distributions of the response probability. Biometrical Journal, 62(2), 330-338.
design_fujikawa <- setup_fujikawa(k = 3, p0 = 0.2)
design_fujikawa <- setup_fujikawa(k = 3, p0 = 0.2)
Setup Global JSD Design Object
setup_jsdglobal(k, p0, shape1 = 1, shape2 = 1)
setup_jsdglobal(k, p0, shape1 = 1, shape2 = 1)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
shape1 |
First common shape parameter of the beta prior. |
shape2 |
Second common shape parameter of the beta prior. |
The class jsdglobal
implements a version of the power prior
design, in which information is shared based on pairwise similarity
and overall heterogeneity between baskets. Both pairwise similarity and
overall heterogeneity are assessed using the Jensen-Shannon divergence.
An S3 object of class jsdglobal
Baumann, L., Sauer, L., & Kieser, M. (2024). A basket trial design based on power priors. arXiv:2309.06988.
design_jsdglobal <- setup_jsdglobal(k = 3, p0 = 0.2)
design_jsdglobal <- setup_jsdglobal(k = 3, p0 = 0.2)
Creates an object of class mml
.
setup_mml(k, p0, shape1 = 1, shape2 = 1)
setup_mml(k, p0, shape1 = 1, shape2 = 1)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
shape1 |
First common shape parameter of the beta prior. |
shape2 |
Second common shape parameter of the beta prior. |
The class mml
implements a modified version of the
empirical Bayes method by Gravestock & Held (2017) which was proposed for
borrowing strength from an external study. In their approach, the sharing
weight is found as the maximum of the marginal likelihood of the
weight, given the external data set. This leads, however, to
non-symmetric weights when applied to sharing in basket trials, i.e.
Basket i would not share the information from Basket j as the other way
round. Therefore, a symmetrised version is used, where the mean of the
two weights resulting from sharing in both directions is used.
An S3 object of class mml
Gravestock, I., & Held, L. (2017). Adaptive power priors with empirical Bayes for clinical trials. Pharmaceutical statistics, 16(5), 349-360.
design_mml <- setup_mml(k = 3, p0 = 0.2)
design_mml <- setup_mml(k = 3, p0 = 0.2)
Creates an object of class mmlglobal
.
setup_mmlglobal(k, p0, shape1 = 1, shape2 = 1)
setup_mmlglobal(k, p0, shape1 = 1, shape2 = 1)
k |
The number of baskets. |
p0 |
A common probability under the null hypothesis. |
shape1 |
First common shape parameter of the beta prior. |
shape2 |
Second common shape parameter of the beta prior. |
The class mmlglobal
implements an empirical Bayes method
by Gravestock & Held (2019) which was proposed for borrowing strength
from multiple external studies.
An S3 object of class mmlglobal
Gravestock, I., & Held, L. (2019). Power priors based on multiple historical studies for binary outcomes. Biometrical Journal, 61(5), 1201-1218.
Baumann, L., Sauer, L., & Kieser, M. (2024). A basket trial design based on power priors. arXiv:2309.06988.
design_mmlglobal <- setup_mmlglobal(k = 3, p0 = 0.2)
design_mmlglobal <- setup_mmlglobal(k = 3, p0 = 0.2)
Calculate the Type 1 Error Rate for a Basket Trial Design
toer( design, n, p1 = NULL, lambda, design_params = list(), iter = 1000, data = NULL, ... )
toer( design, n, p1 = NULL, lambda, design_params = list(), iter = 1000, data = NULL, ... )
design |
An object created with one of the |
n |
The sample size per basket. |
p1 |
Probabilities under the alternative hypothesis. If |
lambda |
The posterior probability threshold. |
design_params |
A list of params that is specific to the class of
|
iter |
The number of iterations in the simulation. Is ignored if
|
data |
A data matrix with k column with the number of responses for each
basket. Has to be generated with |
... |
Further arguments. |
A numeric value.
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) toer(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, design_params = list(epsilon = 2, tau = 0), iter = 1000)
# Example for a basket trial with Fujikawa's Design design <- setup_fujikawa(k = 3, p0 = 0.2) toer(design = design, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95, design_params = list(epsilon = 2, tau = 0), iter = 1000)