Skip to content

Commit 0296761

Browse files
author
NightlordTW
committed
Add example for unequal TAR
1 parent 3a70f5e commit 0296761

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

vignettes/sampleSize_parallel_2A3E.Rmd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ A more advanced testing approach involves Sequential Adjustment, where the signi
241241

242242
In this example, the sequential adjustment can be implemented by setting the function argument to `adjust = "seq"` and specifying the type of each endpoint through the `type_y` parameter. For instance, we define "AUCinf" as a primary endpoint, while "AUClast" and "Cmax" are designated as secondary endpoints.
243243

244-
245244
```{r}
246245
(N_mp_seq <- sampleSize(
247246
power = 0.9, # Target power

vignettes/sampleSize_parallel_3A3E.Rmd

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ In this example, we aim to establish equivalence for at least two out of three p
166166
* Multiplicity Adjustment: The Bonferroni correction is applied to control for Type I error (`adjust = "bon"`).
167167
* Equivalence Criterion: Equivalence is required for at least two of the three endpoints (`k = 2`).
168168

169-
These settings ensure a robust framework for testing multiple endpoints while maintaining control of the family-wise error rate.
170-
171169
The comparisons and equivalence boundaries can be defined as follows:
172170

173171
```{r}
@@ -190,26 +188,56 @@ list_uequi.tol <- list(
190188
)
191189
```
192190

191+
Finally, we calculate the required sample size:
193192

194193
```{r}
195-
(N_mp <- sampleSize(power = 0.9, # Target power
194+
(N_mp <- sampleSize(power = 0.9, # Target power
196195
alpha = 0.05, # Type I error rate
197196
mu_list = mu_list, # Means for each endpoint and arm
198197
sigma_list = sigma_list, # Standard deviations
199198
list_comparator = list_comparator, # Comparator arms
200199
list_y_comparator = list_y_comparator, # Endpoints to compare
201200
list_lequi.tol = list_lequi.tol, # Lower equivalence boundaries
202201
list_uequi.tol = list_uequi.tol, # Upper equivalence boundaries
203-
k = 2, # Number of endpoints to be equivalent
204-
adjust = "bon", # Bonferroni adjustment
205-
dtype = "parallel", # Trial design type
202+
k = 2, # Number of endpoints required to demonstrate equivalence
203+
adjust = "bon", # Bonferroni adjustment for multiple comparisons
204+
dtype = "parallel", # Trial design type (parallel group)
206205
ctype = "ROM", # Test type: Ratio of Means
207-
vareq = TRUE, # Assume equal variances
206+
vareq = TRUE, # Assume equal variances across arms
208207
lognorm = TRUE, # Log-normal distribution assumption
209208
ncores = 1, # Number of cores for computation
210209
nsim = 1000, # Number of stochastic simulations
211210
seed = 1234)) # Random seed for reproducibility
212211
```
213212

213+
## Unequal Allocation Rates Across Arms
214+
In this example, we build upon the previous setting but introduce unequal allocation rates across the treatment arms. Specifically, we require that the number of patients in the new treatment arm is double the number in each of the reference arms.
215+
216+
This can be achieved by specifying the treatment allocation rate parameter (`TAR`). The rates are provided as a vector, for example: `TAR = c(2, 1, 1)`. This ensures that for every two patients assigned to the new treatment arm, one patient is assigned to each reference arm.
217+
218+
```{r}
219+
(N_mp2 <- sampleSize(power = 0.9, # Target power
220+
alpha = 0.05, # Type I error rate
221+
mu_list = mu_list, # Means for each endpoint and arm
222+
sigma_list = sigma_list, # Standard deviations
223+
list_comparator = list_comparator, # Comparator arms
224+
list_y_comparator = list_y_comparator, # Endpoints to compare
225+
list_lequi.tol = list_lequi.tol, # Lower equivalence boundaries
226+
list_uequi.tol = list_uequi.tol, # Upper equivalence boundaries
227+
k = 2, # Number of endpoints required to demonstrate equivalence
228+
adjust = "bon", # Bonferroni adjustment for multiple comparisons
229+
TAR = c("SB2" = 2, "EUINF" = 1, "USINF" = 1), # Treatment allocation rates
230+
dtype = "parallel", # Trial design type (parallel group)
231+
ctype = "ROM", # Test type: Ratio of Means
232+
vareq = TRUE, # Assume equal variances across arms
233+
lognorm = TRUE, # Log-normal distribution assumption
234+
ncores = 1, # Number of cores for computation
235+
nsim = 1000, # Number of stochastic simulations
236+
seed = 1234)) # Random seed for reproducibility
237+
```
238+
239+
Results from the simulation indicate that `r N_mp2$response$n_SB2` patients are required for SB2 the active treatment arm (SB2), and `r N_mp2$response$n_EUINF` patients are required for each reference arm. The total sample size required is `r N_mp2$response$n_total`. This is significantly larger compared to the previous example, where the total sample size was `r N_mp$response$n_total`.
240+
241+
214242

215243
# References

0 commit comments

Comments
 (0)