Nothing
#' Acceptance rate of translated-exponential rejection sampling
#'
#' \code{exp_acc_opt} calculates the acceptance rate of translated-exponential rejection sampling for the truncation interval (a,b).
#'
#' @param a lower bound for truncation.
#' @param b upper bound for truncation.
#'
#' @examples
#' set.seed(1203)
#' exp_acc_opt(1,2)
#'
exp_acc_opt <- function(a,b){
lambda <- ( a+sqrt(a^2+4) )/2
rate <- sqrt(2*pi)*(pnorm(b)-pnorm(a))*lambda*exp(-lambda^2/2+lambda*a)
return(rate)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.