Slice sampling Matlab demo

So far we’ve had a look at rejection sampling and importance sampling. Here we take a quick look at slice sampling, although rather than implementing it ourselves, we will use the built in Matlab slicesample function. Using our parameter estimation example, we will use slice sampling to estimate the mean and sigma of some samples from …

Importance sampling Matlab demo

Importance sampling is related to rejection sampling, which I looked at in the last post. Here is a short demo. https://gist.github.com/drbenvincent/b0549ff1ae428a3428b1 A problem of rejection sampling is that many samples could be evaluated in regions of low probability mass. This then lead to a high rate of attrition, with many samples being rejected. In importance sampling, this …

Rejection sampling Matlab demo

I’ve been using MCMC, but I’ve wanted to flesh out my knowledge and explore the space of sampling approaches a little more. One very simple, yet inefficient method, is rejection sampling. Here is a little Matlab example I put together after seeing how easy it was. https://gist.github.com/drbenvincent/486270cd169f7c420c6c Which results in this output. So we have a …