To get the ball rolling I figure it would be worthwhile to write a simple R script to implement nested sampling with MCMC moves for exploring the likelihood-constrained prior as benchmark for this comparison exercise.  Ideally the prior and likelihood should be plug-in functions with minimal requirements such that those not familiar with nested sampling can easily get it up & running on their favourite toy problem.  Eventually I suppose the same will have to be done for SMC; or alternatively, an SMC advocate may decide to contribute his/her go-to SMC script for this purpose.

I have created a github repository to store the code produced here, though at present it contains only a readme file! which now contains a barely debugged R script I hacked together, along with a more refined Python script contributed by Brendon Brewer.

Comment: In hacking together this nested sampling script (a script I’ve probably written from scratch on about five different occasions) I am reminded just how similar nested sampling is to SMC: that is, the live particle population is evolved through the sequence of target densities \pi(\cdot)I[L(\cdot)>L^\ast_{i}] for L^\ast_i a non-decreasing sequence, the only complexity being that the successive L^\ast_i is chosen as the minimum of the likelihoods amongst particles in the i-1th population.  The need for an (e.g.) MCMC algorithm to find a replacement live particle is then no different to the need for the same to avoid particle degeneracy in an SMC / particle filtering code.

2 Responses to Code

  1. I have this in Python. Is that of any use?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s