How to use NS

Remco Bouckaert edited this page Nov 20, 2017 · 3 revisions

Nested sampling

  1. Create an XML file in BEAUti with an MCMC analysis

  2. Open the XML file in a text editor

  3. Replace the <run line that says something like

    < run id="mcmc" spec="MCMC" chainLength="100000000">


<run id="mcmc" spec="beast.gss.NS" chainLength="20000" particleCount="1" subChainLength="5000" epsilon="1e-12">


  • particleCount = number of particles (also known as active points).
  • subChainLength = length of MCMC chain used to generate a new point.
  • chainLength = maximum number of newly generated points.
  • epsilon = used in stopping criterion. Lower means longer time to stop.

Save the XML and you should be able to run with BEAST. The estimates for marginal likelihood and standard deviation will be printed on the screen output.

Multi threaded nested sampling


<run id="mcmc" spec="beast.gss.MultiThreadedNS" threads="4" chainLength="20000" particleCount="1" subChainLength="5000" epsilon="1e-12">

Apart from the parameters for nested sampling, there is a "threads" attribute that allow you to specify the number of threads. All other parameters apply to each individual thread, so with 4 threads and 1 particles there are a total of 4 particles.

Posterior sample

If you are interested in the posterior samples, you need an "NSLogger" for the tracelog. For this, you replace

<logger id="tracelog" ...


<logger id="tracelog" spec="NSLogger" ...

To post-process the file and get estimates for quantities of interest, you can use the NSLogAnalyser. The easiest way to start the analyser is by starting BEAUti, select menu File/Launch Apps, and a window pops up where you can choose the "NSLogAnalyser" icon to launch.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.