Advertisement
Spartrap

Simulation of INSPIRE trial v2

Nov 20th, 2018
775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 6.70 KB | None | 0 0
  1. library(stats)
  2. library(methods)
  3. library(gsDesign, quietly=TRUE)
  4.  
  5. #
  6. #  An R script to simulate the ITT group of the PIII INSPIRE confirmatory trial,
  7. #  an adaptive trial with sample size re-estimation at interim - v.2.4
  8. #
  9. #  (c) 2018 Germain Garand <germain.garand@laposte.net>
  10. #
  11.  
  12.  
  13. # Core specifications of INSPIRE
  14. # from public documents
  15. #  ONTXCorporatePresentation_Noblecon13.pdf and ONTX Corporate Presentation Oct 2018.pdf (version 1)  
  16.  
  17. # 2-sided Type-I error for ITT population
  18. alpha <- 0.0397
  19.  
  20. # Type-II error (80% power)
  21. beta <- 0.2
  22.  
  23. # Optimistic Hazard Ratio target (60% improvement in OS, HR=0.625)
  24. hr_op <- 1/1.60
  25.  
  26. # Pessimistic Hazard Ratio target (37.5% improvement in OS, HR=0.73)
  27. hr_p <- 1/1.375
  28.  
  29. # hazard ratio for null hypothesis
  30. hr0 <- 1
  31.  
  32. # proportion of patients in arm 1
  33. pA <- 2/3
  34.  
  35. # probability of event happening during the course of study
  36. # (here 100% since what we want is events number, not patients number)
  37. pE <- 1  
  38.  
  39. # Cox PH model estimate of n of patients needed in a fixed design
  40. n_fix=((qnorm(1-alpha/2)+qnorm(1-beta))/(log(hr_op)-log(hr0)))^2/(pA*(1-pA)*pE)
  41.  
  42. message("Number of events required to power the fixed optimistic design (CoxPH model): ", ceiling(n_fix))
  43.  
  44. # Cox PH estimate of n of pts needed in the worst case scenario
  45. n_fix_max=((qnorm(1-alpha/2)+qnorm(1-beta))/(log(hr_p)-log(hr0)))^2/(pA*(1-pA)*pE)
  46.  
  47. message("Number of events required to power the fixed pessimistic design (CoxPH model): ", ceiling(n_fix_max))
  48.  
  49. # Now let's see how this fixed design will evolve if we turn it
  50. # into an adaptive design.
  51.  
  52. # Natural parameter value null and alternate hypothesis values
  53. delta0 <- 0
  54. delta1 <- 1
  55. # timing of interim analysis for underlying group sequential design
  56. timing <- .5
  57. # upper spending function
  58. sfu <- sfHSD
  59. # upper spending function parameter
  60. sfupar <- -14
  61. # maximum sample size inflation
  62. maxinflation <- 2
  63. # assumed enrollment overrrun at IA
  64. overrun <- 0
  65. # interim z-values for plotting
  66. rg <- c(0.5, 2)
  67. z <- seq(rg[1], rg[2] ,0.025)
  68.  
  69. # Fixed design sample size (input the result from our COX estimate)
  70. n.fix <- n_fix
  71.  
  72. # conditional power interval where sample
  73. # size is to be adjusted
  74. # FIXME
  75. cpadj <- c(.36,.8)
  76.  
  77. # targeted Type II error when adapting sample size
  78. #
  79. # -- Onconova corporate presenation documents sometimes mentioned
  80. # -- the Power was "raised to 90%"  as a result of the sample size re-estimation
  81. # -- but that information has been removed (happened in August 2018 and October 2018)
  82. # -- so it might be an error.. or otherwise untrustable.
  83. # -- Might want to try with both .1 and .2 value
  84. # --
  85. # -- The most conservative case is betastar=beta (Power target unchanged)
  86.  
  87. betastar <- .2
  88.  
  89. # combination test (built-in options are: z2Z, z2NC, z2Fisher)
  90. z2 <- z2NC
  91.  
  92. # use the above parameters to generate
  93. # a 2-stage group sequential design
  94. gs<-gsDesign(k=2,n.fix=n.fix,timing=timing,sfu=sfu,sfupar=sfupar,
  95.             alpha=alpha/2,beta=beta,delta0=delta0,delta1=delta1)
  96.  
  97. gs_size <- gs$n.I[2]
  98. message("Corresponding Adaptive Design initial sample size: ", ceiling(gs_size))
  99.  
  100. # extend this to a conditional power design with sample size re-estimation
  101. xx <- ssrCP(x=gs,z1=z,overrun=overrun,beta=betastar,cpadj=cpadj,
  102.         maxinc=maxinflation, z2=z2)
  103.  
  104. # effective sample increase at interim
  105. incr <- 288
  106.  
  107. # corresponding z1 at interim..
  108. z1_i <- xx$dat$z1[ tail(which(xx$dat$n2 > incr-1), 1) ]
  109.  
  110. message("Z1 at interim: ", z1_i)
  111.  
  112. # ..express that as a proportion of effect size
  113. theta_i <- z1_i / sqrt(xx$x$n.I[1])
  114. delta_ratio=round(theta_i/xx$x$delta,2)
  115.  
  116. message("Proportion of effect size reached at interim: ", delta_ratio)
  117.  
  118. # ..and as a Conditional Power
  119. cp_i <- condPower(z1=z1_i,x=xx$x,cpadj=xx$cpadj,n2=xx$x$n.I[2]-xx$x$n.I[1])
  120. message("Conditional Power at interim: ", round(cp_i,2))
  121.  
  122. # Let's estimate the probability of success of the adaptive design
  123. # after SS re-estimation by creating an ad-hoc sequential design
  124. # that is close to the re-sampled trial parameters and look for theta_i effect
  125. #
  126. # FIXME
  127.  
  128. incr_adj <- incr*(1-0.0278)
  129. timing_adj <- (gs_size/2)/incr
  130.  
  131. gs2<-gsDesign(k=2,n.fix=incr_adj,timing=timing_adj,sfu=sfu,sfupar=sfupar,
  132.             alpha=alpha/2,beta=betastar,delta0=delta0,delta1=delta1)
  133.  
  134. message("------------- ITT Group --------------")
  135.  
  136. y <- gsProbability(theta=theta_i, d=gs2)
  137. print(y)
  138.  
  139. # Now let's just get a reading on the VHR group
  140. # We know it's 70% of ITT, but we don't know its performance,
  141. # so let's just assume theta is the same as the ITT to get a
  142. # nice worst case
  143.  
  144. # beware only part of the type-I error was allocated to this group
  145. alpha_vhr <- 0.01
  146.  
  147. gs3<-gsDesign(k=2, n.fix=incr_adj*.7,timing=timing_adj,sfu=sfu,sfupar=sfupar,
  148.             alpha=alpha_vhr/2,beta=betastar,delta0=delta0,delta1=delta1)
  149.  
  150. message("------ VHR Group (assuming worst case: theta ITT = theta VHR) -------")
  151.  
  152. y2 <- gsProbability(theta=theta_i, d=gs3)
  153. print(y2)
  154.  
  155. ############ Plot the design ###############
  156.  
  157.  
  158. # plot the stage 2 sample size
  159. plot(xx, z1ticks=seq(rg[1], rg[2], by=.1), xlaboffset=-.1, ylab="Number of required death events",
  160.      main=paste("Resampling rule for ",(1-betastar)*100, "% power target"))
  161.  
  162.  
  163. #############  Add some graph overlays ##############
  164.  
  165. lines(x=c(0, z1_i, z1_i), y=c(incr,incr, 0), col=2, lty=2)
  166.  
  167. off1 <- incr+5
  168. off2 <- off1-100
  169. text(x=c(1,z1_i-.5), y=c(off1,off2), col=2,
  170.      labels=c(paste("Effective events target increase: ", ceiling((gs_size/incr)*100),"% (",incr,")..", sep=""),
  171.               paste("..points to Effect Size at ", delta_ratio*100, "% of target ->", sep="")))
  172.  
  173. # overall line for max sample size
  174. nalt <- maxinflation*gs_size
  175. lines(x=par("usr")[1:2],y=c(nalt,nalt),lty=2, col=3)
  176. text(x=c(1.3), y=c((gs_size*2)-7), col=3, labels=paste("Maximum events target increase: 100% (", ceiling(gs_size*2), " events)", sep=""))
  177.  
  178. ############# Absolute Worst Case Probablity Computation #########
  179.  
  180. # We would now like to study the case where the maximum inflation would
  181. # in fact be equal to the effective target increase.
  182. # That would mean the worst possible conditional power is the lower bound
  183. # of the promising zone.
  184. #
  185. # FIXME: in that case the lower boundary CP should be a tad higher eg. .39 see Pocock/Mehta 2000 p.9
  186. #        Should be able to compute the precise value at some point
  187.  
  188. worst_z1 <- xx$dat$z1[  match( nalt, xx$dat$n2 )  ]
  189. worst_theta <- worst_z1 / sqrt(xx$x$n.I[1])
  190. worst_delta_r=round(worst_theta/xx$x$delta,2)
  191.  
  192. message("Worst possible Z1: ", worst_z1)
  193. message("Worst possible Theta value:",worst_theta)
  194. message("Worst possible effect ratio:",worst_delta_r)
  195. message("--------------- Worst possible probability of ITT success ---------")
  196.  
  197. worst_y <- gsProbability(theta=worst_theta, d=gs2)
  198. print(worst_y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement