Skip to content

Commit fce0dae

Browse files
author
NightlordTW
committed
Add vignette
1 parent 80cfaa2 commit fce0dae

File tree

4 files changed

+112
-3
lines changed

4 files changed

+112
-3
lines changed

man/print.simss.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sampleSize.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/sampleSize_parallel.Rmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ ss <- sampleSize(power = 0.8, alpha = 0.05,
6666
adjust = "no", ncores = 1, nsim = 10000, seed = 1234)
6767
ss
6868
```
69-
For 80\% power, a total of `r ss$response$n_total` would be required.
69+
For 80\% power, a total of `r ss$response$n_total` subjects would be required.
70+
71+
As an alternative scenario, consider that the standard deviation of the log-transformed response variable is unknown, but the standard deviation on the original scale is known ($\sigma = 1$). In such cases, the [sampleSize()](../reference/sampleSize.html) function can still accommodate adjustments to handle these uncertainties by transforming parameters accordingly. We now provide all data on the raw scale, including equivalence bounds, and set `ctype = ROM` and `lognorm = TRUE`:
7072

7173

7274
# Multiple Correlated Co-Primary Endpoints
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: "Bioequivalence Tests for Parallel Trial Designs: 3 Arms, 1 Endpoint"
3+
author: "Thomas Debray"
4+
date: "`r format(Sys.time(), '%B %d, %Y')`"
5+
output:
6+
html_document:
7+
fig_caption: yes
8+
fig_width: 9
9+
fig_height: 6
10+
vignette: >
11+
%\VignetteIndexEntry{Bioequivalence Tests for Parallel Trial Designs: 3 Arms, 1 Endpoint}
12+
%\VignetteEngine{knitr::rmarkdown}
13+
%\VignetteEncoding{UTF-8}
14+
bibliography: 'references.bib'
15+
link-citations: yes
16+
---
17+
18+
```{r setup, include=FALSE, message = FALSE, warning = FALSE}
19+
knitr::opts_chunk$set(echo = TRUE)
20+
knitr::opts_chunk$set(comment = "#>", collapse = TRUE)
21+
options(rmarkdown.html_vignette.check_title = FALSE) #title of doc does not match vignette title
22+
doc.cache <- T #for cran; change to F
23+
```
24+
25+
This vignette demonstrates advanced sample size calculation techniques for parallel trial designs involving three arms and one endpoint. Specifically, we calculate the required sample size to test bioequivalence between a new treatment (SB2) and a reference drug (Remicade) administered in two different locations ("EU_Remicade" and "USA_Remicade"). The endpoint of interest is the Area Under the Curve (AUCinf), a commonly used pharmacokinetic measure.
26+
27+
In this example, we assume the endpoint follows a log-normal distribution with equal variances across arms. The goal is to determine the sample size needed to achieve 90\% power while controlling the type I error rate at 5\%. The equivalence margin is defined as $E_L = 80\%$ and $E_U = 125\%$ of the reference mean on the original scale.
28+
29+
The methods presented in this vignette build on fundamental bioequivalence testing concepts and extend them to multi-arm scenarios. These examples provide practical insights for designing robust parallel trials with complex equivalence testing requirements.
30+
31+
For the primary outcome, AUCinf, we assume the data is available on the original scale, including the mean and standard deviation for each arm. This information is organized into a structured data table for further analysis:
32+
33+
34+
```{r setup, echo = T, message=F}
35+
library(SimTOST)
36+
37+
data <- data.table::data.table(arm = c("SB2","EU_Remicade","USA_Remicade"),
38+
mean = c(37162.0, 37705.0, 37702.8),
39+
sd = c(11113.62172, 12332.41615,12113.72))
40+
```
41+
42+
# Sample Size Calculation for AUCinf: Equivalence to EU Remicade
43+
44+
This example demonstrates how to calculate the sample size required when testing the equivalence of SB2 to a reference drug, Remicade, as administered in Europe. The goal is to determine the minimum number of participants needed to ensure adequate power for the equivalence test.
45+
46+
## Hypotheses
47+
48+
Null Hypothesis (No Equivalence):
49+
$$H_0: \frac{\mu_{SB2}}{\mu_{RemEU}} \le E_L ~~ or~~ \frac{\mu_{SB2}}{\mu_{RemEU}} \ge E_U$$
50+
51+
Alternative Hypothesis (Equivalence):
52+
53+
$$H_1: E_L<\frac{\mu_{SB2}}{\mu_{RemEU}} < E_U$$
54+
55+
Here, $E_L$ and $E_U$ represent the lower and upper equivalence margins, respectively.
56+
57+
58+
## Preparing the function arguments
59+
60+
To proceed with the sample size calculation, we first need to organize the mean and standard deviation values of each arm (SB2, EU Remicade, USA Remicade) into appropriate lists.
61+
62+
Since this example focuses on a single endpoint, the mean list (`mu_list`) contains three scalar elements corresponding to each arm, and the standard deviation list (`sigma_list`) contains three 1x1 matrix elements.
63+
64+
```{r}
65+
mu_list <- as.list(data$mean) # Organize mean values into a list
66+
sigma_list <- as.list(data$sd) # Organize standard deviation values into a list
67+
```
68+
69+
Next, we define the comparison parameters, including the lower (`lequi.tol`) and upper (`uequi.tol`) equivalence boundaries, as well as the list of comparators. Since we are only comparing two arms (SB2 and EU Remicade), the list of comparators contains a single element specifying these two arms:
70+
71+
```{r}
72+
list_comparator <- list("Comparison" = c("SB2","EU_Remicade"))
73+
list_lequi.tol <- list("Comparison" = 0.8)
74+
list_uequi.tol <- list("Comparison" = 1/0.8)
75+
```
76+
77+
## Computing Sample Size
78+
79+
Finally, we use the [sampleSize()](../reference/sampleSize.html) function to calculate the required sample size based on stochastic simulations of the trial. The function accepts several parameters, such as the desired power, confidence level, and design specifications. By default, it assumes:
80+
81+
* A parallel design,
82+
* A test based on the rate of means (ROM),
83+
* Equal variances across arms,
84+
* A lognormal distribution for the endpoint.
85+
86+
87+
```{r}
88+
AUCinf_1comp <- sampleSize(
89+
power = 0.9, # Target power
90+
alpha = 0.05, # Confidence level
91+
arm_names = data$arm, # Names of trial arms
92+
list_comparator = list_comparator, # Comparator configuration
93+
mu_list = mu_list, # Mean values
94+
sigma_list = sigma_list, # Standard deviation values
95+
list_lequi.tol = list_lequi.tol, # Lower equivalence boundary
96+
list_uequi.tol = list_uequi.tol, # Upper equivalence boundary
97+
ncores = 1, # Number of cores for computation
98+
nsim = 1000 # Number of stochastic simulations
99+
)
100+
101+
AUCinf_1comp
102+
```
103+
104+
Based on the table, the required sample size for this trial setting is `r AUCinf_1comp$response$n_total` or `r AUCinf_1comp$response$n_SB2`for each arm.
105+
106+
107+
# References

0 commit comments

Comments
 (0)