# Study Type Details in BioequivalencePower

## Standard (average) Bioequivalence

This section discusses the study types RatioTOST and DifferenceTOST which are used for standard (average) bioequivalence. The study type RatioTOST is the common type to use as it is for hypothesis tests formalized in terms of a ratio. The DifferenceTOST type is for the case of a difference. Unlike some other specialized study types, the RatioTOST and DifferenceTOST types can be combined with all the supported experimental designs. As all studies they have supporting methods of the samplesize and power function. They are also supported by power_analysis. These types also have methods supported by the pvalue and confint functions.

A subtle difference between the RatioTOST and DifferenceTOST types is that in the former the variability parameter is called CV for "coefficient of variation" while in the latter it is called SE for "standard error". This differs from say the PowerTOST the R package, where the parameter name "CV" is always used also in cases when it is not interpreted as a coefficient of variation (square root of variance divided by the mean).

### Statistical background

The standard/basic (average) bioequivalence test uses a Two One Sided T-Test (TOST). In the package we explicitly differentiate between the log scale formulation, RatioTOST where the hypothesis test is:

$$$\begin{array}{ll} H_0:& \frac{T}{R} < \theta_1 \quad \text{or} \quad \theta_2 < \frac{T}{R} \\[10pt] H_1:& \qquad \theta_1 \le \frac{T}{R} \le \theta_2. \end{array}$$$

Here T is the average test formulation and R is the average for the reference formulation. The ratio T/R (ideally at 1), is prescribed via the peθ₀ value. The default values for \theta_1 and \theta_2 are 0.8 and 1.25 respectively. The variability assumed in this test is captured via CV.

An alternative formulation that is less common is the non log scale, or difference formulation, with DifferenceTOST. In this case the hypothesis test is:

$$$\begin{array}{ll} H_0:& T-R < \theta_1 \quad \text{or} \quad \theta_2 < T-R \\[10pt] H_1:& \qquad \theta_1 \le T-R \le \theta_2. \end{array}$$$

In the case of a difference formulation, the difference T-R is ideally at 0 and the default values for \theta_1 and \theta_2 are -0.2 and 0.2 respectively. Note that the variability parameter for this case is called SE.

### Basic examples

samplesize(RatioTOST, ED2x2Crossover; CV = 0.23)
Determined sample size: n = 24  achieved power = 80.665%
HypothesisTestMetaParams Settings:   α = 0.05  target_power = 0.8
Study: RatioTOST{ED2x2Crossover}  CV = 0.23  θ₀ = 0.95  [θ₁, θ₂] = [0.8, 1.25]
samplesize(RatioTOST, ED2x2Crossover; CV = 0.23, target_power = 0.9)
Determined sample size: n = 32  achieved power = 90.443%
HypothesisTestMetaParams Settings:   α = 0.05  target_power = 0.9
Study: RatioTOST{ED2x2Crossover}  CV = 0.23  θ₀ = 0.95  [θ₁, θ₂] = [0.8, 1.25]
samplesize(RatioTOST, ED2x2Crossover; CV = 0.23, target_power = 0.9, peθ₀ = 0.85)
Determined sample size: n = 242  achieved power = 90.044%
HypothesisTestMetaParams Settings:   α = 0.05  target_power = 0.9
Study: RatioTOST{ED2x2Crossover}  CV = 0.23  θ₀ = 0.85  [θ₁, θ₂] = [0.8, 1.25]
power(RatioTOST, ED2x2Crossover; CV = 0.23, peθ₀ = 0.85, n = 242)
Computed achieved power: 90.044%
HypothesisTestMetaParams Settings: n = 242  α = 0.05
Study: RatioTOST{ED2x2Crossover}  CV = 0.23  θ₀ = 0.85  [θ₁, θ₂] = [0.8, 1.25]
power(RatioTOST, ED2x2Crossover; CV = 0.23, peθ₀ = 0.85, n = [110, 132])
Computed achieved power: 89.83%
HypothesisTestMetaParams Settings: n = [110, 132]  α = 0.05
Study: RatioTOST{ED2x2Crossover}  CV = 0.23  θ₀ = 0.85  [θ₁, θ₂] = [0.8, 1.25]
power_analysis(RatioTOST, ED2x2Crossover; CV = 0.23, peθ₀ = 0.85, target_power = 0.9)

### Key docstrings

#### Types

BioequivalencePower.RatioTOSTType
RatioTOST{D}(peθ₀::HTRealParam = 0.95,
θ₁::HTRealParam = 0.8,
θ₂::HTRealParam = 1/θ₁,
CV::HTRealParam = nothing) where D <: ExperimentalDesign

A bioequivalence power study with a ratio formulation. This is the standard (average) bioequivalence study. As in all bioequivalence power studies, θ₁ and θ₂ are the limits, and peθ₀ is the postulated value of the ratio for which power (or sample size) is to be evaluated. CV is the coefficient of variation.

BioequivalencePower.DifferenceTOSTType
DifferenceTOST{D}(  peθ₀::HTRealParam = 0.05,
θ₁::HTRealParam = -0.2,
θ₂::HTRealParam = -θ₁,
SE::HTRealParam = nothing) where D <: ExperimentalDesign

A bioequivalence power study with a difference formulation. As in all bioequivalence power studies, θ₁ and θ₂ are the limits, and peθ₀ is the postulated value of the difference for which power (or sample size) is to be evaluated. SE is the standard error.

#### Power

BioequivalencePower.powerMethod
power(ht::RatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = ExactPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams  where D <: ExperimentalDesign

Calculate the power for RatioTOST. Must set CV in ht and must set n in hp. The power_method can be ExactPowerCalculation (this is default) for numerical integration or MonteCarloPowerCalculation. If MonteCarloPowerCalculation then may set subject_level to true if wishing execute subject level simulations (default is false).

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::DifferenceTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = ExactPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams  where D <: ExperimentalDesign

Calculate the power for DifferenceTOST. Must set SE in ht and must set n in hp. The power_method can be ExactPowerCalculation (this is default) for numerical integration or MonteCarloPowerCalculation. If MonteCarloPowerCalculation then may set subject_level to true if wishing execute subject level simulations (default is false).

See easy-API method doc for full description of the power function.

#### Power Analysis

BioequivalencePower.power_analysisMethod
power_analysis(ht::RatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = DefaultPowerCalculation(),
pac::PowerAnalysisConstants = PowerAnalysisConstants()
) where D <: ExperimentalDesign

Power analysis for a ratio TOST (average bio-equivalence).

See easy-API method doc for full description of the power_analysis function.

#### Confidence interval

StatsAPI.confintMethod
confint(ht::RatioTOST{D}, hp::HypothesisTestMetaParams) where D <: ExperimentalDesign

Calculate a 1-2α CI associated with a ratio bio-equivalence test. Only the point estimate and CV are used from ht.

See easy-API method doc for full description of the confint function.

StatsAPI.confintMethod
confint(ht::DifferenceTOST{D}, hp::HypothesisTestMetaParams) where D <: ExperimentalDesign

Calculate a 1-2α CI associated with a differences bio-equivalence test. Only the point estimate and SE are used from ht.

See easy-API method doc for full description of the confint function.

#### p-value

BioequivalencePower.pvalue(::RatioTOST{D}, ::HypothesisTestMetaParams; both_p_values) where D <: BioequivalencePower.ExperimentalDesign
BioequivalencePower.pvalue(::DifferenceTOST{D}, ::HypothesisTestMetaParams; both_p_values) where D <: BioequivalencePower.ExperimentalDesign

## Reference scaling and/or expanding limits

This section discusses the study types ReferenceScaledRatioTOST and ExpandingLimitsRatioTOST which are used for reference scaling, expanding limits, and reference scaling with expanding limits. These two studies can be combined with the designs ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, and ED2x2x3ReplicateCrossover. As all studies they have supporting methods of the samplesize and power function. They are also supported by power_analysis, and they also can be used with the adjusted_α and adjusted_α_with_samplesizefunctions.

### Basic examples

ReferenceScaledRatioTOST{ED2x2x4ReplicateCrossover}(CV = 0.3)
ReferenceScaledRatioTOST{ED2x2x4ReplicateCrossover}  CV = 0.3  θ₀ = 0.9  [θ₁, θ₂] = [0.8, 1.25]  regulator = :fda
ExpandingLimitsRatioTOST{ED2x2x4ReplicateCrossover}(CV = 0.3)
ExpandingLimitsRatioTOST{ED2x2x4ReplicateCrossover}  CV = 0.3  θ₀ = 0.9  [θ₁, θ₂] = [0.8, 1.25]  regulator = :ema
samplesize(ExpandingLimitsRatioTOST, ED2x3x3PartialReplicate; CV = 0.4, num_sims = 1e7)
Determined sample size: n = 42  achieved power = 80.133%
HypothesisTestMetaParams Settings:   α = 0.05  target_power = 0.8
Study: ExpandingLimitsRatioTOST{ED2x3x3PartialReplicate}  CV = 0.4  θ₀ = 0.9  [θ₁, θ₂] = [0.8, 1.25]  regulator = :ema
power(ExpandingLimitsRatioTOST, ED2x3x3PartialReplicate; CV = 0.4, n = 42, num_sims = 1e7)
Computed achieved power: 80.133%
HypothesisTestMetaParams Settings: n = 42  α = 0.05
Study: ExpandingLimitsRatioTOST{ED2x3x3PartialReplicate}  CV = 0.4  θ₀ = 0.9  [θ₁, θ₂] = [0.8, 1.25]  regulator = :ema
power(ExpandingLimitsRatioTOST, ED2x3x3PartialReplicate; CV = 0.4, n = 42, num_sims = 1e7)
Computed achieved power: 80.133%
HypothesisTestMetaParams Settings: n = 42  α = 0.05
Study: ExpandingLimitsRatioTOST{ED2x3x3PartialReplicate}  CV = 0.4  θ₀ = 0.9  [θ₁, θ₂] = [0.8, 1.25]  regulator = :ema

### Key docstrings

#### Types

BioequivalencePower.ReferenceScaledRatioTOSTType
ReferenceScaledRatioTOST{D}(peθ₀::HTRealParam = 0.9,
θ₁::HTRealParam = 0.8,
θ₂::HTRealParam = 1/θ₁,
CV::HTRealParam = nothing,
reg::RegulatoryConstants = RegulatoryConstants(:fda)
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

BE ratio decision using reference scaled average bioequivalence (RSABE), initially recommended by FDA.

BioequivalencePower.ExpandingLimitsRatioTOSTType
ExpandingLimitsRatioTOST{D}(peθ₀::HTRealParam = 0.9,
θ₁::HTRealParam = 0.8,
θ₂::HTRealParam = 1/θ₁,
CV::HTRealParam = nothing,
reg::RegulatoryConstants = RegulatoryConstants(:ema)
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

BE ratio decision using expanding (widened) limits (ABEL).

#### Power

BioequivalencePower.powerMethod
power(ht::ReferenceScaledRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = MonteCarloPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Calculate power for a ReferenceScaledRatioTOST study. Must set CV and in ht and must set n in hp. The power_method must be MonteCarloPowerCalculation yet there is the power_method.subject_level = false case for approximate statistic level simulation and the power_method.subject_level = true case for subject level simulation.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::ExpandingLimitsRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = MonteCarloPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Calculate power for an ExpandingLimitsRatioTOST study. Must set CV and in ht and must set n in hp. The power_method must be MonteCarloPowerCalculation yet there is the power_method.subject_level = false case for approximate statistic level simulation and the power_method.subject_level = true case for subject level simulation.

See easy-API method doc for full description of the power function.

#### Power Analysis

BioequivalencePower.power_analysisMethod
power_analysis(ht::ReferenceScaledRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = DefaultPowerCalculation(),
pac::PowerAnalysisConstants = PowerAnalysisConstants()
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Power analysis for an ReferenceScaledRatioTOST (reference scaled bio-equivalence).

See easy-API method doc for full description of the power_analysis function.

BioequivalencePower.power_analysisMethod

poweranalysis(ht::ExpandingLimitsRatioTOST{D}, hp::HypothesisTestMetaParams = HypothesisTestMetaParams(); powermethod::PowerCalculationMethod = DefaultPowerCalculation(), pac::PowerAnalysisConstants = PowerAnalysisConstants() ) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Power analysis for an ExpandingLimitsRatioTOST (expanding limits bio-equivalence).

See easy-API method doc for full description of the power_analysis function.

BioequivalencePower.adjusted_αMethod
adjusted_α(ht::ReferenceScaledRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
pre_specified_α = nothing,
power_method::PowerCalculationMethod = MonteCarloPowerCalculation()
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Adjusts α (if needed) for ReferenceScaledRatioTOST.

See easy-API method doc for full description of the adjusted_α function.

BioequivalencePower.adjusted_αMethod
adjusted_α(ht::ExpandingLimitsRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
pre_specified_α = nothing,
power_method::PowerCalculationMethod = MonteCarloPowerCalculation()
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Adjusts α (if needed) for ExpandingLimitsRatioTOST.

See easy-API method doc for full description of the adjusted_α function.

BioequivalencePower.adjusted_α_with_samplesizeMethod
adjusted_α_with_samplesize(ht::ExpandingLimitsRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
max_iter = 10,
power_method::PowerCalculationMethod = MonteCarloPowerCalculation()
) where D <: Union{ED2x3x3PartialReplicate, ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Adjusts α (if needed) and recomputes sample size for target power (if needed). This is for ExpandingLimitsRatioTOST.

See easy-API method doc for full description of the adjusted_α_with_samplesize function.

## Narrow therapeutic drug index products

This section discusses the study type NarrowTherapeuticIndexDrugRatioTOST which is used for NTID studies as well as HVNTID studies (highly variable NTID). This study type can be combined with the designs ED2x2x4ReplicateCrossover, and ED2x2x3ReplicateCrossover. As all studies, this study type has supporting methods of the samplesize and power function. It is also supported by power_analysis.

### Key docstrings

#### Types

BioequivalencePower.NarrowTherapeuticIndexDrugRatioTOSTType
NarrowTherapeuticIndexDrugRatioTOST{D}(highly_variable::Bool = false,
peθ₀::HTRealParam = highly_variable ? 0.95 : 0.975,
θ₁::HTRealParam = 0.8,
θ₂::HTRealParam = 1/θ₁
CV::HTRealParam = nothing,
regulatory_constant = -log(0.9)/0.10,
ratio_threshold = 2.5
) where D <: Union{ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

BE ratio decision using the method intially introduced via FDA for narrow therapeutic index drugs (NTIDs). This also supports HVNTID (highly variable narrow therapeutic index drugs).

#### Power

BioequivalencePower.powerMethod
power(ht::NarrowTherapeuticIndexDrugRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = MonteCarloPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
) where D <: Union{ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Calculate power for a NarrowTherapeuticIndexDrugRatioTOST. NTID is with ht.highly_variable = false and HVNTID (highly variable) is with ht.highly_variable = true. Must set CV and in ht and must set n in hp. The power_method must be MonteCarloPowerCalculation.

See easy-API method doc for full description of the power function.

#### Power Analysis

BioequivalencePower.power_analysisMethod
power_analysis(ht::NarrowTherapeuticIndexDrugRatioTOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = DefaultPowerCalculation(),
pac::PowerAnalysisConstants = PowerAnalysisConstants()
) where D <: Union{ED2x2x4ReplicateCrossover, ED2x2x3ReplicateCrossover}

Power analysis for an HypothesisTestMetaParams (bio-equivalence for NTID).

See easy-API method doc for full description of the power_analysis function.

## Fiducial inference

This section discusses the study type FiducialRatioTOST which is used for hypothesis tests of a ratio where the sample means are assumed to be normally distributed as opposed to the typical log-normal distribution assumptions. This study type can be combined with the designs ED2Parallel and ED2x2Crossover. As all studies this study type have supporting methods of the samplesize and power function. It also has a supporting method for confint.

### Key docstrings

#### Types

BioequivalencePower.FiducialRatioTOSTType
FiducialRatioTOST{D}(peθ₀::HTRealParam = 0.95,
θ₁::HTRealParam = 0.8,
θ₂::HTRealParam = 1/θ₁,
SE::HTRealParam = nothing,
SEb::HTRealParam = nothing) where D <: Union{ED2Parallel, ED2x2Crossover}

Fiducial test for equivalence via ratio (not considered log scale). It works for a parallel or a 2x2 cross over design.

See Hauschke D, Kieser M, Diletti E, Burke M. Sample size determination for proving equivalence based on the ratio of two means for normally distributed data. Stat Med. 1999;18(1):93–105.

Note that in R's PowerTOST package the variability parameters are called CVs, but in the current package we call them SEs.

#### Power

BioequivalencePower.powerMethod
power(ht::FiducialRatioTOST{ED2Parallel},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = MonteCarloPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams

Calculate power for a parallel ratio TOST using Fiducial inference. Must set SE in ht and must set n in hp.

Only MonteCarloPowerCalculation is supported for power_method. Uses formula (14), (15), and surrounding formulas, from Hauschke D, Kieser M, Diletti E, Burke M. "Sample size determination for proving equivalence based on the ratio of two means for normally distributed data." Stat Med. 1999;18(1):93–105.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::FiducialRatioTOST{ED2x2Crossover},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = MonteCarloPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams

Calculate power for a 2x2 crossover ratio TOST using Fiducial inference. Must set SE and SEb in ht and must set n in hp.

Only MonteCarloPowerCalculation is supported for power_method. Uses formulas (14), (17) and (18) from Hauschke D, Kieser M, Diletti E, Burke M. Sample size determination for proving equivalence based on the ratio of two means for normally distributed data. Stat Med. 1999;18(1):93–105.

See easy-API method doc for full description of the power function.

#### Confidence interval

StatsAPI.confintMethod
confint(ht::FiducialRatioTOST{ED2Parallel}, hp::HypothesisTestMetaParams)

Calculate a 1-2α fiducial CI associated. Only the point estimate and SE values are used from ht.

See easy-API method doc for full description of the confint function.

This method for FiducialRatioTOST{ED2Parallel} uses formula (6) with reference = 1, from Hauschke D, Kieser M, Diletti E, Burke M. "Sample size determination for proving equivalence based on the ratio of two means for normally distributed data." Stat Med. 1999;18(1):93–105.

StatsAPI.confintMethod
confint(ht::FiducialRatioTOST{ED2x2Crossover}, hp::HypothesisTestMetaParams)

Calculate a 1-2α fiducial CI associated. Only the point estimate and SE values are used from ht.

See easy-API method doc for full description of the confint function.

This method for FiducialRatioTOST{ED2x2Crossover} uses formula (9) with reference = 1, from Hauschke D, Kieser M, Diletti E, Burke M. "Sample size determination for proving equivalence based on the ratio of two means for normally distributed data. Stat Med. 1999;18(1):93–105."

## Two simultaneous end points

This section discusses the study types TwoDifferenceTOSTs and TwoRatioTOSTs which are used for hypothesis tests for two endpoints (for example both Cmax and AUC). Similarly to the standard (average) bioequivalence study types, this study type can be combined with all the supported experimental designs. As all studies this study type have supporting methods of the samplesize and power function.

### Key docstrings

#### Types

BioequivalencePower.TwoRatioTOSTsType
TwoDifferenceTOSTs{D}(peθ₀::HTRealParam = [0.95, 0.95],
θ₁::HTRealParam = [0.8, 0.8],
θ₂::HTRealParam = 1 ./ θ₁,
SE::HTRealParam = nothing,
ρ::HTRealParam = 0.0) where D <: ExperimentalDesign

Two simultaneous hypotheses for equivalence via ratio (log scale).

BioequivalencePower.TwoDifferenceTOSTsType
TwoDifferenceTOSTs{D}(peθ₀::HTRealParam = [0.05, 0.05],
θ₁::HTRealParam = [-0.2, -0.2],
θ₂::HTRealParam = -θ₁,
SE::HTRealParam = nothing,
ρ::HTRealParam = 0.0) where D <: ExperimentalDesign

Two simultaneous hypotheses for equivalence via difference.

#### Power

BioequivalencePower.powerMethod
power(ht::TwoRatioTOSTs{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = MonteCarloPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Calculate the power for TwoRatioTOSTs. Must set the vector of length 2, CV in ht, and must set n in hp. Only MonteCarloPowerCalculation is supported for power_method.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::TwoDifferenceTOSTs{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = MonteCarloPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Calculate the power for TwoDifferenceTOSTs. Must set the vector of length 2, SE in ht, and must set n in hp. Only MonteCarloPowerCalculation is supported for power_method.

See easy-API method doc for full description of the power function.

## Dose proportionality

This section discusses the study type DoseProportionalityStudy. It can be combined with special design types EDGeneralCrossover, EDGeneralParallel, and EDGeneral. As all studies, this study type has methods of the samplesize and power function. Note that additional support for dose proportionality within Pumas is in the NCA package.

### Key docstrings

#### Types

BioequivalencePower.DoseProportionalityStudyType
DoseProportionalityStudy{D}(doses::Union{Nothing, Vector{Int}} = nothing,
peβ₀::HTRealParam =  1 + log(0.95)/log(maximum(doses) / minimum(doses)),
θ₁::HTRealParam = 0.8,
θ₂::HTRealParam = 1 / θ₁,
CV::HTRealParam = nothing,
CVb::HTRealParam = 2CV,
design::Union{Nothing, D} = nothing
) where D <: Union{EDGeneralCrossover, EDGeneralParallel, EDGeneral}

A dose proprotionality study.

#### Power

BioequivalencePower.powerMethod
power(ht::DoseProportionalityStudy{EDGeneralParallel},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = ExactPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams

Calculate power for a DoseProportionalityStudy with a parallel design. Must set doses and CV in ht, and must set n in hp. The power_method must be MonteCarloPowerCalculation.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::DoseProportionalityStudy{EDGeneralCrossover},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = ExactPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams

Calculate power for a DoseProportionalityStudy with a crossover design. Must set doses and CV in ht, and must set n in hp. The power_method must be MonteCarloPowerCalculation.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::DoseProportionalityStudy{EDGeneral},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = ExactPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams

Calculate power for a DoseProportionalityStudy with a general design. The design needs to have design_matrix specified, and design needs to be set with ht. Must also set doses and CV in ht, and must set n in hp. The power_method must be MonteCarloPowerCalculation.

See easy-API method doc for full description of the power function.

## Non-inferiority

This section discusses the study types NonInferiorityRatioOST and NonInferiorityDifferenceOST which are used for non-inferiority testing and can also be adapted for non-superiority testing. Like the standard (average) bioequivalence study types, the ratio case is for a ratio formulation of the hypothesis and the difference is for a difference formulation. Like the RatioTOST and DifferenceTOST types, the non-inferiority types can be combined with all the supported experimental designs. As all studies they have supporting methods of the samplesize and power function.

Like RatioTOST and DifferenceTOST a subtle difference between NonInferiorityRatioOST and NonInferiorityDifferenceOST is that in the former the variability parameter is called CV for "coefficient of variation" while in the latter it is called SE for "standard error".

### Key docstrings

#### Types

BioequivalencePower.NonInferiorityRatioOSTType
NonInferiorityRatioOST{D}(  peθ₀::HTRealParam = 0.95,
θmargin::HTRealParam = 0.8,
CV::HTRealParam = nothing) where D <: ExperimentalDesign

Non-inferiority ratio OST (One Sided Test). This is a standard one sided t-test formulated as a ratio. Similarly to the difference case, in the common case where θmargin < 1, rejecting the test means non-inferiority. However if we set θmargin > 1, then the test is reversed rejecting it means non-superiority.

In the typical case where θmargin is less than 1, the test is:

H0: T/R ≤ θmargin H1: Otherwise.

So rejecting H0 (e.g. with θmargin = 0.8) implies: T/R > 0.8 or T > 0.8 * R which means it is "close enough" to the reference.

If θmargin is specified as greater than 1, then the test is taken as a "non-superiority ratio OST" with:

H0: T - R diff ≥ θmargin H1: Otherwise.

So rejecting H0 (e.g. with θmargin = 1.2) implies: T/R < 1.2 or T < 1.2*R which means it is "not superior" to the reference.

BioequivalencePower.NonInferiorityDifferenceOSTType
NonInferiorityDifferenceOST{D}(peθ₀::HTRealParam = -0.05,
θmargin::HTRealParam = -0.2,
SE::HTRealParam = nothing) where D <: ExperimentalDesign

Non-inferiority difference OST (One Sided Test). This is a standard one sided t-test formulated as a difference.

In the typical case where θmargin is negative the test is:

H0: T - R diff ≤ θmargin H1: Otherwise.

So rejecting H0 (e.g. with θmargin = -0.2) implies: T - R > -0.2 or T > R - 0.2 which means it is "close enough" to the reference.

If θmargin is specified as positive then the test is taken as a "non-superiority difference OST" with:

H0: T - R diff ≥ θmargin H1: Otherwise.

So rejecting H0 (e.g. with θmargin = 0.2) implies: T - R < 0.2 or T < R + 0.2 which means it is "not superior" to the reference.

#### Power

BioequivalencePower.powerMethod
power(ht::NonInferiorityRatioOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = ExactPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams  where D <: ExperimentalDesign

Calculate power for a NonInferiorityRatioOST (one sided t-test). Must set CV and in ht and must set n in hp. The power_method must be ExactPowerCalculation.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::NonInferiorityDifferenceOST{D},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = ExactPowerCalculation(),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams  where D <: ExperimentalDesign

Calculate power for a NonInferiorityDifferenceOST (one sided t-test). Must set SE and in ht and must set n in hp. The power_method must be ExactPowerCalculation.

See easy-API method doc for full description of the power function.

## Priors on parameters in power studies

This section discusses modifications of standard (average) bioequivalence power studies using a Bayesian paradigm. Specifically, a prior distribution is used to represent the belief of the parameters, and using this distribution expected power is calculated. In turn, sample sizes based on the expected power are used. The basic study types are just like standard (average) bioequivalence, namely RatioTOST and DifferenceTOST. Further all experimental designs can be used with these types. On top of these basic types, we use a prior which can be of one of three forms:

Each one of these types is a BioequivalencePowerStudy, and it encapsulates another study object RatioTOST or DifferenceTOST as well as parameters (and a distributional form) for the prior. The types for parameters are:

As all studies they have supporting methods of the samplesize and power function. They are also supported by power_analysis.

### Key docstrings

#### Prior types

BioequivalencePower.CVSEPriorType
CVSEPrior{T <: BioequivalencePowerStudy, R <: PriorParameters}(ht::T, pp::R)

A prior on the CV (or SE), for some test ht and prior parameters pp.

BioequivalencePower.θ0PriorType
θ0Prior{T <: BioequivalencePowerStudy, R <: PriorParameters}(ht::T, pp::R)

A prior on the θ₀, for some test ht and prior parameters pp.

BioequivalencePower.BothCVSEandθ0PriorType
BothCVSEandθ0Prior{T <: BioequivalencePowerStudy, R <: PriorParameters}(ht::T, pp::R)

A prior both on the CV (or SE) and on the θ₀, for some test ht and prior parameters pp.

#### Parameter types (parameters and distribution are implied)

BioequivalencePower.TwoWayCategoricalPriorParametersType
TwoWayCategoricalPriorParameters(param_values_1::HTRealParam = nothing,
param_probabilities_1::HTRealParam = nothing,
param_values_2::HTRealParam = nothing,
param_probabilities_2::HTRealParam = nothing)

Used for a distribution over a two way (2d grid) of finite set of param values as a prior.

#### Power (expected) for RatioTOST

##### Prior on CV
BioequivalencePower.powerMethod
power(ht::CVSEPrior{RatioTOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{RatioTOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a ratio TOST when CV has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::CVSEPrior{RatioTOST{D}, DegreesOfFreedomPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{RatioTOST{D}, DegreesOfFreedomPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a ratio TOST when CV has a degrees of freedom prior.

See easy-API method doc for full description of the power function.

##### Prior on θ₀
BioequivalencePower.powerMethod
power(ht::θ0Prior{RatioTOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{RatioTOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a ratio TOST when θ₀ has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::θ0Prior{RatioTOST{D}, StandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{RatioTOST{D}, StandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a difference TOST when θ₀ has a standard error prior.

See easy-API method doc for full description of the power function.

##### Prior on both CV and θ₀
BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{RatioTOST{D}, TwoWayCategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{RatioTOST{D}, TwoWayCategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a ratio TOST when both CV and θ₀ have a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{RatioTOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{RatioTOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a ratio TOST when both CV and θ₀ have a degrees of freedom and standard error prior.

See easy-API method doc for full description of the power function.

#### Power (expected) for DifferenceTOST

##### Prior on CV
BioequivalencePower.powerMethod
power(ht::CVSEPrior{DifferenceTOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{DifferenceTOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a difference TOST when SE has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::CVSEPrior{DifferenceTOST{D}, DegreesOfFreedomPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{DifferenceTOST{D}, DegreesOfFreedomPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a difference TOST when SE has a degrees of freedom prior.

See easy-API method doc for full description of the power function.

##### Prior on θ₀
BioequivalencePower.powerMethod
power(ht::θ0Prior{DifferenceTOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{DifferenceTOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a difference TOST when θ₀ has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::θ0Prior{DifferenceTOST{D}, StandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{DifferenceTOST{D}, StandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a difference TOST when θ₀ has a standard error prior.

See easy-API method doc for full description of the power function.

##### Prior on both CV and θ₀
BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{DifferenceTOST{D}, TwoWayCategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{DifferenceTOST{D}, TwoWayCategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a difference TOST when both SE and θ₀ have a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{DifferenceTOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{DifferenceTOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a difference TOST when both SE and θ₀ have a degrees of freedom and standard error prior.

See easy-API method doc for full description of the power function.

#### Power (expected) for NonInferiorityRatioOST

##### Prior on CV
BioequivalencePower.powerMethod
power(ht::CVSEPrior{NonInferiorityRatioOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{NonInferiorityRatioOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority ratio one sided test when CV has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::CVSEPrior{NonInferiorityRatioOST{D}, DegreesOfFreedomPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{NonInferiorityRatioOST{D}, DegreesOfFreedomPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority ratio one sided test when CV has a degrees of freedom prior.

See easy-API method doc for full description of the power function.

##### Prior on θ₀
BioequivalencePower.powerMethod
power(ht::θ0Prior{NonInferiorityRatioOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{NonInferiorityRatioOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority ratio one sided test when when θ₀ has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::θ0Prior{NonInferiorityRatioOST{D}, StandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{NonInferiorityRatioOST{D}, StandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority ratio one sided test when θ₀ has a standard error prior.

See easy-API method doc for full description of the power function.

##### Prior on both CV and θ₀
BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{NonInferiorityRatioOST{D}, TwoWayCategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{NonInferiorityRatioOST{D}, TwoWayCategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority ratio one sided test when both CV and θ₀ have a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{NonInferiorityRatioOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{NonInferiorityRatioOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority ratio one sided test when both CV and θ₀ have a degrees of freedom and standard error prior.

See easy-API method doc for full description of the power function.

#### Power (expected) for NonInferiorityDifferenceOST

##### Prior on CV
BioequivalencePower.powerMethod
power(ht::CVSEPrior{NonInferiorityDifferenceOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{NonInferiorityDifferenceOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority difference one sided test when SE has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::CVSEPrior{NonInferiorityDifferenceOST{D}, DegreesOfFreedomPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(CVSEPrior{NonInferiorityDifferenceOST{D}, DegreesOfFreedomPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority difference one sided test when SE has a degrees of freedom prior.

See easy-API method doc for full description of the power function.

##### Prior on θ₀
BioequivalencePower.powerMethod
power(ht::θ0Prior{NonInferiorityDifferenceOST{D}, CategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{NonInferiorityDifferenceOST{D}, CategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority difference one sided test when θ₀ has a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::θ0Prior{NonInferiorityDifferenceOST{D}, StandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(θ0Prior{NonInferiorityDifferenceOST{D}, StandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority difference one sided test when θ₀ has a standard error prior.

See easy-API method doc for full description of the power function.

##### Prior on both CV and θ₀
BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{NonInferiorityDifferenceOST{D}, TwoWayCategoricalPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{NonInferiorityDifferenceOST{D}, TwoWayCategoricalPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority difference one sided test when both SE and θ₀ have a categorical prior.

See easy-API method doc for full description of the power function.

BioequivalencePower.powerMethod
power(ht::BothCVSEandθ0Prior{NonInferiorityDifferenceOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters},
hp::HypothesisTestMetaParams = HypothesisTestMetaParams();
power_method::PowerCalculationMethod = default_power_method(BothCVSEandθ0Prior{NonInferiorityDifferenceOST{D}, DegreesOfFreedomAndStandardErrorPriorParameters}),
set_study_type_in_return::Bool = true,
verbose = true
)::HypothesisTestMetaParams where D <: ExperimentalDesign

Expected power of a non inferiority difference one sided test when both CV and θ₀ have a degrees of freedom and standard error prior.

See easy-API method doc for full description of the power function.