diff --git a/_posts/2024-08-01-automatic-stopping-mcmc.md b/_posts/2024-08-01-automatic-stopping-mcmc.md index 4427602..b94a8d7 100644 --- a/_posts/2024-08-01-automatic-stopping-mcmc.md +++ b/_posts/2024-08-01-automatic-stopping-mcmc.md @@ -34,7 +34,7 @@ Since it is not possible beforehand to determine whether a parameter should be i When all stopping criteria pass, the MCMC stops and produces a combined trace and tree logs with burn-in removed from the two independent MCMC chains. So, there should be no more need to resume an MCMC analysis when using the ASM method. -For more details, see Berling et al, 2023. +For more details, see [Berling et al, 2024](https://doi.org/10.1109/TCBB.2024.3457875). ## In practice @@ -47,6 +47,60 @@ You can set parameters by clicking the TreePSRF button for the Gelman-Rubin-like asm-options +## Interpreting screen output + +Screen output may look something like this: + +``` +Check 19 burnin:[14, 14]psrf1mean = 1.472 reset start -1 10.0 5.1 10.0 :5.1  in 5 mseconds +Check 20 burnin:[15, 15]psrf1mean = 1.399 reset start -1 7.2 5.3 10.0 :5.3   in 5 mseconds +Check 21 burnin:[15, 15]psrf1mean = 1.426 reset start -1 10.9 7.2 12.0 :7.2  in 5 mseconds +Check 22 burnin:[16, 16]psrf1mean = 1.466 reset start -1 12.0 12.0 12.0 :12.0      in 3 mseconds +Check 23 burnin:[17, 17]psrf1mean = 1.525 reset start -1 8.8 12.0 8.9 :8.8   in 7 mseconds +Check 24 burnin:[18, 18]psrf1mean = 1.504 reset start -1 7.6 12.0 6.9 :6.9   in 18 mseconds +``` + +Let’s have a look at the first entry: + +``` +Check 19 burnin:[14, 14]psrf1mean = 1.472 reset start -1 10.0 5.1 10.0 :5.1  in 5 mseconds +``` + +**Check 19** check number + +**burnin:[14, 14]** log items removed as burnin, first number for chain1, second for chain2 + +**psrf1mean = 1.472** potential scale reduction factor — this statistic represents a Gelman-Rubin like statistic for the trees. It should go towards 1 at convergence. + +**reset start -1** whether the start of the psrf is recalculated from the start + +**10.0 5.1 10.0** ESSs of the statistics specified in the `asm.inference.TraceESS` statistic + +**:5.1** minimum of the ESSs of the `asm.inference.TraceESS statistic`. This should go to the threshold specified in the `targetESS` attribute. + +**in 5 mseconds** time used to calculate the statistics + + +## Sampling from prior + +Normally, to get a sample from the prior for an MCMC run, the `-sampleFromPrior` flag can be used for BEAST. +This fails with ASM, so to obtain a sample from the prior, the XML must be edited to produce a sample from the prior, like so: + +* move the element with `id="likelihood"` including all of its sub-elements to outside the `run` element, say at the end of the file, just before the `` line. +* remove `likelihood` from the `traces` attribute of the `TraceESS` stopping criterion. + + +If you get this kind of error: + +``` +Check 0 java.lang.IllegalArgumentException: Could not find label likelihood in trace log. Use one of [Sample, posterior, prior, ... +``` + +the `traces` attribute is not specified, and the default (i.e. `posterior,likelihood,prior`) will be used. To fix this the `traces="posterior,prior"` must be added to the `TraceESS` stopping criterion, so it looks something like + +``` + +``` ## References