# function for adjust the acceptance rate
#' @export
adjust_acceptance=function(accept,sgm,target = 0.5){
y = 1. + 1000.*(accept-target)*(accept-target)*(accept-target)
if (y < .9)
y = .9
if (y > 1.1)
y = 1.1
sgm = sgm* y
return(sgm)
}
# approximate the threhold function
#' @export
appro2 = function(x, epison = 10^-8) {
temp = 0.5*(1+2/pi*atan(x/epison))
return(temp)
}
# appraoximate the derivative of the threshold function
#' @export
dappro2 = function(x, epison = 10^-8) {
temp = 2/(pi*(epison+x^2/epison))
return(temp)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.