#' Calculate the final cutoff for a single sample binary test
#'
#' @param alpha The beta prior's alpha
#' @param beta The beta prior's beta
#' @param p0 comparison value
#' @param thetaT required posterior mass
#' @param Nmax total sample size
#'
#' @return Returns the highest integer, \eqn{x}, between 0 and Nmax for which \eqn{P(\pi \leq p0 | x) > thetaT}
#' @export
#' @import tidyr
#' @import dplyr
#' @import stats
#'
#' @examples
BinSing_FinalCut <- function(alpha, beta,p0,thetaT,Nmax){
x <- 0:Nmax
max(which(1-pbeta(p0, alpha+x, beta+Nmax-x) <thetaT))-1
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.