`baskexact`

analytically calculates the operating
characteristics of the power prior basket trial design (Baumann et. al,
2024) and the design of Fujikawa et al. (2020). Both designs were
developed for the analysis of uncontrolled basket trials with a binary
endpoint. Baskets are analysed using beta posteriors, where the
posterior parameters are computed as weighted sums of the available
information to share information between baskets. Currently
`baskexact`

supports single-stage and two-stage designs with
equal sample sizes.

The first step is always to create a basket trial object using either
`setupOneStageBasket`

for a single-stage trial or
`setupTwoStageBasket`

for a two-stage trial. For example:

`k`

is the number of baskets, `shape1`

and
`shape2`

are the two shape parameters of the beta-prior of
the response probabilities of each basket and `p0`

is the
response probability under the null hypothesis. Note that currently only
common prior parameters and a common null response probability are
supported.

The most important operating characteristics be calculated using the
functions `toer`

(type 1 error rate), `pow`

(power) and `ecd`

(expected number of correct decisions). For
example:

```
toer(
design = design,
p1 = NULL,
n = 15,
lambda = 0.99,
weight_fun = weights_cpp,
weight_params = list(a = 2, b = 2),
results = "group"
)
```

`p1`

refers to the true response probabilities under which
the type 1 error rate is computed. Since `p1 = NULL`

is
specified, the type 1 error rates under a global null hypothesis are
calculated. `n`

specifies the sample size per basket.
`lambda`

is the posterior probability cut-off to reject the
null hypothesis. If the posterior probability that the response
probability of the basket is larger than `p0`

is larger than
`lambda`

, then the null hypothesis is rejected.
`weight_fun`

specifies which method should be used to
calculate the weights. With `weights_cpp`

the weights are
calculated based on a response rate differences between baskets. In
`weight_params`

a list of parameters that further define the
weights is given. See Baumann et al. (2024) for details.
`results`

specifies whether only the family wise type 1 error
rate (option `fwer`

) or also the basketwise type 1 error
rates (option `group`

) are calculated.

To find the probability cut-off `lambda`

such that a
certain FWER is maintained, use `adjust_lambda`

, for example
to find `lambda`

such that the FWER does not exceed 2.5%
(note that all hypotheses are tested one-sided):

```
adjust_lambda(
design = design,
alpha = 0.025,
p1 = NULL,
n = 15,
weight_fun = weights_cpp,
weight_params = list(a = 2, b = 2),
prec_digits = 4
)
# $lambda
# [1] 0.991
#
# $toer
# [1] 0.0231528
```

With `prec_digits`

it is specified how many decimal places
of `lambda`

are considered. Use `toer`

with
`lambda = 0.9909`

to check that 0.991 is indeed the smallest
probability cut-off with four decimals with a FWER of at most 2.5%. Note
that even when considering more decimal places the actual FWER will
generally below the nominal level (quite substantially in some cases),
since the outcome (number of responses) is discrete.

Baumann, L., Sauer, L., & Kieser, M. (2024). A basket trial design based on power priors. arXiv:2309.06988. 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.