R/halfnorm_acc.R

Defines functions halfnorm_acc

Documented in halfnorm_acc

#' Acceptance rate of half-normal rejection sampling
#'
#' \code{halfnorm_acc} calculates the acceptance rate of half-normal rejection sampling for the truncation interval (a,b).
#'
#' @param a lower bound for truncation.
#' @param b upper bound for truncation.
#'
#' @examples
#' set.seed(1203)
#' halfnorm_acc(1,2)
#'
halfnorm_acc <- function(a,b){
  rate <- 2*(pnorm(b)-pnorm(a))
  return(rate)
}

Try the tmvmixnorm package in your browser

Any scripts or data that you put into this service are public.

tmvmixnorm documentation built on Sept. 19, 2020, 1:07 a.m.