@@ -37,11 +37,12 @@ The study follows a parallel-group design with the following key assumptions:
3737* Reference Group (Drug B): The average blood pressure is 96 mmHg, with a within-group standard deviation of 18 mmHg.
3838* Mean Difference: As per FDA guidelines, the assumed difference between the two groups is set to $\delta = \sigma/8 = 2.25$ mmHg.
3939* Biosimilarity Limits: These are defined as ±1.5σ = ±27 mmHg.
40- * Type-I Error Rate: A one-sided α = 0.025 is specified.
40+ * Desired Type-I Error: 2.5%
41+ * Target Power: 90%
4142
4243To implement these parameters in R, the following code snippet can be used:
4344
44- ``` r
45+ ``` {r}
4546# Reference group mean blood pressure (Drug B)
4647mu_r <- setNames(96, "BP")
4748
@@ -64,7 +65,7 @@ To estimate the power for different sample sizes, we use the [sampleSize()](../
6465
6566Below is an example of how the function can be implemented in R:
6667
67- ``` r
68+ ``` {r}
6869(N_ss <- sampleSize(
6970 power = 0.90, # Target power
7071 alpha = 0.025, # Type-I error rate
@@ -87,3 +88,34 @@ Below is an example of how the function can be implemented in R:
8788N_ss$table.iter
8889```
8990
91+ We can visualize the power curve for different sample sizes using the following code snippet:
92+
93+ ``` {r}
94+ plot(N_ss)
95+ ```
96+
97+ Consider now we want to adjust the sample size for an anticipated drop-out rate of 20% in each group. We can modify the code as follows:
98+
99+ ``` {r}
100+ (N_ss <- sampleSize(
101+ power = 0.90, # Target power
102+ alpha = 0.025, # Type-I error rate
103+ mu_list = list("R" = mu_r, "T" = mu_t), # Means for reference and treatment groups
104+ sigma_list = list("R" = sigma, "T" = sigma), # Standard deviations
105+ list_comparator = list("T_vs_R" = c("R", "T")), # Comparator setup
106+ list_lequi.tol = list("T_vs_R" = lequi_lower), # Lower equivalence limit
107+ list_uequi.tol = list("T_vs_R" = lequi_upper), # Upper equivalence limit
108+ dropout = c("R" = 0.20, "T" = 0.20), # Expected dropout rates
109+ dtype = "parallel", # Study design
110+ ctype = "DOM", # Comparison type
111+ lognorm = FALSE, # Assumes normal distribution
112+ optimization_method = "step-by-step", # Optimization method
113+ adjust = "no", # No adjustments
114+ ncores = 1, # Single-core processing
115+ nsim = 1000, # Number of simulations
116+ seed = 1234 # Random seed for reproducibility
117+ ))
118+ ```
119+
120+
121+
0 commit comments