Sequentially monitor patients using Beta-Binomial posterior probability

Description

Make animation plots to present sequential monitor the patients using Beta-Binomial Bayesian model

Usage

1
BB.aniplot(a, b, r, N=1, alpha=0.05, seed=1234, time.interval=1, output=TRUE)

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

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.

Value

animation plot of updating posterior as prior, and output the inference information of prior and posterior distribution if output=TRUE.

References

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

Examples

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)