Running examples in ‘gsbDesign-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: gsb
> ### Title: Group Sequential Bayesian Design
> ### Aliases: gsb gsbDesign gsbSimulation
> ### Keywords: main function operating characteristics
> 
> ### ** Examples
> 
> ## E X A M P L E 1: Update on treatment effect, flat prior
> ##
> ## A. Trial Design:
> ## ----------------
> ## A.1 2 stages (interim + final):
> ##     --> nr.stages = 2
> ## A.2 10 patients per arms and stages. (total 2*2*10 = 40 patients)
> ##     --> patients = 10
> ## A.3 Sigma in both arms = 10
> ##     --> sigma = 10
> ## A.3 Criteria:
> ##     stop for success, if P( delta > 0 | data ) >= 0.8
> ##                      AND P( delta > 7 | data ) >= 0.5 
> ##     --> criteria.success = c(0,0.8,7,0.5)
> ##     stop for futility, if P( delta < 2 | data ) >= 0.8
> ##     --> criteria.futility = c(2,0.8)
> ## A.4 Prior:
> ##     --> prior = "non-informative"
> 
> design1 <- gsbDesign(nr.stages = 2,
+                      patients = 10,
+                      sigma = 10,
+                      criteria.success = c(0,0.8, 7, 0.5),
+                      criteria.futility = c(2,0.8),
+                      prior.difference = "non-informative")
> design1

*** Trial Design ***

number of stages:  2 

prior:  non-informative

patients: 
        control treatment
stage 1      10        10
stage 2      10        10

sigma control: 10 ;	sigma treatment: 10 

criteria: 
     type stage number value probability
  success     1      1     0         0.8
  success     1      2     7         0.5
  success     2      1     0         0.8
  success     2      2     7         0.5
 futility     1      1     2         0.8
 futility     2      1     2         0.8
> 
> ## B. Simulation Settings
> ## ----------------------
> ## B.1 True treatment effects to be evaluated = seq(-10,20,60)
> ##     --> truth = c(-10,20,60)
> ## B.2 Bayesian update on treatment effect delta (= treatment - control)
> ##     --> type.update = "treatment effect"
> 
> simulation1 <- gsbSimulation(truth=c(-10,20,60),
+                              type.update="treatment effect")
> simulation1

*** Simulation Settings ***

type.update: 		 treatment effect 
method: 		 numerical integration 

grid of true differences (= treatment - control):
60 distinct values from -10 to 20.
> 
> ## C.1 Calculate the operating characteristics
> x1 <- gsb(design=design1, simulation=simulation1)
> x1

*** Group Sequential Bayesian Design ***

 Analysis N1 N2  S      F std.S  std.F
    Prior  0  0 NA     NA    NA     NA
        1 10 10  7 -1.764  1.57 -0.394
        2 10 10  7 -0.661  2.21 -0.209

sigma treatment: 10 	sigma control: 10 

stopping for success:
 delta stage 1 stage 2  total E{N}
     0   0.059  0.0050 0.0641 31.9
     7   0.500  0.1244 0.6244 29.5

stopping for futility:
 delta stage 1 stage 2 total
     2  0.2004  0.0857 0.286

names in output list: 
[1] "OC"          "boundary"    "design"      "simulation"  "system.time"
> 
> ## D.1 Table the probabilities of success
> t1.1 <- tab(x1, "success", digits=2)
> t1.1
          stage 1 stage 2
1  -10.00    0.00    0.00
2   -9.49    0.00    0.00
3   -8.98    0.00    0.00
4   -8.47    0.00    0.00
5   -7.97    0.00    0.00
6   -7.46    0.00    0.00
7   -6.95    0.00    0.00
8   -6.44    0.00    0.00
9   -5.93    0.00    0.00
10  -5.42    0.00    0.00
11  -4.92    0.00    0.00
12  -4.41    0.01    0.00
13  -3.90    0.01    0.00
14  -3.39    0.01    0.00
15  -2.88    0.01    0.00
16  -2.37    0.02    0.00
17  -1.86    0.02    0.00
18  -1.36    0.03    0.00
19  -0.85    0.04    0.00
20  -0.34    0.05    0.00
21   0.17    0.06    0.01
22   0.68    0.08    0.01
23   1.19    0.10    0.01
24   1.69    0.12    0.02
25   2.20    0.14    0.02
26   2.71    0.17    0.03
27   3.22    0.20    0.04
28   3.73    0.23    0.05
29   4.24    0.27    0.06
30   4.75    0.31    0.07
31   5.25    0.35    0.08
32   5.76    0.39    0.10
33   6.27    0.44    0.11
34   6.78    0.48    0.12
35   7.29    0.53    0.13
36   7.80    0.57    0.14
37   8.31    0.61    0.14
38   8.81    0.66    0.14
39   9.32    0.70    0.14
40   9.83    0.74    0.14
41  10.34    0.77    0.13
42  10.85    0.81    0.12
43  11.36    0.83    0.11
44  11.86    0.86    0.10
45  12.37    0.89    0.09
46  12.88    0.91    0.07
47  13.39    0.92    0.06
48  13.90    0.94    0.05
49  14.41    0.95    0.04
50  14.92    0.96    0.03
51  15.42    0.97    0.03
52  15.93    0.98    0.02
53  16.44    0.98    0.02
54  16.95    0.99    0.01
55  17.46    0.99    0.01
56  17.97    0.99    0.01
57  18.47    0.99    0.01
58  18.98    1.00    0.00
59  19.49    1.00    0.00
60  20.00    1.00    0.00
> 
> ## D.2 Table the cumulative probabilities of futility at delta = c(-5,0,5.57)
> ##     (for 5.57 a linear interpolation is used.)
> t1.2 <- tab(x1, "cumulative futility", atDelta = c(-5,0,5.57), digits=5)
> t1.2
        stage 1 stage 2
1 -5.00 0.76515 0.93344
2  0.00 0.34684 0.50334
3  5.57 0.05078 0.06286
> 
> ## D.3 Table the expected sample size (digits == 0 --> ceiling)
> t1.3 <- tab(x1, "sample size", atDelta= c(-5,0,5,16), digits=0)
> t1.3
     stage 1 stage 2
1 -5      20      25
2  0      20      32
3  5      20      33
4 16      20      21
> 
> ## E.1 Plot the operating characteristics
> plot(x1)
> 
> ## E.2 Plot the operating characteristics
> plot(x1,"cumulative all")
> 
> ## E.3 Plot the expected sample size
> plot(x1, what="sample size")
> 
> ## F.1 Boundaries / criteria 
> x1$boundary
                    type   stage observed_difference std_observed_difference
1  success / upper bound stage 1            7.000000               1.5652476
2  success / upper bound stage 2            7.000000               2.2135944
3 futility / lower bound stage 1           -1.763845              -0.3944076
4 futility / lower bound stage 2           -0.661440              -0.2091657
> plot(x1, what="boundary")
> plot(x1, what="std.boundary")
> 
> 
> ## E X A M P L E 2: Update on treatment effect, informative prior
> ##
> ## A. Trial design:
> ## ----------------
> ## A.1 3 stages (interims + final):
> ##     --> nr.stages = 3
> ## A.2 10 patients per stage in control arm
> ##     15 patients per stage in treatment arm
> ##     (i.e. total 3 * ( 10 + 15 ) = 75 patients)
> ##     --> patients = c(10,15)
> ## A.3 Sigma in control arm = 9, sigma in treatment arm = 12
> ##     --> sigma = c(9,12)
> ## A.3 Criteria:
> ##     stop for success, if P( delta > 0 | data ) >= 0.8
> ##                      AND P( delta > 7 | data ) >= 0.5 
> ##     --> criteria.success = c(0,0.8,7,0.5)
> ##     not stop for futility, i.e. no futility criteria
> ##     --> criteria.futility = NA
> ## A.4 Prior on difference:
> ##     prior difference = 3
> ##     informative prior equivalent to:
> ##     5 patients in control arm; 2 patients in treatment arm
> ##     --> prior = c(3,5,2)
> 
> design2a <- gsbDesign(nr.stages = 3,
+                      patients = c(10,15),
+                      sigma=c(9,12),
+                      criteria.success = c(0,0.8,7,0.5),
+                      criteria.futility = NA,
+                      prior.diff = c(3,5,2))
> design2a

*** Trial Design ***

number of stages:  3 

prior difference:	  3 
prior patients control:	  5 
prior patients treatment: 2 

patients: 
        control treatment
stage 1      10        15
stage 2      10        15
stage 3      10        15

sigma control: 9 ;	sigma treatment: 12 

criteria: 
    type stage number value probability
 success     1      1     0         0.8
 success     1      2     7         0.5
 success     2      1     0         0.8
 success     2      2     7         0.5
 success     3      1     0         0.8
 success     3      2     7         0.5
> 
> ## A similar design with 3 success criteria can be specified as follows
> ## A.3 criteria:
> ##     Stage 1: stop for success, if P( delta > 0  | data ) >= 0.8
> ##                            AND if P( delta > 10 | data ) >= 0.5
> ##                            AND if P( delta > 14 | data ) >= 0.4
> ##     Stage 2: stop for success, if P( delta > 0  | data ) >= 0.8
> ##                            AND if P( delta > 9  | data ) >= 0.5
> ##                            AND if P( delta > 13 | data ) >= 0.4
> ##     Stage 3: stop for success, if P( delta > 0  | data ) >= 0.8
> ##                            AND if P( delta > 7  | data ) >= 0.5
> ##                            AND if P( delta > 12 | data ) >= 0.4
> ##     --> criteria.success = rbind(c(0,0.8, 10,0.5, 14,0.4),
> ##                                  c(0,0.8,  9,0.5, 13,0.4),
> ##                                  c(0,0.8,  7,0.5, 12,0.4))
> 
> design2b <- gsbDesign(nr.stages = 3,
+                       patients = c(10,15),
+                       sigma = c(9,12),
+                       criteria.success = rbind(c(0,0.8, 10,0.5, 14,0.4),
+                                                c(0,0.8, 9,0.5,  13,0.4),
+                                                c(0,0.8, 7,0.5,  12,0.4)),
+                       criteria.futility = NA,
+                       prior.diff = c(3,5,2))
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
gsbDesign
 --- call from context --- 
integer2numeric(criteria.success)
 --- call from argument --- 
if (class(x) == "integer") return(as.numeric(x))
 --- R stacktrace ---
where 1: integer2numeric(criteria.success)
where 2: gsbDesign(nr.stages = 3, patients = c(10, 15), sigma = c(9, 12), 
    criteria.success = rbind(c(0, 0.8, 10, 0.5, 14, 0.4), c(0, 
        0.8, 9, 0.5, 13, 0.4), c(0, 0.8, 7, 0.5, 12, 0.4)), criteria.futility = NA, 
    prior.diff = c(3, 5, 2))

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x) 
{
    if (class(x) == "integer") 
        return(as.numeric(x))
    x
}
<bytecode: 0x55efe164a150>
<environment: namespace:gsbDesign>
 --- function search by body ---
Function integer2numeric in namespace gsbDesign has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1