# Bayesian design method for sequentially monitoring patients using Beta-Binomial posterior probability based on observing data

### 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)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.