# This illustrates the Riemann sum evaluation of the missing # mass (Chapter 12) # Density of interest : exp(-x^2/2) (4*(x-.3)^2+.01) # with normalizing constant 1 / (sqrt(2*pi)*(.01+4*(1+.3^2))) f_function(x){ exp(-x^2/2) * (4*(x-.3)^2+.01) / (sqrt(2*pi)*(.01+4*(1+.3^2))) } #Generation of a slow/fast random walk thet_0*(1:2000) for (i in 2:2000){ prop_thet[i-1]+.3*rnorm(1) if (runif(1)