# Main Vignette

# Introduction

The package contains functions to calculate power and estimate sample size for various study designs used in (not only bio-) equivalence studies. Power and sample size can be obtained based on different methods, amongst them prominently the TOST procedure (Two One-Sided t-Tests).
Version 1.5.3 built 2021-01-18 with R 4.0.3.

For an overview of supported designs, methods, and defaults together with some basic examples see

- README of the released version on CRAN;
- README of the development version on GitHub.

### Details and examples are accessible via the menu bar on top of the page and in the online manual of all functions.

# Abbreviations, Definition of Terms, Models

2×2×2
  Crossover design with 2 treatments, 2 sequences, and 2 periods. In the literature also TR|RT or AB|AB. In the functions `2x2x2` or `2x2` for short.
2x2x3
  Full replicate designs with 2 treatments, 2 sequences, and 3 periods (TRT|RTR or TRR|RTT). Both T and R are administered twice to ½ of the subjects.
2x2x4
  Full replicate designs with 2 treatments, 2 sequences, and 4 periods (TRTR|RTRT, TRRT|RTTR, or TTRR|RRTT). Both T and R are administered twice to ½ of the subjects.
2×3×3
  Partial (or semi-) replicate design with 2 treatments, 3 sequences, and 3 periods (TRR|RTR|RRT or TRR|RTR). R is administered to all subjects twice and T once. The former is popular (though not optimal) and the latter (a.k.a. extra-reference design) not optimal because it is biased in the presence of period effects.
2×4×2
  Full replicate design with 2 treatments, 4 sequences, and 2 periods (TR|RT|TT|RR, Balaam’s design). Not optimal due to poor power characteristics.
2×4×4
  Full replicate designs with 2 treatments, 4 sequences, and 4 periods (TRTR|RTRT|TRRT|RTTR or TRTR|RTRT|TTRR|RRTT).
3×3, 3×6×3
  Higher-order crossover designs with 3 treatments, 3 or 6 sequences, and 3 periods (Latin Square ABC|BCA|CAB or the Williams’ design ABC|ACB|BAC|BCA|CAB|CBA). In the functions `3x3` and `3x6x3`. Both have the same degrees of freedom (2n–4) in the conventional approach and therefore, require the same number of subjects.
4×4
  Higher-order crossover design with 4 treatments, 4 sequences, and 4 periods (Latin Square ABCD|BCDA|CDAB|DABC or any of the six Williams’ designs ADBC|BACD|CBDA|DCAB, ADCB|BCDA|CABD|DBAC, ACDB|BDCA|CBAD|DABC, ACBD|BADC|CDAB|DBCA, ABDC|BCAD|CDBA|DACB, ABCD|BDAC|CADB|DCBA).
ABE
  Average Bioequivalence with fixed limits based on a clinically not relevant difference \(\small{\Delta}\). The common \(\small{\Delta}\) 0.20 leads to \(\small{\theta_1=1-\Delta,\:\theta_2=1/(1-\Delta)}\) or 80.00–125.00%. For NTIDs (EMA and other jurisdicions) \(\small{\Delta}\) 0.10 (90.00–111.11%). For highly variable Cmax (Russian Federation, EEU, GCC) \(\small{\Delta}\) 0.25 (75.00–133.33%).\[\small{H_0:\mu_\textrm{T}/\mu_\textrm{R}\notin \left [ \theta_1,\theta_2 \right ]\:vs\:H_1:\theta_1<\mu_\textrm{T}/\mu_\textrm{R}<\theta_2}\]
ABEL
  Average Bioequivalence with expanding limits (see also L, U). Same model like for ABE but \(\small{\theta_1,\theta_2}\) are based on the CVwR observed in the study.
\(\alpha\)
  Nominal level of the test. In tests for equivalence commonly 0.05 (except for the ratio of two means with normality on original scale based on Fieller’s (‘fiducial’) confidence interval in function `sampleN.RatioF()` and for non-inferiority/-superiority in function `sampleN.noninf()`, where it is 0.025). In the functions `alpha`.
\(\beta\)
  Probability that the Null-hypothesis of inequivalence is falsely not rejected. Also the type II error or producer’s risk, where \(\small{\beta=1-\pi}\).
\(\beta_0\)
  Assumed or true slope of the (linearized) power model of dose-proportionality \(\small{x=\alpha\cdot dose^{\,\beta},\:\log_{e}x=\alpha+\beta\cdot \log_{e}dose}\). Argument `beta0`.
CV
  Coefficient of variation
    Calculated from the residual error of the model of log-transformed data as \(\small{CV=\sqrt{\exp (\sigma^2)+1}}\).
    - In crossover designs the within- (intra-) subject CV. Argument `CV`.
    - In parallel designs the total (pooled) CV. Argument `CV`.
    - In replicate designs the intra-subject CV (assuming homoscedasticity, argument `CV`). If heteroscedasticity is assumed, `CV` has to given as a vector with two elements `CV = c(x, y)`, where `CV[1]` is CVwT and `CV[2]` is CVwR.
CVb
  Between- (inter-) subject coefficient of variation. Argument `CVb` is required in function `sampleN.RatioF()` and in function `sampleN.dp()` if `design = "IBD"` (incomplete block design).
CVcap
  Upper cap in ABEL. If CVwR > CVcap, expanding is based on CVcap (and not on CVwR). In all jurisdictions 50%, except for Health Canada, where CVcap ≈57.4%.
CVswitch
  Switching coefficient of variation in reference-scaling. Only above this value reference-scaling is acceptable. For highly variable drugs / drug products 30% (CV0 0.30, s0 0.294).
CVwR
  Within-subject coefficient of variation of R; can be estimated in any replicate design.
CVwT
  Within-subject coefficient of variation of T; can be estimated only in full replicate designs.
\(\small{\Delta}\)
  Clinically not relevant difference. Commonly 0.20. For NTIDs (EMA and other jurisdictions) \(\small{\Delta}\) 0.10, for Cmax (Russian Federation, EEU, GCC) \(\small{\Delta}\) 0.25.
HVD(P)
  Highly variable drug (product); commonly defined with a CVwR of ≥30%. HVDs exhibit highly variable clearances (CVwR ≥30% if administered as a solution), whereas HVDPs may additionally – or solely – show highly variable absorption. HVDP(s) generally are ones with a flat dose-response curve.
k
  Regulatory constant (also \(\small{\theta_\textrm{s}}\))

    ABEL: Based on the switching coefficient of variation \(\small{CV_0=30\%}\). \(\small{k=\log_{e}1.25/\sqrt{\log_{e}(CV_{0}^{2}+1)}\approx 0.760}\).

    RSABE: Based on the switching standard deviation \(\small{s_0=0.25}\). \(\small{k=\log_{e}1.25/0.25\approx 0.8926}\).
L, U
  ABEL, RSABE
    ABEL: Lower and upper expanded limits.
    - 30% < CVwR ≤ 50%: Based on \(\small{s_\textrm{wR}}\). \(\small{\left[ {L,\,U} \right] = 100\cdot \exp (\mp 0.760 \cdot {s_\textrm{wR}})}\)
    - CVwR > CVcap: Applying \(\small{s^*_\textrm{wR}=\sqrt{\log_{e}(CV_\textrm{cap}^{2}+1)}}\) in the expansion formula: \(\small{\left[ {L,\,U} \right] = {69.84 - 143.19\%}}\). All jurisdictions except Health Canada, where \(\small{\left[ {L,\,U} \right] = {66.7 - 150.0\%}}\).
    RSABE: Lower and upper ‘implied limits’.
    - If \(\small{s_\textrm{wR}\geq 0.294: \left[ {L,\: U} \right] = 100\cdot \exp (\mp 0.8926 \cdot {s_\textrm{wR}})}\)
  Dose-Proportionality

    \(\small{\left[ {L,\,U} \right]=\left[1+\log_{e}0.80/\log_{e}rd,\:1+\log_{e}1.25/\log_{e}rd \right]}\)

margin
  Non-inferiority/-superiority margin (example for `logscale = TRUE` where \(\theta_0=\mu_\textrm{T}/\mu_\textrm{R}\)).

    Non-inferiority: If margin < 1, higher responses are are assumed to be better. \[\small{H_0:\,\theta_0 \leq \log_{e}\textrm{margin}\:vs\:H_1:\,\theta_0>\log_{e}\textrm{margin}}\]

    Non-superiority: If margin > 1, lower responses are are assumed to be better. \[\small{H_0:\,\theta_0 \geq \log_{e}\textrm{margin}\:vs\:H_1:\,\theta_0<\log_{e}\textrm{margin}}\]
n
  (Total) number of subjects.
nseq
  Number of sequences.
NTID
  Narrow therapeutic index drug, i.e., with a steep dose-response curve. A.k.a. NRD (Narrow Range Drug).
\(\pi\)
  Target (or desired) power in study planning. Commonly set to 0.80 – 0.90. In the functions `targetpower`.
R
  Reference (treatment, product).
rd
  Ratio of the highest/lowest dose. In the functions `rd`.
`robust`
  Selects degrees of freedom according to Senn’s basic estimator, where \(\small{df=n-n_\textrm{seq}}\).
RSABE
  Reference-scaled Average Bioequivalence (U.S. FDA, China NMPA-CDE). Applicable if the intra-subject variability of the reference treatment swR ≥0.294 (CVwR ≈ 30%). The linearized model is \[\small{H_0:(\mu_\textrm{T}/\mu_\textrm{R})^2-\theta_\textrm{s}\cdot s_\textrm{wR}^{2}>0\:vs\:H_1:(\mu_\textrm{T}/\mu_\textrm{R})^2-\theta_\textrm{s}\cdot s_\textrm{wR}^{2}\leq 0}\] See also ABEL.
\(\theta_0\)
  Assumed or true T/R-ratio (`logscale = TRUE`) or difference T – R (`logscale = FALSE`). In the functions `theta0`.
\(\theta_1,\theta_2\)
  Lower and upper limits of the equivalence range. In the functions `theta1` and `theta2`.
\(\theta_s\)
  Regulatory constant in reference-scaling (see also k).
T
  Test (treatment, product).
TIE (type I error)
  Probability that the Null-hypothesis of inequivalence is falsely rejected (i.e., equivalence is concluded). Also the patient’s risk. Can be assessed with the power-functions setting `theta0 = theta2` or `theta0 = theta1`.
  Exact, except in reference-scaling based on simulations (`power.scABEL()`, `power.RSABE()`, `power.NTIDFDA()`, `power.HVNTID()`).

# A Note on Rounding

In all functions sample sizes are estimated based on equivalence margins [\(\small{\theta_1,\theta_2}\)] in full numeric precision. The widened margins for highly variable Cmax are \(\small{\theta_1=0.75,}\) \(\small{\theta_2=1/\theta_1=1.\dot{3}}\) and not the rounded 75.00 – 133.33% according to the guidelines of the Russian Federation, the EEU, and the GCC. If for a NTID `theta1 = 0.90` is specified, \(\small{\theta_2=1/\theta_1=1.\dot{1}}\) and not the rounded 111.11% as in the guidelines. Health Canada requires rounding to only one decimal place with bioequivalence margins for NTIDs of 90.0 – 112.0%.
Estimated sample sizes are generally not affected or – in extremely rare cases – conservative.

Example for a HVDP (\(\small{\theta_0}\) 0.90, design 2x2x4) and a NTID (\(\small{\theta_0}\) 0.975, design 2x2x2):

    #     CV     agency method   L       U     n   theta1   theta2  n
    #  0.574        EMA   ABEL 69.84% 143.19% 30 0.698368 1.431910 30
    #  0.574         HC   ABEL 66.7 % 150.0 % 28 0.666667 1.500000 28
    #  0.574 RU/EEU/GGC    ABE 75.00% 133.33% 34 0.750000 1.333333 34
    #  0.100        EMA    ABE 90.00% 111.11% 22 0.900000 1.111111 22
    #  0.100         HC    ABE 90.0 % 112.0 % 22 0.900000 1.111111 22

# Installation

You can install the released version of PowerTOST from CRAN with …

    package <- "PowerTOST"
    inst    <- package %in% installed.packages()
    if (length(package[!inst]) > 0) install.packages(package[!inst])

… and the development version from GitHub with

    # install.packages("remotes")
    remotes::install_github("Detlew/PowerTOST")

Skips installation from a github remote if the SHA-1 has not changed since last install. Use `force = TRUE` to force installation.

# Contributors

- Detlew Labes (author, maintainer)
- Helmut Schütz (author)
- Benjamin Lang (author)

# Session Information

Inspect this information for reproducibility. Of particular importance are the versions of R and the packages used to create this workflow. It is considered good practice to record this information with every analysis.

    options(width = 80)
    devtools::session_info()
    # - Session info ---------------------------------------------------------------
    #  setting  value
    #  version  R version 4.0.3 (2020-10-10)
    #  os       Windows 10 x64
    #  system   x86_64, mingw32
    #  ui       RTerm
    #  language EN
    #  collate  C
    #  ctype    German_Germany.1252
    #  tz       Europe/Berlin
    #  date     2021-01-18
    #
    # - Packages -------------------------------------------------------------------
    #  package       * version date       lib source
    #  AlgDesign       1.2.0   2019-11-29 [2] CRAN (R 4.0.0)
    #  assertthat      0.2.1   2019-03-21 [2] CRAN (R 4.0.0)
    #  callr           3.5.1   2020-10-13 [2] CRAN (R 4.0.3)
    #  cli             2.2.0   2020-11-20 [2] CRAN (R 4.0.3)
    #  crayon          1.3.4   2017-09-16 [2] CRAN (R 4.0.0)
    #  crossdes        1.1-1   2013-03-18 [2] CRAN (R 4.0.0)
    #  cubature        2.0.4.1 2020-07-06 [2] CRAN (R 4.0.2)
    #  desc            1.2.0   2018-05-01 [2] CRAN (R 4.0.0)
    #  devtools        2.3.2   2020-09-18 [2] CRAN (R 4.0.2)
    #  digest          0.6.27  2020-10-24 [2] CRAN (R 4.0.3)
    #  ellipsis        0.3.1   2020-05-15 [2] CRAN (R 4.0.0)
    #  evaluate        0.14    2019-05-28 [2] CRAN (R 4.0.0)
    #  fansi           0.4.1   2020-01-08 [2] CRAN (R 4.0.0)
    #  fs              1.5.0   2020-07-31 [2] CRAN (R 4.0.2)
    #  glue            1.4.2   2020-08-27 [2] CRAN (R 4.0.2)
    #  gtools          3.8.2   2020-03-31 [2] CRAN (R 4.0.0)
    #  htmltools       0.5.0   2020-06-16 [2] CRAN (R 4.0.3)
    #  knitr           1.30    2020-09-22 [2] CRAN (R 4.0.2)
    #  lifecycle       0.2.0   2020-03-06 [2] CRAN (R 4.0.0)
    #  magrittr        2.0.1   2020-11-17 [2] CRAN (R 4.0.3)
    #  memoise         1.1.0   2017-04-21 [2] CRAN (R 4.0.0)
    #  mvtnorm         1.1-1   2020-06-09 [2] CRAN (R 4.0.0)
    #  pkgbuild        1.2.0   2020-12-15 [2] CRAN (R 4.0.3)
    #  pkgload         1.1.0   2020-05-29 [2] CRAN (R 4.0.0)
    #  PowerTOST     * 1.5-3   2021-01-18 [1] local
    #  prettyunits     1.1.1   2020-01-24 [2] CRAN (R 4.0.0)
    #  processx        3.4.5   2020-11-30 [2] CRAN (R 4.0.3)
    #  ps              1.5.0   2020-12-05 [2] CRAN (R 4.0.3)
    #  purrr           0.3.4   2020-04-17 [2] CRAN (R 4.0.0)
    #  R6              2.5.0   2020-10-28 [2] CRAN (R 4.0.3)
    #  Rcpp            1.0.5   2020-07-06 [2] CRAN (R 4.0.2)
    #  remotes         2.2.0   2020-07-21 [2] CRAN (R 4.0.2)
    #  rlang           0.4.9   2020-11-26 [2] CRAN (R 4.0.3)
    #  rmarkdown       2.6     2020-12-14 [2] CRAN (R 4.0.3)
    #  rprojroot       2.0.2   2020-11-15 [2] CRAN (R 4.0.3)
    #  sessioninfo     1.1.1   2018-11-05 [2] CRAN (R 4.0.0)
    #  stringi         1.5.3   2020-09-09 [2] CRAN (R 4.0.2)
    #  stringr         1.4.0   2019-02-10 [2] CRAN (R 4.0.0)
    #  TeachingDemos   2.12    2020-04-07 [2] CRAN (R 4.0.0)
    #  testthat        3.0.1   2020-12-17 [2] CRAN (R 4.0.3)
    #  tufte           0.9     2020-12-02 [2] CRAN (R 4.0.3)
    #  usethis         2.0.0   2020-12-10 [2] CRAN (R 4.0.3)
    #  withr           2.4.0   2021-01-16 [2] CRAN (R 4.0.3)
    #  xfun            0.19    2020-10-30 [2] CRAN (R 4.0.3)
    #  yaml            2.2.1   2020-02-01 [2] CRAN (R 4.0.0)
    #
    # [1] C:/Users/Detlew/AppData/Local/Temp/RtmpwdtAlH/Rinst1435c17f57c19
    # [2] C:/Program Files/R/library
    # [3] C:/Program Files/R/R-4.0.3/library

# License

#### Helmut Schütz 2021-01-18

GPL-3