In the design I have three stages were I will conduct data analysis. I am assuming that I have conducted some preliminary analysis with 10 patients in the control and 10 in the treatment groups. I am assuming that I have some outcome measure that is standardized and normally distributed. I am assuming that from my preliminary analysis that the sigmas (standard deviations) for both the control and treatment groups is .2. I am defining success has having a 90% probability of seeing a difference between the means of the two groups of at least 0. I am defining failure as having a 60% probability of seeing a difference between the means of the two groups of .-5 or smaller. I am assigning a prior of .3 as the expected difference.

Question: I am having trouble understanding adding the hypothetical people to the experiment (i.e. the 2,2 in the prior.difference). I think this is just part of the prior and makes the prior stronger if we add more hypothetical people. I don’t think this is related to the estimated sample size that is provided later that provides the sample for the design needed to achieve the total probabilities.

library(gsbDesign)
## Loading required package: gsDesign
## Loading required package: xtable
## Loading required package: ggplot2
## Loading required package: lattice
## Loading required package: grid
design1 <- gsbDesign(nr.stages = 3, patients = c(10, 10), sigma = c(.2, .2), criteria.success = c(0, 0.9), criteria.futility = c(-.5, 0.6), prior.difference = c(.3, 2, 2))

design1
## 
## *** Trial Design ***
## 
## number of stages:  3 
## 
## prior difference:      0.3 
## prior patients control:    2 
## prior patients treatment: 2 
## 
## patients: 
##         control treatment
## stage 1      10        10
## stage 2      10        10
## stage 3      10        10
## 
## sigma control: 0.2 ; sigma treatment: 0.2 
## 
## criteria: 
##      type stage number value probability
##   success     1      1   0.0         0.9
##   success     2      1   0.0         0.9
##   success     3      1   0.0         0.9
##  futility     1      1  -0.5         0.6
##  futility     2      1  -0.5         0.6
##  futility     3      1  -0.5         0.6
12*800
## [1] 9600

Ok let us say that we have a difference with 10 people in each trial of .2 with a pooled standard deviation of .2. Below we are going to set up numerical integration so that we can find the probability of meeting the criteria above given a range of differences. To get an accurate range of possible differences we will evaluate the differences at two standard deviations above and below the average effect size of .2 (so the range is from -.2 to .6). We will evaluate the probability at 40 unique points.

simulation1 <- gsbSimulation(truth = c(-.2, .6, 40), type.update = "treatment effect", method = "numerical integration")
simulation1
## 
## *** Simulation Settings ***
## 
## type.update:          treatment effect 
## method:       numerical integration 
## 
## grid of true differences (= treatment - control):
## 40 distinct values from -0.2 to 0.6.

Now we can run the two designs together. So the total probability is the sum of all the probability and the total sample size needed for a given difference. I want to evaluate the probability of success and failure at the following differences 0, .2, .4, .6, and .8.

For success stopping criteria, it says that at .2, there is a 96% chance of having an effect size greater than 0 with ~28 people. So if we added 8 more people to the design we would be 96% confident that with an effect size of .2 that we would have an effect size greater than 0.

oc1 = gsb(design1, simulation1)
summary(oc1,  atDelta = c(0, .2, .4, .6))
## 
## *** Group Sequential Bayesian Design ***
## 
##  Analysis N1 N2      S      F std.S  std.F
##     Prior  2  2     NA     NA    NA     NA
##         1 10 10 0.0656 -0.685 0.733  -7.66
##         2 10 10 0.0550 -0.597 0.870  -9.44
##         3 10 10 0.0483 -0.567 0.936 -10.98
## 
## sigma treatment: 0.2     sigma control: 0.2 
## 
## stopping for success:
##  delta stage 1 stage 2 stage 3  total E{N}
##    0.0  0.2329  0.0712   0.040 0.3441 49.3
##    0.2  0.9323  0.0596   0.007 0.9989 21.5
##    0.4  0.9999  0.0001   0.000 1.0000 20.0
##    0.6  1.0000  0.0000   0.000 1.0000 20.0
## 
## stopping for futility:
##  delta stage 1 stage 2 stage 3 total
##    0.0       0       0       0     0
##    0.2       0       0       0     0
##    0.4       0       0       0     0
##    0.6       0       0       0     0