@@ -137,10 +137,10 @@ only).
137137event <- tribble(
138138 ~H1, ~H2, ~Analysis, ~Event,
139139 # IA diagonal (total events per hypothesis = dose + control)
140- 1, 1, 1, 49, # Dose 1 (24) + Control (25)
141- 2, 2, 1, 51, # Dose 2 (26) + Control (25)
142- 3, 3, 1, 50, # Dose 3 (25) + Control (25)
143- 4, 4, 1, 52, # Dose 4 (27) + Control (25)
140+ 1, 1, 1, 49, # Dose 1 (24) + Control (25)
141+ 2, 2, 1, 51, # Dose 2 (26) + Control (25)
142+ 3, 3, 1, 50, # Dose 3 (25) + Control (25)
143+ 4, 4, 1, 52, # Dose 4 (27) + Control (25)
144144 # IA off-diagonal (shared events = control only)
145145 1, 2, 1, 25,
146146 1, 3, 1, 25,
@@ -149,10 +149,10 @@ event <- tribble(
149149 2, 4, 1, 25,
150150 3, 4, 1, 25,
151151 # FA diagonal (total events per hypothesis = dose + control)
152- 1, 1, 2, 123, # Dose 1 (60) + Control (63)
153- 2, 2, 2, 128, # Dose 2 (65) + Control (63)
154- 3, 3, 2, 126, # Dose 3 (63) + Control (63)
155- 4, 4, 2, 130, # Dose 4 (67) + Control (63)
152+ 1, 1, 2, 123, # Dose 1 (60) + Control (63)
153+ 2, 2, 2, 128, # Dose 2 (65) + Control (63)
154+ 3, 3, 2, 126, # Dose 3 (63) + Control (63)
155+ 4, 4, 2, 130, # Dose 4 (67) + Control (63)
156156 # FA off-diagonal (shared events = control only)
157157 1, 2, 2, 63,
158158 1, 3, 2, 63,
@@ -210,26 +210,34 @@ cat("Corr(Z_1,1, Z_1,1) =", corr[1, 1], " (expected: 1.0)\n")
210210# Case 2: Different hypotheses, same analysis (IA)
211211# Corr(Z_1,1, Z_2,1) = n_control_IA / sqrt(n_H1_IA * n_H2_IA) = 25 / sqrt(49 * 51)
212212expected_12_ia <- 25 / sqrt(49 * 51)
213- cat("Corr(Z_1,1, Z_2,1) =", round(corr[1, 2], 6),
214- " (expected:", round(expected_12_ia, 6), ")\n")
213+ cat(
214+ "Corr(Z_1,1, Z_2,1) =", round(corr[1, 2], 6),
215+ " (expected:", round(expected_12_ia, 6), ")\n"
216+ )
215217
216218# Case 3: Different hypotheses, same analysis (FA)
217219# Corr(Z_1,2, Z_3,2) = n_control_FA / sqrt(n_H1_FA * n_H3_FA) = 63 / sqrt(123 * 126)
218220expected_13_fa <- 63 / sqrt(123 * 126)
219- cat("Corr(Z_1,2, Z_3,2) =", round(corr[5, 7], 6),
220- " (expected:", round(expected_13_fa, 6), ")\n")
221+ cat(
222+ "Corr(Z_1,2, Z_3,2) =", round(corr[5, 7], 6),
223+ " (expected:", round(expected_13_fa, 6), ")\n"
224+ )
221225
222226# Case 4: Same hypothesis, different analyses
223227# Corr(Z_1,1, Z_1,2) = n_H1_IA / sqrt(n_H1_IA * n_H1_FA) = 49 / sqrt(49 * 123)
224228expected_11_cross <- 49 / sqrt(49 * 123)
225- cat("Corr(Z_1,1, Z_1,2) =", round(corr[1, 5], 6),
226- " (expected:", round(expected_11_cross, 6), ")\n")
229+ cat(
230+ "Corr(Z_1,1, Z_1,2) =", round(corr[1, 5], 6),
231+ " (expected:", round(expected_11_cross, 6), ")\n"
232+ )
227233
228234# Case 5: Different hypotheses, different analyses
229235# Corr(Z_2,1, Z_4,2) = n_control_min(IA) / sqrt(n_H2_IA * n_H4_FA) = 25 / sqrt(51 * 130)
230236expected_24_cross <- 25 / sqrt(51 * 130)
231- cat("Corr(Z_2,1, Z_4,2) =", round(corr[2, 8], 6),
232- " (expected:", round(expected_24_cross, 6), ")\n")
237+ cat(
238+ "Corr(Z_2,1, Z_4,2) =", round(corr[2, 8], 6),
239+ " (expected:", round(expected_24_cross, 6), ")\n"
240+ )
233241```
234242
235243The correlation matrix for this 4-hypothesis Dunnett scenario has the
@@ -266,8 +274,8 @@ gs_design <- gsDesign(
266274 alpha = 0.025 / 4, # Per-hypothesis alpha (Bonferroni for single hypothesis)
267275 beta = 0.1,
268276 timing = IF_avg,
269- sfu = sfLDOF, # Lan-DeMets O'Brien-Fleming for efficacy
270- sfl = sfHSD, # HSD for futility
277+ sfu = sfLDOF, # Lan-DeMets O'Brien-Fleming for efficacy
278+ sfl = sfHSD, # HSD for futility
271279 sflpar = -2
272280)
273281
@@ -278,8 +286,10 @@ futility_p <- pnorm(futility_z)
278286cat("Information fraction:", round(IF_avg, 3), "\n")
279287cat("Futility Z-bound at IA:", round(futility_z, 4), "\n")
280288cat("Futility p-value bound at IA:", round(futility_p, 4), "\n")
281- cat("Interpretation: Stop for futility if one-sided p-value >",
282- round(futility_p, 4), "\n")
289+ cat(
290+ "Interpretation: Stop for futility if one-sided p-value >",
291+ round(futility_p, 4), "\n"
292+ )
283293```
284294
285295``` {r}
0 commit comments