Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # An R script to compute the Probability of Success of a clinical trial
- # for any given true Treatment Effect
- #
- # (c) 2019 Germain Garand <germain.garand@laposte.net>
- #
- # This is for information purposes only. Any calculation performed herein could be
- # wrong and/or misrepresent reality. Use at your own risk.
- #
- # License: Creative Commons BY-NC 2.0
- #
- # Version 0.12
- #
- library(stats)
- library(methods)
- library(gsDesign, quietly=1)
- # Proportions to test
- # -------------------
- # success rate in Comparator Arm
- p1 = 23/100
- # success rate in Treatment Arm
- p2 = 33/100
- # Trial characteristics
- alpha = .05
- power = .9
- accrual = 400
- a2 = alpha/2
- b = 1 - power
- n = nBinomial(p1=p1, p2=p2, alpha=a2, beta=b)
- message("Trial design:")
- message("-------------")
- message(accrual, " patients ; Type-I error: ", alpha*100, "% ; Power: ", power*100, "%")
- message("-------------")
- message("Testing hypothesized true effect of ", p1*100, "% for Comparator arm vs. ", p2*100, "% for Treatment arm.")
- message("Required accrual for ", power*100, "% probability of success: ", floor(n))
- test = gsDesign(k=2, n.fix=n, alpha=a2, beta=b)
- theta = test$theta[2]
- message("We are looking for a theta value of: ", theta)
- orig = gsDesign(k=2, n.fix=accrual, alpha=a2, beta=b)
- #message("----------------------------------------")
- #show(orig)
- #message("----------------------------------------")
- p = gsProbability(theta=theta, d=orig)
- pos = sum(p$upper$prob)
- message("The Probability of Success of the trial is: ", floor(pos*100), "%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement