# NOT RUN {
lpost <- function(theta, s){
dnorm(s$ybar, theta, s$se, log = TRUE) +
dcauchy(theta, s$loc, s$scale, log = TRUE)
}
s <- list(ybar = 20,
se = 0.4,
loc = 10,
scale = 2)
post <- metropolis(lpost, 10, 20, 100, s)
# }
Run the code above in your browser using DataLab