# bayes.design: Bayesian design method for sequentially monitoring patients... In ph2bye: Phase II Clinical Trial Design Using Bayesian Methods

## Description

Make animation plots to present sequential monitor stopping rule using Beta-Binomial Bayesian model

## Usage

 ```1 2``` ```bayes.design(a,b,r=0, stop.rule="futility", add.size=5, alpha=0.05, p0 ,delta=0.2,tau1=0.9,tau2=0.9,tau3=0.9,tau4=0.9, time.interval =1) ```

## Arguments

 `a` the hyperparameter (shape1) of the Beta prior for the experimental drug. `b` the hyperparameter (shape2) of the Beta prior for the experimental drug. `r` the maximum number of patients treated by the experimental drug. `stop.rule` the hyperparameter (shape1) of the Beta prior for the experimental drug. `add.size` a single integer value, random number generator (RNG) state for random number generation. `alpha` the siginificant level to determine the credible interval, set 0.05 by default. `p0` the prespecified reseponse rate. `delta` the minimally acceptable increment of the response rate. `tau1` threshold for stopping rule 1. `tau2` threshold for stopping rule 2. `tau3` threshold for stopping rule 3. `tau4` threshold for stopping rule 4. `time.interval` a positive number to set the time interval of the animation (unit in seconds); default to be 1.

## Value

animation plot of determination of stopping boundaries.

## References

Yin, G. (2012). Clinical Trial Design: Bayesian and Frequentist Adaptive Methods. New York: Wiley.

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```# Using Multiple Myeloma (MM) data example MM.r = rep(0,6); MM.mean = 0.1; MM.var = 0.0225 a <- MM.mean^2*(1-MM.mean)/MM.var - MM.mean; b <- MM.mean*(1-MM.mean)^2/MM.var - (1-MM.mean) bayes.design(a=a,b=b,r=MM.r,stop.rule="futility",p0=0.1) # Using Acute Promyelocytic Leukaemia (APL) data example APL.r <- c(0,1,0,0,1,1); APL.mean = 0.3; APL.var = 0.0191 a <- APL.mean^2*(1-APL.mean)/APL.var - APL.mean; b <- APL.mean*(1-APL.mean)^2/APL.var - (1-APL.mean) bayes.design(a=a,b=b,r=APL.r,stop.rule="efficacy",p0=0.1) ```

### Example output

```Loading required package: animation
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
Loading required package: nleqslv
\$para.a
[1] 0.3

\$para.b
[1] 2.7

\$`poterior mean`
[1] 0.07500000 0.06000000 0.05000000 0.04285714 0.03750000 0.03333333

[1] "Stop the trial for futility after the inclusion of Inf patients."
sh: 1: convert: Permission denied
I cannot find ImageMagick with convert = 'convert'
[1] FALSE
Warning messages:
1: In min(which(pbeta(p0, a + r, b + n - r) > tau2)) :
no non-missing arguments to min; returning Inf
2: running command 'convert --version' had status 126
3: In im.convert(img.files, output = path.expand(movie.name), convert = convert,  :
Please install ImageMagick first or put its bin path into the system PATH variable
\$para.a
[1] 2.998429

\$para.b
[1] 6.996335

\$`poterior mean`
[1] 0.2727143 0.3333479 0.3076954 0.2857089 0.3333450 0.3750245

[1] "Stop the trial for efficacy after the inclusion of Inf patients."
sh: 1: convert: Permission denied
I cannot find ImageMagick with convert = 'convert'
[1] FALSE
Warning messages:
1: In min(which(pbeta(p0 + delta, a + r, b + n - r, lower.tail = F) >  :
no non-missing arguments to min; returning Inf
2: running command 'convert --version' had status 126
3: In im.convert(img.files, output = path.expand(movie.name), convert = convert,  :
Please install ImageMagick first or put its bin path into the system PATH variable
```

ph2bye documentation built on May 29, 2017, 9:08 a.m.