| get_details.fujikawa_x | R Documentation |
This wrapper functions returns details for basket trial design.
## S3 method for class 'fujikawa_x'
get_details(
design,
...,
n,
p1 = NULL,
lambda,
level = 0.95,
epsilon,
tau,
logbase = 2,
iter = 1000,
data = NULL,
weight_fun = weights_jsd,
weight_params = list(epsilon = epsilon, tau = tau, logbase = logbase),
globalweight_fun = NULL,
globalweight_params = list(),
which_details = "all",
verbose = TRUE
)
design |
An object of class |
... |
Further arguments. |
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 |
weight_fun |
Which functions should be used to calculated the pairwise
weights? Default is |
weight_params |
A list of tuning parameters specific to |
globalweight_fun |
Which functions should be used to calculated the global weights? Currently, this is only supported for the exact backend. |
globalweight_params |
A list of tuning parameters specific to
|
which_details |
A character vector specifying which details should be
calculated. This is used only for |
verbose |
A logical, should message be shown if EWP or FWER is 0.
Default is |
It calculates the details using backends from two different R packages:
If design$backend == "sim", the details are calculated using
basksim::get_details.fujikawa.
If design$backend == "exact", the details are calculated using
baskexact::toer, baskexact::pow and baskexact::estim. Note that the
standard weight function weights_jsd calculates the weights
anew for each of the three function calls. This may compromise performance
and can be fixed by manually calculating the weights beforehand.
For the baskexact backend, the number of details is a relevant factor for
the function's runtime. Hence, one can select precisely which details should
be calculated:
If which_details == "all", everything will be calculated.
If "FWER" %in% which_details, then FWER will be calculated.
If "EWP" %in% which_details, then EWP will be calculated.
If "Rejection_Probabilities" %in% which_details, then per-basket
rejection probabilities will be calculated.
If "ECD" %in% which_details, then ECD will be calculated.
If "Mean" %in% which_details, then mean response rate and its MSE
will be calculated. The mean is the expected posterior mean conditional
under the assumption that p1 is true, and the MSE is the expected squared
deviation of the posterior mean from this true value.
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_x(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_x <- setup_fujikawa_x(k = 3, p0 = 0.2, backend = "exact")
get_details(design = design_x, n = 20, p1 = c(0.2, 0.5, 0.5), lambda = 0.95,
epsilon = 2, tau = 0, weight_fun = baskexact::weights_fujikawa,
logbase = exp(1))
# If you call get_details() with backend = "exact" multiple without
# changing design and n, it can make sense to save the weights and supply
# them separately using a custom function. This can save run time.
weight_mat_vanilla <- weights_jsd_vanilla(design_x, n = 20,
logbase = exp(1))
weights_from_save <- function(epsilon,
tau,
...) {
return(weights_fujikawa_tuned(weight_mat_vanilla,
epsilon = epsilon,
tau = tau))
}
get_details(design = design_x,
n = 20,
p1 = c(0.2, 0.5, 0.5),
lambda = 0.95,
epsilon = 2, tau = 0,
weight_fun = weights_from_save,
logbase = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.