Skip to content

Commit

Permalink
Add example for unequal TAR
Browse files Browse the repository at this point in the history
  • Loading branch information
NightlordTW committed Jan 11, 2025
1 parent 3a70f5e commit 0296761
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
1 change: 0 additions & 1 deletion vignettes/sampleSize_parallel_2A3E.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ A more advanced testing approach involves Sequential Adjustment, where the signi

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.


```{r}
(N_mp_seq <- sampleSize(
power = 0.9, # Target power
Expand Down
42 changes: 35 additions & 7 deletions vignettes/sampleSize_parallel_3A3E.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ In this example, we aim to establish equivalence for at least two out of three p
* Multiplicity Adjustment: The Bonferroni correction is applied to control for Type I error (`adjust = "bon"`).
* Equivalence Criterion: Equivalence is required for at least two of the three endpoints (`k = 2`).

These settings ensure a robust framework for testing multiple endpoints while maintaining control of the family-wise error rate.

The comparisons and equivalence boundaries can be defined as follows:

```{r}
Expand All @@ -190,26 +188,56 @@ list_uequi.tol <- list(
)
```

Finally, we calculate the required sample size:

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

## Unequal Allocation Rates Across Arms
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.

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.

```{r}
(N_mp2 <- sampleSize(power = 0.9, # Target power
alpha = 0.05, # Type I error rate
mu_list = mu_list, # Means for each endpoint and arm
sigma_list = sigma_list, # Standard deviations
list_comparator = list_comparator, # Comparator arms
list_y_comparator = list_y_comparator, # Endpoints to compare
list_lequi.tol = list_lequi.tol, # Lower equivalence boundaries
list_uequi.tol = list_uequi.tol, # Upper equivalence boundaries
k = 2, # Number of endpoints required to demonstrate equivalence
adjust = "bon", # Bonferroni adjustment for multiple comparisons
TAR = c("SB2" = 2, "EUINF" = 1, "USINF" = 1), # Treatment allocation rates
dtype = "parallel", # Trial design type (parallel group)
ctype = "ROM", # Test type: Ratio of Means
vareq = TRUE, # Assume equal variances across arms
lognorm = TRUE, # Log-normal distribution assumption
ncores = 1, # Number of cores for computation
nsim = 1000, # Number of stochastic simulations
seed = 1234)) # Random seed for reproducibility
```

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`.



# References

0 comments on commit 0296761

Please sign in to comment.