# Easy API Reference for BioequivalencePower

The key functions of the package are `power`

, `samplesize`

, `power_analysis`

, `adjusted_α`

, `adjusted_α_with_samplesize`

, `confint`

, and `pvalue`

. Here are the doc strings for the easy-API methods of these functions.

## Power

`BioequivalencePower.power`

— Method```
power(::Type{BS}, ::Type{D} = EDDefaultDesign,
::Type{BW} = EmptyBayesianWrapper, ::Type{PP} = EmptyPriorParameters;
kwargs...
) where {BS <: BioequivalencePowerStudy, D <: ExperimentalDesign, BW <: BayesianWrapper, PP <:PriorParameters}
```

This is the easy-API `power`

method. Its interface is designed to be as easy and simple to use as possible. However, since it encompasses all of the power functionality of the package, the docstring is long.

There are two positional arguments, first the study type `BS`

and then the design type `D`

. Type names are used for these arguments. For example:

`power(RatioTOST, ED2x2x3ReplicateCrossover, ...)`

Another two optional positional arguments are the prior type `BW`

and its parameters `PP`

. Use these only if a you wish to compute expected power in the Bayesian context. For example:

`power(RatioTOST, ED2x2x3ReplicateCrossover, CVSEPrior, DegreesOfFreedomPriorParameters, ...)`

After these positional arguments, the remaining arguments are indicated in the method signature via `kwargs`

(key word arguments). With these keywords we always need to set the number of subjects, `n`

, and the variability parameter, `CV`

(can also be `SE`

in certain cases). The order of the keywords does not matter. Many other keywords are also possible (see below). Here is a minimal working example:

`power(RatioTOST, ED2x2x3ReplicateCrossover, n = 20, CV = 0.32)`

The essence of the easy-API is that the it uses the complete-API under the hood, yet presents a simple interface. For example here, the number of subjects, `n = 20`

is automatically set in an `HypothesisTestMetaParams`

object, and the coefficient of variation `CV = 0.32`

is set in a `RatioTOST{ED2x2x3ReplicateCrossover}`

object. These objects are hidden from the user. The easy-API sees which arguments are supplied and constructs the objects based on these arguments before invoking the complete-API internally.

Here is a full list of arguments:

**1st argument**: bioequivalence power study type. One of:- Standard (average) bioequivalence:
`RatioTOST`

or`DifferenceTOST`

- Reference scaling and/or expanding limits:
`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

- Tests for NTID (Narrow Therapeutic Index Drug):
`NarrowTherapeuticIndexDrugRatioTOST`

- Tests in the context of fiducial inference:
`FiducialRatioTOST`

- Tests with two end points:
`TwoDifferenceTOSTs`

or`TwoRatioTOSTs`

- Dose proportionality:
`DoseProportionalityStudy`

- Non-inferiority tests:
`NonInferiorityRatioOST`

or`NonInferiorityDifferenceOST`

- Standard (average) bioequivalence:
**2nd argument**: design.- For the study types
`RatioTOST`

,`DifferenceTOST`

,`TwoDifferenceTOSTs`

,`TwoRatioTOSTs`

,`NonInferiorityRatioOST`

or`NonInferiorityDifferenceOST`

, use one of:`ED2Parallel`

,`ED2x2Crossover`

,`ED3x3Crossover`

,`ED3x6x3Crossover`

,`ED4x4Crossover`

,`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

,`ED2x4x4ReplicateCrossover`

,`ED2x3x3PartialReplicate`

,`ED2x4x2Balaam`

,`ED2x2x2RepeatedCrossover`

, or`EDPaired`

. - For the study types
`ExpandingLimitsRatioTOST`

or`ReferenceScaledRatioTOST`

use one of:`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

, or`ED2x3x3PartialReplicate`

. - For the study type
`NarrowTherapeuticIndexDrugRatioTOST`

use one of`ED2x2x3ReplicateCrossover`

or`ED2x2x4ReplicateCrossover`

. - For the study type
`FiducialRatioTOST`

use one of`ED2Parallel`

or`ED2x2Crossover`

. - For the study type
`DoseProportionalityStudy`

use one of`EDGeneralCrossover`

,`EDGeneralParallel`

, or`EDGeneral`

.

- For the study types
**3rd argument**(optional) prior type:- This argument can only be used with study types
`RatioTOST`

,`DifferenceTOST`

,`NonInferiorityRatioOST`

, or`NonInferiorityDifferenceOST`

and should be one of`CVSEPrior`

,`θ0Prior`

, or`BothCVSEandθ0Prior`

, to indicate a prior on the variability parameter (CV or SE), on θ₀, or on both, respectively. - If this argument is set, you must set the 4th argument.

- This argument can only be used with study types
**4th argument**(optional) prior distribution type:- This argument is relevant if and only if the 3rd argument (prior type) is set.
- If the prior type is
`CVSEPrior`

use`DegreesOfFreedomPriorParameters`

or`CategoricalPriorParameters`

. - If the prior type is
`θ0Prior`

use`StandardErrorPriorParameters`

or`CategoricalPriorParameters`

. - If the prior type is
`BothCVSEandθ0Prior`

use`DegreesOfFreedomAndStandardErrorPriorParameters`

or`TwoWayCategoricalPriorParameters`

.

The keyword arguments following the initial arguments are always set in the form `KEY = VALUE`

, where for example `KEY`

can be `n`

and value can be `20`

for indicating the number of subjects. Here is a full list, starting with mandatory arguments and following with optional arguments.

**Mandatory Arguments**

`n`

: Can be an integer denoting the total number of subjects or an array of the number of subjects per sequence group, e.g.`n = [12, 8]`

. In the typical case where the total number of subjects is given, the subjects are distributed as uniformly as possible among sequences of the design using the`distribute_groups`

function.- Variability arguments: The typical variability argument is
`CV`

, but in certain cases`SE`

is used instead. In other cases secondary variability arguments are required or optional. Here is a complete list of variability arguments. Note that variability arguments are always positive and in certain cases they are given as a vector.`RatioTOST`

,`DoseProportionalityStudy`

, and`NonInferiorityRatioOST`

: Specify`CV`

as a single value.`ReferenceScaledRatioTOST`

,`ExpandingLimitsRatioTOST`

, and`NarrowTherapeuticIndexDrugRatioTOST`

: Specify`CV`

as a single value, or if wishing to consider heteroscedasticity, specify as a vector of length 2, with the first entry for the test formulation and the second entry for the reference formulation.`DifferenceTOST`

, and`NonInferiorityDifferenceOST`

: Specify`SE`

as a single value.`FiducialRatioTOST`

: Specify both`SE`

and`SEb`

, each as a single value.`TwoRatioTOSTs`

: Specify`CV`

as a vector of length 2 matching the two end points of the study.`TwoDifferenceTOSTs`

: Specify`SE`

as a vector of length 2 matching the two end points of the study.`DoseProportionalityStudy`

: Specify`CV`

as a single value. Optionally, specify`CVb`

as a single value (default value of`CVb`

if not specified is twice`CV`

.)

- For
`DoseProportionalityStudy`

you must also specify the vector of doses via`doses`

. This is a vector of integer values, e.g.`doses = [1, 2, 8]`

. - In case of a prior distribution (3rd and 4th arguments used) there are other mandatory arguments. See specific description below.

**Argument for "test/reference" ratio or difference**

A key input to the power computation is the ratio or difference between the test and reference formulation. That is, power is computed based on such a postulated point. It is typically denoted θ₀ with variable name `peθ₀`

, except for the context of dose proportionality studies where it is denoted β₀ with variable name `peβ₀`

. All of the study types set default for this argument, and you can naturally override that default.

**Ratio formulation defaults**:

`peθ₀`

for`RatioTOST`

,`FiducialRatioTOST`

,`NonInferiorityRatioOST`

: Default is at`0.95`

.`peθ₀`

for`ReferenceScaledRatioTOST`

,`ExpandingLimitsRatioTOST`

: Default is at`0.9`

.`peθ₀`

for`NarrowTherapeuticIndexDrugRatioTOST`

: Default is at`0.975`

if`highly_variable = false`

(default), and at`0.95`

otherwise (the HVNTID case).`peθ₀`

for`TwoRatioTOSTs`

: Default is at the vector`[0.95, 0.95]`

.

**Difference formulation defaults**:

`peθ₀`

for`DifferenceTOST`

: Default is at`0.05`

.`peθ₀`

for`NonInferiorityDifferenceOST`

: Default is at`-0.05`

.`peθ₀`

for`TwoDifferenceTOSTs`

: Default is at the vector`[0.05, 0.05]`

.

**Dose proportionality default**:

`peβ₀`

for`DoseProportionalityStudy`

is set at`1 + log(0.95)/log(maximum(doses) / minimum(doses))`

.

**Argument for limits**

Most of the study types have set limits values `θ₁`

and `θ₂`

with `θ₁ < θ₂`

. The non-inferiority types has the single limit `θmargin`

, and the two simultaneous end points studies have `θ₁`

and `θ₂`

, each as a vector of length 2. Default values are set for all of these, and you can set your own values to override the defaults. Note that in most cases `θ₂`

is defined in terms of `θ₁`

. Hence you may set `θ₁`

and as a result, `θ₂`

will be adjusted accordingly, or you may set only `θ₂`

, or set both.

- For
`RatioTOST`

,`ReferenceScaledRatioTOST`

,`ExpandingLimitsRatioTOST`

,`NarrowTherapeuticIndexDrugRatioTOST`

,`FiducialRatioTOST`

,and`DoseProportionalityStudy`

we have that`θ₁`

and`θ₂`

are each scalar values with defaults`θ₁ = 0.8`

and`θ₂ = 1/θ₁`

(this is`1.25`

). - For
`DifferenceTOST`

we have that`θ₁`

and`θ₂`

are each scalar values with defaults`θ₁ = -0.2`

and`θ₂ = -θ₁`

(this is`0.2`

). - For
`TwoRatioTOSTs`

and`TwoDifferenceTOSTs`

we have that`θ₁`

and`θ₂`

are each vectors of length 2 with default individual entries corresponding to`RatioTOST`

and`DifferenceTOST`

. For example for`TwoRatioTOSTs`

we have`θ₁ = [0.8, 0.8]`

and`θ₂ = 1 ./ θ₁`

. - For
`NonInferiorityRatioOST`

the default value is`θmargin = 0.8`

. - For
`NonInferiorityDifferenceOST`

the default value is`θmargin = -0.2`

.

**Optional Arguments for hypothesis test meta parameters (including assumptions)**

`α`

: By default,`α = 0.05`

for most studies with the exception of`FiducialRatioTOST`

,`NonInferiorityRatioOST`

, and`NonInferiorityDifferenceOST`

where it is set at`0.025`

(note that this adjusted default is only applicable via the easy-API and not via the complete-API).`n_g`

: This is the number of groups in the study (it is the number of location sites and should not to be confused with the number of sequences in a design). By default`n_g = 1`

. For standard (average) bioequivalence formulated as a ratio, namely`RatioTOST`

, we may use other values of`n_g`

if carrying out subject level simulations (`subject_level = true`

). See more details with`subject_level`

below.`robust`

: Set this to true for a determination of degrees of freedom using a robust formulation. Default is`false`

.`test_group_effect`

: Set this to true for the specific case`RatioTOST`

with`n_g`

set to greater than one and`subeject_level = true`

. In this case a model for testing group effect is first executed. Default is`false`

.

**Special arguments for reference scaling and/or expanding limits**

`reg_symbol`

: This is the symbol for the`RegulatoryConstants`

object set in either`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

studies. For the former the default is`:fda`

and for the latter it is`:ema`

. You may set other regulatory constants objects if you wish.

**Special arguments for narrow therapeutic drug index products**

`highly_variable`

: This boolean value with default`false`

determines if the study is an NTDI or HVNTDI study. The case`highly_variable`

= true yields different behavior for the hypothesis test.`regulatory_constant`

: Default is`-log(0.9)/0.10`

(which is about`1.053605`

), used only in`highly_variable = false`

.`ratio_threshold`

: Default is`2.5`

.

**Special arguments for two simultaneous end points**

`ρ`

: When using`TwoRatioTOSTs`

or`TwoDifferenceTOSTs`

, this is the assumed correlation coefficient between the two endpoints. Default is`0.0`

and it can be set to any value such that`-1 ≤ ρ ≤ 1`

.

**Special arguments for dose proportionality study**

`design_matrix`

: Use this only with`DoseProportionalityStudy`

and`EDGeneral`

specified in the 1st and 2nd arguments respectively. In this case`design_matrix`

should be set to an`EDGeneral`

design object which encapsulates a`design_matrix`

that can be specified.

**Arguments for simulation and computation**

Note that the arguments `num_sims`

, `seed`

, and `subject_level`

are specific to a case where Monte Carlo power calculation is used. In study types where exact power calculation is used by default and Monte Carlo is also supported, the default is overridden and the calculation is changed to Monte Carlo if one of these arguments is set. In other cases, where Monte Carlo is already the default, setting these parameters just updates the nature of the Monte Carlo.

The study types with default as exact calculation and an option for Monte Carlo are: `RatioTOST`

, `DifferenceTOST`

.

The study types with only numerical calculation are: `DoseProportionalityStudy`

(note that this is an approximate calculation), `NonInferiorityRatioOST`

, and `NonInferiorityDifferenceOST`

.

The study types with only Monte Carlo are: `ReferenceScaledRatioTOST`

, `ExpandingLimitsRatioTOST`

, `NarrowTherapeuticIndexDrugRatioTOST`

, `FiducialRatioTOST`

, `TwoRatioTOSTs`

, and `TwoDifferenceTOSTs`

.

When using Monte Carlo, these are the possible arguments.

`num_sims`

: This is the number of simulation runs to execute. The default is`1e5`

.`seed`

: This is the simulation seed to use for reproducibility. The default value is an arbitrary`1984`

value, yet can be set to any integer value. Setting`seed = nothing`

, implies no random seed is set.`details`

: Set this to true to output additional simulation and/or computation output. Default is`false`

.`subject_level`

: This argument is by default`false`

and this implies simulations are based on randomly generating statistics. If set to`true`

then it means that each simulation run randomly generates sample data and uses this random data to estimate the power. In general,`subject_level = true`

is slower, yet in certain cases it yields better accuracy. You may set`subject_level = true`

only for the following cases:`RatioTOST`

, yet only with one of the designs`ED2x2Crossover`

,`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

, or`ED2x3x3PartialReplicate`

.`ReferenceScaledRatioTOST`

with any of the supported designs of the study.`ExpandingLimitsRatioTOST`

with any of the supported designs of the study.

**Arguments for Bayesian computation**

When setting the 3rd and 4th parameters for Bayesian computation, you must also supply prior parameters. See the Priors on parameters in power studies section of the docs for more details.

**Return value**

The return value is always an `HypothesisTestMetaParams`

object. The `achieved_power`

field specifies the power.

## Sample size

`BioequivalencePower.samplesize`

— Method```
samplesize(::Type{BS}, ::Type{D} = EDDefaultDesign,
::Type{BW} = EmptyBayesianWrapper, ::Type{PP} = EmptyPriorParameters;
kwargs...
) where {BS <: BioequivalencePowerStudy, D <: ExperimentalDesign, BW <: BayesianWrapper, PP <:PriorParameters}
```

This is the easy-API `samplesize`

method. Its interface is designed to be as easy and simple to use as possible. However, since it encompasses all of the sample size functionality of the package, the docstring is long.

There are two mandatory positional arguments, first the study type `BS`

and then the design type `D`

. Type names are used for these arguments. For example:

`samplesize(RatioTOST, ED2x2x3ReplicateCrossover, ...)`

Another two optional positional arguments are the prior type `BW`

and its parameters `PP`

. Use these only if a you wish to compute sample size using expected power in the Bayesian context. For example:

`samplesize(RatioTOST, ED2x2x3ReplicateCrossover, CVSEPrior, DegreesOfFreedomPriorParameters, ...)`

After these positional arguments, the remaining arguments are indicated in the method signature via `kwargs`

(key word arguments). With these keywords we always need to set the variability parameter, `CV`

(can also be `SE`

in certain cases). The order of the keywords does not matter. Many other keywords are also possible (see below). Here is a minimal working example:

`samplesize(RatioTOST, ED2x2x3ReplicateCrossover, CV = 0.32)`

The essence of the easy-API is that the it uses the complete-API under the hood, yet presents a simple interface. For example here, behind the scenes, `CV = 0.32`

is set in a `RatioTOST{ED2x2x3ReplicateCrossover}`

object which is passed to a `samplesize`

method for such objects. These details are hidden from the user. The easy-API sees which arguments are supplied and constructs the objects based on these arguments before invoking the complete-API internally.

Here is a full list of arguments:

**1st argument**: bioequivalence power study type. One of:- Standard (average) bioequivalence:
`RatioTOST`

or`DifferenceTOST`

- Reference scaling and/or expanding limits:
`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

- Tests for NTID (Narrow Therapeutic Index Drug):
`NarrowTherapeuticIndexDrugRatioTOST`

- Tests in the context of fiducial inference:
`FiducialRatioTOST`

- Tests with two end points:
`TwoDifferenceTOSTs`

or`TwoRatioTOSTs`

- Dose proportionality:
`DoseProportionalityStudy`

- Non-inferiority tests:
`NonInferiorityRatioOST`

or`NonInferiorityDifferenceOST`

- Standard (average) bioequivalence:
**2nd argument**: design.- For the study types
`RatioTOST`

,`DifferenceTOST`

,`TwoDifferenceTOSTs`

,`TwoRatioTOSTs`

,`NonInferiorityRatioOST`

or`NonInferiorityDifferenceOST`

, use one of:`ED2Parallel`

,`ED2x2Crossover`

,`ED3x3Crossover`

,`ED3x6x3Crossover`

,`ED4x4Crossover`

,`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

,`ED2x4x4ReplicateCrossover`

,`ED2x3x3PartialReplicate`

,`ED2x4x2Balaam`

,`ED2x2x2RepeatedCrossover`

, or`EDPaired`

. - For the study types
`ExpandingLimitsRatioTOST`

or`ReferenceScaledRatioTOST`

use one of:`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

, or`ED2x3x3PartialReplicate`

. - For the study type
`NarrowTherapeuticIndexDrugRatioTOST`

use one of`ED2x2x3ReplicateCrossover`

or`ED2x2x4ReplicateCrossover`

. - For the study type
`FiducialRatioTOST`

use one of`ED2Parallel`

or`ED2x2Crossover`

. - For the study type
`DoseProportionalityStudy`

use one of`EDGeneralCrossover`

,`EDGeneralParallel`

, or`EDGeneral`

.

- For the study types
**3rd argument**(optional) prior type:- This argument can only be used with study types
`RatioTOST`

,`DifferenceTOST`

,`NonInferiorityRatioOST`

, or`NonInferiorityDifferenceOST`

and should be one of`CVSEPrior`

,`θ0Prior`

, or`BothCVSEandθ0Prior`

, to indicate a prior on the variability parameter (CV or SE), on θ₀, or on both, respectively. - If this argument is set, you must set the 4th argument.

- This argument can only be used with study types
**4th argument**(optional) prior distribution type:- This argument is relevant if and only if the 3rd argument (prior type) is set.
- If the prior type is
`CVSEPrior`

use`DegreesOfFreedomPriorParameters`

or`CategoricalPriorParameters`

. - If the prior type is
`θ0Prior`

use`StandardErrorPriorParameters`

or`CategoricalPriorParameters`

. - If the prior type is
`BothCVSEandθ0Prior`

use`DegreesOfFreedomAndStandardErrorPriorParameters`

or`TwoWayCategoricalPriorParameters`

.

The keyword arguments following the initial arguments are always set in the form `KEY = VALUE`

, where for example `KEY`

can be `CV`

and value can be `0.32`

. Here is a full list, starting with mandatory arguments and following with optional arguments.

**Mandatory Arguments**

- Variability arguments: The typical variability argument is
`CV`

, but in certain cases`SE`

is used instead. In other cases secondary variability arguments are required or optional. Here is a complete list of variability arguments. Note that variability arguments are always positive and in certain cases they are given as a vector.`RatioTOST`

,`DoseProportionalityStudy`

, and`NonInferiorityRatioOST`

: Specify`CV`

as a single value.`ReferenceScaledRatioTOST`

,`ExpandingLimitsRatioTOST`

, and`NarrowTherapeuticIndexDrugRatioTOST`

: Specify`CV`

as a single value, or if wishing to consider heteroscedasticity, specify as a vector of length 2, with the first entry for the test formulation and the second entry for the reference formulation.`DifferenceTOST`

, and`NonInferiorityDifferenceOST`

: Specify`SE`

as a single value.`FiducialRatioTOST`

: Specify both`SE`

and`SEb`

, each as a single value.`TwoRatioTOSTs`

: Specify`CV`

as a vector of length 2 matching the two end points of the study.`TwoDifferenceTOSTs`

: Specify`SE`

as a vector of length 2 matching the two end points of the study.`DoseProportionalityStudy`

: Specify`CV`

as a single value. Optionally, specify`CVb`

as a single value (default value of`CVb`

if not specified is twice`CV`

.)

- For
`DoseProportionalityStudy`

you must also specify the vector of doses via`doses`

. This is a vector of integer values, e.g.`doses = [1, 2, 8]`

. - In case of a prior distribution (3rd and 4th arguments used) there are other mandatory arguments. See specific description below.

**Argument for "test/reference" ratio or difference**

A key input to the sample size computation is the ratio or difference between the test and reference formulation. That is, sample size is computed based on such a postulated point. It is typically denoted θ₀ with variable name `peθ₀`

, except for the context of dose proportionality studies where it is denoted β₀ with variable name `peβ₀`

. All of the study types set default for this argument, and you can naturally override that default.

**Ratio formulation defaults**:

`peθ₀`

for`RatioTOST`

,`FiducialRatioTOST`

,`NonInferiorityRatioOST`

: Default is at`0.95`

.`peθ₀`

for`ReferenceScaledRatioTOST`

,`ExpandingLimitsRatioTOST`

: Default is at`0.9`

.`peθ₀`

for`NarrowTherapeuticIndexDrugRatioTOST`

: Default is at`0.975`

if`highly_variable = false`

(default), and at`0.95`

otherwise (the HVNTID case).`peθ₀`

for`TwoRatioTOSTs`

: Default is at the vector`[0.95, 0.95]`

.

**Difference formulation defaults**:

`peθ₀`

for`DifferenceTOST`

: Default is at`0.05`

.`peθ₀`

for`NonInferiorityDifferenceOST`

: Default is at`-0.05`

.`peθ₀`

for`TwoDifferenceTOSTs`

: Default is at the vector`[0.05, 0.05]`

.

**Dose proportionality default**:

`peβ₀`

for`DoseProportionalityStudy`

is set at`1 + log(0.95)/log(maximum(doses) / minimum(doses))`

.

**Argument for limits**

Most of the study types have set limits values `θ₁`

and `θ₂`

with `θ₁ < θ₂`

. The non-inferiority types has the single limit `θmargin`

, and the two simultaneous end points studies have `θ₁`

and `θ₂`

, each as a vector of length 2. Default values are set for all of these, and you can set your own values to override the defaults. Note that in most cases `θ₂`

is defined in terms of `θ₁`

. Hence you may set `θ₁`

and as a result, `θ₂`

will be adjusted accordingly, or you may set only `θ₂`

, or set both.

- For
`RatioTOST`

,`ReferenceScaledRatioTOST`

,`ExpandingLimitsRatioTOST`

,`NarrowTherapeuticIndexDrugRatioTOST`

,`FiducialRatioTOST`

,and`DoseProportionalityStudy`

we have that`θ₁`

and`θ₂`

are each scalar values with defaults`θ₁ = 0.8`

and`θ₂ = 1/θ₁`

(this is`1.25`

). - For
`DifferenceTOST`

we have that`θ₁`

and`θ₂`

are each scalar values with defaults`θ₁ = -0.2`

and`θ₂ = -θ₁`

(this is`0.2`

). - For
`TwoRatioTOSTs`

and`TwoDifferenceTOSTs`

we have that`θ₁`

and`θ₂`

are each vectors of length 2 with default individual entries corresponding to`RatioTOST`

and`DifferenceTOST`

. For example for`TwoRatioTOSTs`

we have`θ₁ = [0.8, 0.8]`

and`θ₂ = 1 ./ θ₁`

. - For
`NonInferiorityRatioOST`

the default value is`θmargin = 0.8`

. - For
`NonInferiorityDifferenceOST`

the default value is`θmargin = -0.2`

.

**Optional Arguments for hypothesis test meta parameters (including assumptions)**

`target_power`

: This is the target power for which sample size should be determined. Default value is`0.8`

. The function will search for`n`

that has`target_power ≤ achieved_power`

.`α`

: By default,`α = 0.05`

for most studies with the exception of`FiducialRatioTOST`

,`NonInferiorityRatioOST`

, and`NonInferiorityDifferenceOST`

where it is set at`0.025`

(note that this adjusted default is only applicable via the easy-API and not via the complete-API).`n_g`

: This is the number of groups in the study (it is the number of location sites and should not to be confused with the number of sequences in a design). By default`n_g = 1`

. For standard (average) bioequivalence formulated as a ratio, namely`RatioTOST`

, we may use other values of`n_g`

if carrying out subject level simulations (`subject_level = true`

). See more details with`subject_level`

below.`robust`

: Set this to true for a determination of degrees of freedom using a robust formulation. Default is`false`

.`test_group_effect`

: Set this to true for the specific case`RatioTOST`

with`n_g`

set to greater than one and`subeject_level = true`

. In this case a model for testing group effect is first executed. Default is`false`

.

**Special arguments for reference scaling and/or expanding limits**

`reg_symbol`

: This is the symbol for the`RegulatoryConstants`

object set in either`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

studies. For the former the default is`:fda`

and for the latter it is`:ema`

. You may set other regulatory constants objects if you wish.

**Special arguments for narrow therapeutic drug index products**

`highly_variable`

: This boolean value with default`false`

determines if the study is an NTDI or HVNTDI study. The case`highly_variable`

= true yields different behavior for the hypothesis test.`regulatory_constant`

: Default is`-log(0.9)/0.10`

(which is about`1.053605`

), used only in`highly_variable = false`

.`ratio_threshold`

: Default is`2.5`

.

**Special arguments for two simultaneous end points**

`ρ`

: When using`TwoRatioTOSTs`

or`TwoDifferenceTOSTs`

, this is the assumed correlation coefficient between the two endpoints. Default is`0.0`

and it can be set to any value such that`-1 ≤ ρ ≤ 1`

.

**Special arguments for dose proportionality study**

`design_matrix`

: Use this only with`DoseProportionalityStudy`

and`EDGeneral`

specified in the 1st and 2nd arguments respectively. In this case`design_matrix`

should be set to an`EDGeneral`

design object which encapsulates a`design_matrix`

that can be specified.

**Arguments for simulation and computation**

Note that the arguments `num_sims`

, `seed`

, and `subject_level`

are specific to a case where Monte Carlo sample size calculation is used (this means the power calculation used by `samplesize`

uses Monte Carlo). In study types where exact power calculation is used by default and Monte Carlo is also supported, the default is overridden and the calculation is changed to Monte Carlo if one of these arguments is set. In other cases, where Monte Carlo is already the default, setting these parameters just updates the nature of the Monte Carlo.

The study types with default as exact calculation and an option for Monte Carlo are: `RatioTOST`

, `DifferenceTOST`

.

The study types with only numerical calculation are: `DoseProportionalityStudy`

(note that this is an approximate calculation), `NonInferiorityRatioOST`

, and `NonInferiorityDifferenceOST`

.

The study types with only Monte Carlo are: `ReferenceScaledRatioTOST`

, `ExpandingLimitsRatioTOST`

, `NarrowTherapeuticIndexDrugRatioTOST`

, `FiducialRatioTOST`

, `TwoRatioTOSTs`

, and `TwoDifferenceTOSTs`

.

When using Monte Carlo, these are the possible arguments.

`num_sims`

: This is the number of simulation runs to execute for each individual power calculation. The default is`1e5`

.`seed`

: This is the simulation seed to use for reproducibility. The default value is an arbitrary`1984`

value, yet can be set to any integer value. Setting`seed = nothing`

, implies no random seed is set.**Warning: sample size search without a fixed seed is not recommended.**.`details`

: Set this to true to output additional simulation and/or computation output. Default is`false`

.`subject_level`

: This argument is by default`false`

and this implies simulations are based on randomly generating statistics. If set to`true`

then it means that each simulation run randomly generates sample data and uses this random data to estimate the power. In general,`subject_level = true`

is slower, yet in certain cases it yields better accuracy. You may set`subject_level = true`

only for the following cases:`RatioTOST`

, yet only with one of the designs`ED2x2Crossover`

,`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

, or`ED2x3x3PartialReplicate`

.`ReferenceScaledRatioTOST`

with any of the supported designs of the study.`ExpandingLimitsRatioTOST`

with any of the supported designs of the study.

**Arguments for Bayesian computation**

When setting the 3rd and 4th parameters for Bayesian computation, you must also supply prior parameters. See the Priors on parameters in power studies section of the docs for more details.

**Counting iterations**

An additional argument is `count_iter`

with default value `false`

. If set to true the return value is a tuple where the second argument is the number of power computations computed until finding the sample size.

**Return value**

The return value is an `HypothesisTestMetaParams`

object. In this object, `n`

is the determined sample size and the `achieved_power`

field specifies the power obtained with such a sample size. If `count_iter = true`

, the return value is a tuple with the first argument being an `HypothesisTestMetaParams`

object, and the second argument being the number of iterations.

## Power Analysis

`BioequivalencePower.power_analysis`

— Method```
power_analysis(::Type{BS}, ::Type{D} = EDDefaultDesign;
kwargs...
) where {BS <: BioequivalencePowerStudy, D <: ExperimentalDesign}
```

This is the easy-API `power_analysis`

method. Its interface is designed to be as easy and simple to use as possible. However, since it encompasses all of the power_analysis functionality of the package, the docstring is long.

There are two mandatory positional arguments, first the study type `BS`

and then the design type `D`

. Type names are used for these arguments. For example:

`power_analysis(RatioTOST, ED2x2x3ReplicateCrossover, ...)`

After these positional arguments, the remaining arguments are indicated in the method signature via `kwargs`

(key word arguments). With these keywords we always need to set the variability parameter, `CV`

. The order of the keywords does not matter. Many other keywords are also possible (see below). Here is a minimal working example:

`power_analysis(RatioTOST, ED2x2x3ReplicateCrossover, CV = 0.32)`

The essence of the easy-API is that the it uses the complete-API under the hood, yet presents a simple interface. For example here the coefficient of variation `CV = 0.32`

is set in a `RatioTOST{ED2x2x3ReplicateCrossover}`

object. This object is hidden from the user. The easy-API sees which arguments are supplied and constructs objects based on these arguments before invoking the complete-API internally.

Here is a full list of arguments:

**1st argument**: bioequivalence power study type (note that not only some of the`BioequivalencePowerStudy`

sub-types are supported). One of:- Standard (average) bioequivalence:
`RatioTOST`

- Reference scaling and/or expanding limits:
`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

- Tests for NTID (Narrow Therapeutic Index Drug):
`NarrowTherapeuticIndexDrugRatioTOST`

- Standard (average) bioequivalence:
**2nd argument**: design.- For the study type
`RatioTOST`

use one of:`ED2Parallel`

,`ED2x2Crossover`

,`ED3x3Crossover`

,`ED3x6x3Crossover`

,`ED4x4Crossover`

,`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

,`ED2x4x4ReplicateCrossover`

,`ED2x3x3PartialReplicate`

,`ED2x4x2Balaam`

,`ED2x2x2RepeatedCrossover`

, or`EDPaired`

. - For the study types
`ExpandingLimitsRatioTOST`

or`ReferenceScaledRatioTOST`

use one of:`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

, or`ED2x3x3PartialReplicate`

. - For the study type
`NarrowTherapeuticIndexDrugRatioTOST`

use one of`ED2x2x3ReplicateCrossover`

or`ED2x2x4ReplicateCrossover`

.

- For the study type

The keyword arguments following the initial two arguments are always set in the form `KEY = VALUE`

, where for example `KEY`

can be `CV`

and value can be `0.32`

. Here is a full list, starting with mandatory arguments and following with optional arguments.

**Mandatory Arguments**

- Variability argument: This is
`CV`

. It should always be a single positive value. Note that vector CV for heteroscedasticity is not supported as part of`power_analysis`

.

**Argument for "test/reference" ratio**

A key input to the power analysis is the ratio between the test and reference formulation. That is, power is computed based on such a postulated point, and that point is varied. It is denoted θ₀ with variable name `peθ₀`

. All of the study types set default for this argument, and you can naturally override that default.

`peθ₀`

for`RatioTOST`

: Default is at`0.95`

.`peθ₀`

for`ReferenceScaledRatioTOST`

,`ExpandingLimitsRatioTOST`

: Default is at`0.9`

.`peθ₀`

for`NarrowTherapeuticIndexDrugRatioTOST`

: Default is at`0.975`

if`highly_variable = false`

(default), and at`0.95`

otherwise (the HVNTID case).

**Argument for limits**

These are set limits values `θ₁`

and `θ₂`

with `θ₁ < θ₂`

. Default values are set for all of these with defaults `θ₁ = 0.8`

and `θ₂ = 1/θ₁`

(this is `1.25`

). You can set your own values to override the defaults. Note that in most cases `θ₂`

is defined in terms of `θ₁`

. Hence you may set `θ₁`

and as a result, `θ₂`

will be adjusted accordingly, or you may set only `θ₂`

, or set both.

**Optional Arguments for hypothesis test meta parameters (including assumptions)**

`target_power`

: This is the target power for which sample size should be determined. Default value is`0.8`

. When initially determining the sample size,`power_analysis`

will search for`n`

that has`target_power ≤ achieved_power`

.`α`

: By default,`α = 0.05`

.`robust`

: Set this to true for a determination of degrees of freedom using a robust formulation. Default is`false`

.

**Special arguments for reference scaling and/or expanding limits**

`reg_symbol`

: This is the symbol for the`RegulatoryConstants`

object set in either`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

studies. For the former the default is`:fda`

and for the latter it is`:ema`

. You may set other regulatory constants objects if you wish.

**Special arguments for narrow therapeutic drug index products**

`highly_variable`

: This boolean value with default`false`

determines if the study is an NTDI or HVNTDI study. The case`highly_variable`

= true yields different behavior for the hypothesis test.`regulatory_constant`

: Default is`-log(0.9)/0.10`

(which is about`1.053605`

), used only in`highly_variable = false`

.`ratio_threshold`

: Default is`2.5`

.

**Arguments for simulation and computation**

Note that the arguments `num_sims`

, `seed`

, and `subject_level`

are specific to a case where Monte Carlo power calculation is used. In study types where exact power calculation is used by default and Monte Carlo is also supported, the default is overridden and the calculation is changed to Monte Carlo if one of these arguments is set. In other cases, where Monte Carlo is already the default, setting these parameters just updates the nature of the Monte Carlo.

In the context of `power_analysis`

, the study type with default as exact calculation and an option for Monte Carlo is: `RatioTOST`

.

Similarly, the study types with only Monte Carlo are: `ReferenceScaledRatioTOST`

, `ExpandingLimitsRatioTOST`

, and `NarrowTherapeuticIndexDrugRatioTOST`

.

When using Monte Carlo, these are the possible arguments.

`num_sims`

: This is the number of simulation runs to execute for each individual power calculation. The default is`1e5`

.`seed`

: This is the simulation seed to use for reproducibility. The default value is an arbitrary`1984`

value, yet can be set to any integer value. Setting`seed = nothing`

, implies no random seed is set.**Warning: sample size search or power analysis without a fixed seed is not recommended.**.`details`

: Set this to true to output additional simulation and/or computation output. Default is`false`

.`subject_level`

: This argument is by default`false`

and this implies simulations are based on randomly generating statistics. If set to`true`

then it means that each simulation run randomly generates sample data and uses this random data to estimate the power. In general,`subject_level = true`

is slower, yet in certain cases it yields better accuracy. You may set`subject_level = true`

only for the following cases:`ReferenceScaledRatioTOST`

with any of the supported designs of the study.`ExpandingLimitsRatioTOST`

with any of the supported designs of the study.

**Return value**

The return value is a tuple that represents the power analysis information.

## Adjusted α

`BioequivalencePower.adjusted_α`

— Method```
adjusted_α(::Type{BS}, ::Type{D} = EDDefaultDesign;
kwargs...
) where {BS <: BioequivalencePowerStudy, D <: ExperimentalDesign}
```

This is the easy-API `adjusted_α`

method. Its interface is designed to be as easy and simple to use as possible. However, since it encompasses all of the adjusted α functionality of the package, the docstring is long.

There are two mandatory positional arguments, first the study type `BS`

and then the design type `D`

. Type names are used for these arguments. For example:

`adjusted_α(ReferenceScaledRatioTOST, ED2x2x4ReplicateCrossover, ...)`

After these positional arguments, the remaining arguments are indicated in the method signature via `kwargs`

(key word arguments). With these keywords we always need to set the variability parameter, `CV`

. The order of the keywords does not matter. Many other keywords are also possible (see below). Here is a minimal working example:

`adjusted_α(ReferenceScaledRatioTOST, ED2x2x4ReplicateCrossover, CV = 0.27)`

The essence of the easy-API is that the it uses the complete-API under the hood, yet presents a simple interface. For example here, the coefficient of variation `CV = 0.27`

is set in a `ReferenceScaledRatioTOST{ED2x2x4ReplicateCrossover}`

object. This object is hidden from the user. The easy-API sees which arguments are supplied and constructs objects based on these arguments before invoking the complete-API internally.

Here is a full list of arguments:

**1st argument**: bioequivalence power study type (note that not only Reference scaling and/or expanding limits`BioequivalencePowerStudy`

sub-types are supported). Hence choose one of:`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

.**2nd argument**: design. Use one of:`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

, or`ED2x3x3PartialReplicate`

.

The keyword arguments following the initial arguments are always set in the form `KEY = VALUE`

, where for example `KEY`

can be `CV`

and value can be `0.27`

. Here is a full list, starting with mandatory argument and following with optional arguments.

**Mandatory Arguments**

- Variability argument: This is
`CV`

or if wishing to consider heteroscedasticity, specify as a vector of length 2, with the first entry for the test formulation and the second entry for the reference formulation.

**Argument for "test/reference" ratio**

A key input is the ratio between the test and reference formulation. That is, power is computed based on such a postulated point. It is denoted θ₀ with variable name `peθ₀`

. Default is at `0.9`

and you can naturally override that default.

**Argument for limits**

These are set limits values `θ₁`

and `θ₂`

with `θ₁ < θ₂`

. Default values are set for all of these with defaults `θ₁ = 0.8`

and `θ₂ = 1/θ₁`

(this is `1.25`

). You can set your own values to override the defaults. Note that in most cases `θ₂`

is defined in terms of `θ₁`

. Hence you may set `θ₁`

and as a result, `θ₂`

will be adjusted accordingly, or you may set only `θ₂`

, or set both.

**Type I error and α**

`α`

: By default,`α = 0.05`

. This is the desired type I error.`pre_specified_α`

: Default is`nothing`

. You may set this value and then the function will compute sample size using this pre specified value.

**Further optional Arguments for hypothesis test meta parameters (including assumptions)**

`n`

: Can be an integer denoting the total number of subjects or an array of the number of subjects per sequence group, e.g.`n = [12, 8]`

. In the typical case where the total number of subjects is given, the subjects are distributed as uniformly as possible among sequences of the design using the`distribute_groups`

function. If this argument is not given,`adjusted_α`

calls`samplesize`

to obtain this value.

**Special arguments for reference scaling and/or expanding limits**

`reg_symbol`

: This is the symbol for the`RegulatoryConstants`

object set in either`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

studies. For the former the default is`:fda`

and for the latter it is`:ema`

. You may set other regulatory constants objects if you wish.

**Arguments for simulation**

Note that the arguments `num_sims`

, `seed`

, and `subject_level`

are for Monte Carlo power calculation

When using Monte Carlo, these are the possible arguments.

`num_sims`

: This is the number of simulation runs to execute. The default is`1e5`

.`seed`

: This is the simulation seed to use for reproducibility. The default value is an arbitrary`1984`

value, yet can be set to any integer value. Setting`seed = nothing`

, implies no random seed is set.**Warning: sample size search or power analysis without a fixed seed is not recommended.**.`details`

: Set this to true to output additional simulation and/or computation output. Default is`false`

.`subject_level`

: This argument is by default`false`

and this implies simulations are based on randomly generating statistics. If set to`true`

then it means that each simulation run randomly generates sample data and uses this random data to estimate the power. In general,`subject_level = true`

is slower, yet in certain cases it yields better accuracy.

**Return value**

In case no adjustment is made, the return value is a named tuple similar to this:

```
(before_adjustment = (α = 0.05, type_I_error = 0.03331, achieved_power = 0.82244, n = [13, 13]),
after_adjustment = :no_adjustment_made)
```

In case an adjustment is made, the return value is a named tuple similar to this:

```
(before_adjustment = (α = 0.05, type_I_error = 0.08269, achieved_power = 0.80225, n = [15, 15]),
after_adjustment = (α = 0.028163596987724294, type_I_error = 0.05, achieved_power = 0.71536, n = [15, 15]))
```

`BioequivalencePower.adjusted_α_with_samplesize`

— Method```
adjusted_α_with_samplesize(::Type{BS}, ::Type{D} = EDDefaultDesign;
kwargs...
) where {BS <: BioequivalencePowerStudy, D <: ExperimentalDesign}
```

This is the easy-API `adjusted_α_with_samplesize`

method.

`BS`

and then the design type `D`

. Type names are used for these arguments. For example:

`adjusted_α_with_samplesize(ExpandingLimitsRatioTOST, ED2x3x3PartialReplicate, ...)`

At the moment the only supported study type for `BS`

is `ExpandingLimitsRatioTOST`

.

After these positional arguments, the remaining arguments are indicated in the method signature via `kwargs`

(key word arguments). With these keywords we always need to set the variability parameter, `CV`

. The order of the keywords does not matter. Many other keywords are also possible (see below). Here is a minimal working example:

`adjusted_α_with_samplesize(ExpandingLimitsRatioTOST, ED2x3x3PartialReplicate, CV = 0.35)`

The essence of the easy-API is that the it uses the complete-API under the hood, yet presents a simple interface. For example here, the coefficient of variation `CV = 0.35`

is set in a `ExpandingLimitsRatioTOST{ED2x3x3PartialReplicate}`

object. This object is hidden from the user. The easy-API sees which arguments are supplied and constructs objects based on these arguments before invoking the complete-API internally.

Here is a full list of arguments:

**1st argument**: Must be`ExpandingLimitsRatioTOST`

.**2nd argument**: design. Use one of:`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

, or`ED2x3x3PartialReplicate`

.

The keyword arguments following the initial arguments are always set in the form `KEY = VALUE`

, where for example `KEY`

can be `CV`

and value can be `0.35`

. Here is a full list, starting with mandatory argument and following with optional arguments.

**Mandatory Arguments**

- Variability argument: This is
`CV`

or if wishing to consider heteroscedasticity, specify as a vector of length 2, with the first entry for the test formulation and the second entry for the reference formulation.

**Argument for "test/reference" ratio**

A key input is the ratio between the test and reference formulation. That is, power is computed based on such a postulated point. It is denoted θ₀ with variable name `peθ₀`

. Default is at `0.9`

and you can naturally override that default.

**Argument for limits**

These are set limits values `θ₁`

and `θ₂`

with `θ₁ < θ₂`

. Default values are set for all of these with defaults `θ₁ = 0.8`

and `θ₂ = 1/θ₁`

(this is `1.25`

). You can set your own values to override the defaults. Note that in most cases `θ₂`

is defined in terms of `θ₁`

. Hence you may set `θ₁`

and as a result, `θ₂`

will be adjusted accordingly, or you may set only `θ₂`

, or set both.

**Type I error and α**

`α`

: By default,`α = 0.05`

. This is the desired type I error.

**Further optional Arguments for hypothesis test meta parameters (including assumptions)**

`n`

: Can be an integer denoting the total number of subjects or an array of the number of subjects per sequence group, e.g.`n = [12, 8]`

. In the typical case where the total number of subjects is given, the subjects are distributed as uniformly as possible among sequences of the design using the`distribute_groups`

function. If this argument is not given,`adjusted_α_with_samplesize`

calls`samplesize`

to obtain this value.

**Special arguments for expanding limits**

`reg_symbol`

: This is the symbol for the`RegulatoryConstants`

object set in either`ReferenceScaledRatioTOST`

or`ExpandingLimitsRatioTOST`

studies. For the former the default is`:fda`

and for the latter it is`:ema`

. You may set other regulatory constants objects if you wish.

**Arguments for simulation**

Note that the arguments `num_sims`

, `seed`

, and `subject_level`

are for Monte Carlo power calculation

When using Monte Carlo, these are the possible arguments.

`num_sims`

: This is the number of simulation runs to execute. The default is`1e5`

.`seed`

: This is the simulation seed to use for reproducibility. The default value is an arbitrary`1984`

value, yet can be set to any integer value. Setting`seed = nothing`

, implies no random seed is set.**Warning: sample size search or power analysis without a fixed seed is not recommended.**.`details`

: Set this to true to output additional simulation and/or computation output. Default is`false`

.`subject_level`

: This argument is by default`false`

and this implies simulations are based on randomly generating statistics. If set to`true`

then it means that each simulation run randomly generates sample data and uses this random data to estimate the power. In general,`subject_level = true`

is slower, yet in certain cases it yields better accuracy.

**Other arguments**

The argument `max_iter`

with a default value of `10`

determines an upper bound on the number of `adjusted_α`

function calls.

**Return value**

The same as `adjusted_α`

yet with a corrected sample size if needed.

## Confidence Interval

`StatsAPI.confint`

— Method```
confint(::Type{BS}, ::Type{D} = EDDefaultDesign;
kwargs...
) where {BS <: BioequivalencePowerStudy, D <: ExperimentalDesign}
```

This is the easy-API `confint`

method.

`BS`

and then the design type `D`

. Type names are used for these arguments. For example:

`confint(RatioTOST, ED2x2x3ReplicateCrossover, ...)`

After these positional arguments, the remaining arguments are indicated in the method signature via `kwargs`

(key word arguments). With these keywords we always need to set the number of subjects, `n`

, the variability parameter, `CV`

(can also be `SE`

in certain cases), and the point estimate `peθ₀`

(note that the point estimate has a default value when we use the complete-API but with the easy-API we purposefully do not have a default value). The order of the keywords does not matter. Several other keywords are also possible (see below). Here is a minimal working example:

`confint(RatioTOST, ED2x2x3ReplicateCrossover, n = 20, CV = 0.32, peθ₀ = 0.9)`

The essence of the easy-API is that the it uses the complete-API under the hood, yet presents a simple interface. For example here, the number of subjects, `n = 20`

is automatically set in an `HypothesisTestMetaParams`

object, and the coefficient of variation `CV = 0.32`

is set in a `RatioTOST{ED2x2x3ReplicateCrossover}`

object, similarly for `peθ₀`

. These objects are hidden from the user. The easy-API sees which arguments are supplied and constructs the objects based on these arguments before invoking the complete-API internally.

Here is a full list of arguments:

**1st argument**: bioequivalence power study type. One of:- Standard (average) bioequivalence:
`RatioTOST`

or`DifferenceTOST`

- Tests in the context of fiducial inference:
`FiducialRatioTOST`

- Standard (average) bioequivalence:
**2nd argument**: design.- For the study types
`RatioTOST`

or`DifferenceTOST`

, use one of:`ED2Parallel`

,`ED2x2Crossover`

,`ED3x3Crossover`

,`ED3x6x3Crossover`

,`ED4x4Crossover`

,`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

,`ED2x4x4ReplicateCrossover`

,`ED2x3x3PartialReplicate`

,`ED2x4x2Balaam`

,`ED2x2x2RepeatedCrossover`

, or`EDPaired`

. - For the study type
`FiducialRatioTOST`

use one of`ED2Parallel`

or`ED2x2Crossover`

.

- For the study types

The keyword arguments following the initial arguments are always set in the form `KEY = VALUE`

, where for example `KEY`

can be `n`

and value can be `20`

for indicating the number of subjects. Here is a full list, starting with mandatory arguments and following with optional arguments.

**Mandatory Arguments**

`n`

: Can be an integer denoting the total number of subjects or an array of the number of subjects per sequence group, e.g.`n = [12, 8]`

. In the typical case where the total number of subjects is given, the subjects are distributed as uniformly as possible among sequences of the design using the`distribute_groups`

function.- Variability arguments: The typical variability argument is
`CV`

, but in certain cases`SE`

is used instead. In other cases secondary variability arguments are required. Note that variability arguments are always positive.`RatioTOST`

: Specify`CV`

as a single value.`DifferenceTOST`

: Specify`SE`

as a single value.`FiducialRatioTOST`

: Specify both`SE`

and`SEb`

, each as a single value.

`peθ₀`

: This is the observed point estimate of the "test/reference" ratio or difference.

**Optional Arguments for hypothesis test meta parameters (including assumptions)**

`α`

: By default,`α = 0.05`

unless it using`FiducialRatioTOST`

, where it is set at`0.025`

(note that this adjusted default is only applicable via the easy-API and not via the complete-API).`robust`

: Set this to true for a determination of degrees of freedom using a robust formulation. Default is`false`

.

**Return value**

The return value is a tuple that has the lower and upper limits of the confidence interval.

## p-value

`HypothesisTests.pvalue`

— Method```
pvalue(::Type{BS}, ::Type{D} = EDDefaultDesign;
kwargs...) where {BS <: BioequivalencePowerStudy, D <: ExperimentalDesign}
```

This is the easy-API `pvalue`

method.

`BS`

and then the design type `D`

. Type names are used for these arguments. For example:

`pvalue(RatioTOST, ED2x2x3ReplicateCrossover, ...)`

After these positional arguments, the remaining arguments are indicated in the method signature via `kwargs`

(key word arguments). With these keywords we always need to set the number of subjects, `n`

, the variability parameter, `CV`

or `SE`

, and the point estimate `peθ₀`

(note that the point estimate has a default value when we use the complete-API but with the easy-API we purposefully do not have a default value). The order of the keywords does not matter. Several other keywords are also possible (see below). Here is a minimal working example:

`pvalue(RatioTOST, ED2x2x3ReplicateCrossover, n = 20, CV = 0.32, peθ₀ = 0.9)`

The essence of the easy-API is that the it uses the complete-API under the hood, yet presents a simple interface. For example here, the number of subjects, `n = 20`

is automatically set in an `HypothesisTestMetaParams`

object, and the coefficient of variation `CV = 0.32`

is set in a `RatioTOST{ED2x2x3ReplicateCrossover}`

object, similarly for `peθ₀`

. These objects are hidden from the user. The easy-API sees which arguments are supplied and constructs the objects based on these arguments before invoking the complete-API internally.

Here is a full list of arguments:

**1st argument**: bioequivalence power study type and only standard (average) bioequivalence is supported. Hence the argument is one of`RatioTOST`

or`DifferenceTOST`

.**2nd argument**: design. One of:`ED2Parallel`

,`ED2x2Crossover`

,`ED3x3Crossover`

,`ED3x6x3Crossover`

,`ED4x4Crossover`

,`ED2x2x3ReplicateCrossover`

,`ED2x2x4ReplicateCrossover`

,`ED2x4x4ReplicateCrossover`

,`ED2x3x3PartialReplicate`

,`ED2x4x2Balaam`

,`ED2x2x2RepeatedCrossover`

, or`EDPaired`

.

The keyword arguments following the initial arguments are always set in the form `KEY = VALUE`

, where for example `KEY`

can be `n`

and value can be `20`

for indicating the number of subjects. Here is a full list, starting with mandatory arguments and following with optional arguments.

**Mandatory Arguments**

`n`

: Can be an integer denoting the total number of subjects or an array of the number of subjects per sequence group, e.g.`n = [12, 8]`

. In the typical case where the total number of subjects is given, the subjects are distributed as uniformly as possible among sequences of the design using the`distribute_groups`

function.- Variability arguments: The typical variability argument is
`CV`

, but in certain cases`SE`

is used instead. Note that variability arguments are always positive.`RatioTOST`

: Specify`CV`

as a single value.`DifferenceTOST`

: Specify`SE`

as a single value.

`peθ₀`

: This is the observed point estimate of the "test/reference" ratio or difference.

**Optional Arguments for hypothesis test meta parameters (including assumptions)**

`robust`

: Set this to true for a determination of degrees of freedom using a robust formulation. Default is`false`

.

**Additional arguments**

`both_p_values`

: Set this to`true`

if you wish for the return value to be both the p-values (from each of the one sided tests that make up a TOST). Default is 'false'.

**Return value**

The return value is a p-value, unless `both_p_values = true`

in which case the return value is a tuple of two p-values.