Description Usage Arguments Value References Examples
Make animation plots to present sequential monitor the patients using Beta-Binomial Bayesian model
1 | BB.aniplot(a, b, r, N=1, alpha=0.05, seed=1234, time.interval=1, output=TRUE)
|
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 |
vector of number of response in each cohort, the value of each element should not exceed N |
N |
the number of patients treated by the experimental drug at a certain stage of the trial. |
alpha |
the siginificant level to determine the credible interval, set 0.05 by default. |
seed |
a single integer value, random number generator (RNG) state for random number generation. |
time.interval |
a positive number to set the time interval of the animation (unit in seconds); default to be 1. |
output |
a logical value, whether to output the inference results of posterior distribution and mean, observed data and credible interval. |
animation plot of updating posterior as prior, and output the inference information of prior and posterior distribution if output=TRUE
.
Yin, G. (2012). Clinical Trial Design: Bayesian and Frequentist Adaptive Methods. New York: Wiley.
1 2 3 4 5 6 7 | # Using APL data
r=rep(0,6)
BB.aniplot(a=1,b=1,r=r, alpha=0.05, seed=1234)
# Simulate binomial data
B <- 10; N=1; p=0.3
r <- rbinom(n = B,size = N,prob = p)
BB.aniplot(a=1,b=1,r=r,time.interval = 0.2,output = FALSE)
|
Loading required package: animation
Loading required package: nleqslv
Prior: Beta(1,1)
======== Cohort Number: 1 ========
Observations -- Sample Size: 1(1) || Number of Response: 0(0) || Number of Failure: 1(1)
Observed Response Rate: 0
Posterior: Beta(1,2)
Posterior Mean: 0.333
95% Credible Interval: (0.0126,0.842)
======== Cohort Number: 2 ========
Observations -- Sample Size: 2(1) || Number of Response: 0(0) || Number of Failure: 2(1)
Observed Response Rate: 0
Posterior: Beta(1,3)
Posterior Mean: 0.25
95% Credible Interval: (0.0084,0.708)
======== Cohort Number: 3 ========
Observations -- Sample Size: 3(1) || Number of Response: 0(0) || Number of Failure: 3(1)
Observed Response Rate: 0
Posterior: Beta(1,4)
Posterior Mean: 0.2
95% Credible Interval: (0.00631,0.602)
======== Cohort Number: 4 ========
Observations -- Sample Size: 4(1) || Number of Response: 0(0) || Number of Failure: 4(1)
Observed Response Rate: 0
Posterior: Beta(1,5)
Posterior Mean: 0.167
95% Credible Interval: (0.00505,0.522)
======== Cohort Number: 5 ========
Observations -- Sample Size: 5(1) || Number of Response: 0(0) || Number of Failure: 5(1)
Observed Response Rate: 0
Posterior: Beta(1,6)
Posterior Mean: 0.143
95% Credible Interval: (0.00421,0.459)
======== Cohort Number: 6 ========
Observations -- Sample Size: 6(1) || Number of Response: 0(0) || Number of Failure: 6(1)
Observed Response Rate: 0
Posterior: Beta(1,7)
Posterior Mean: 0.125
95% Credible Interval: (0.00361,0.41)
Output at: animation.gif
[1] TRUE
Output at: animation.gif
[1] TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.