# The unnormalized posterior for x=-8,8,17 # postprop<-function(theta){ 1/((1+(-8-theta)^2)*(1+(8-theta)^2)*(1+(17-theta)^2))* exp(-(theta^2)/100)} # A random walk Metropolis Hastings MCMC # theta<-0 for (i in 1:10000){ y<-rcauchy(1,theta[i]) alpha<-min(postprop(y)/postprop(theta[i]),1) u<-runif(1) if (u