![]() |
S-114.600 Introduction to Bayesian Modeling - Hints |
post=post/sum(post); cpost=cumsum(post); for i=1:1000, samp(i)=theta(min(find(cpost>rand))); endNote that now the sum of the posterior MUST be 1, i.e. not divided by 1/M. The division with the step size is simply for plotting the image in a).