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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-47Lines changed: 48 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,39 +171,46 @@ Overall, it should be chosen such that the acceptance probability of an exchange
171
171
172
172
Next, we can run the xml.
173
173
The output to the screen of a Coupled MCMC run looks slightly different then the one of a standard MCMC run.
174
-
The column called *sample* describes at which iteration of the coupled MCMC we are. The column *swapsColdChain* denotes how many times the one cold chain (the chain that runs just like a regular MCMC chain) has been swapped with another chain. The *swapProbability* denotes how likely it is that a swapping between two chains is accepted. This vaue should be somewhere between *0.2* and *0.6*. A low values indicates that the heated chains are running too hot and are not efficiently exploring the posterior. A too high values indicates that the heated chains are not running hot enough and are thus exploring parameter space that are too similar to the one of the cold chain.
174
+
The column called *sample* describes at which iteration of the coupled MCMC we are.
175
+
The column *swapsColdChain* denotes how many times the one cold chain (the chain that runs just like a regular MCMC chain) has been swapped with another chain.
176
+
The *swapProbability* denotes how likely it is that a swapping between two chains is accepted.
177
+
By default, a value of 0.234 is targeted.
178
+
The column *deltaTemperature* denotes the current temperature difference between chains.
### Exploring the results of Bayesian Coalescent Skyline analysis
194
204
195
205
For the reconstruction of the population dynamics, we need two files: the `hcv.log` file and the `hcv.trees` file.
206
+
These outputs can be handled exactly the same as the ones of a regular MCMC analysis.
196
207
The log files contain the information about the group size and the population size.
197
208
The group size specifies how many intervals are combined to have the same effective population size.
198
-
The two files are logging the states of the one cold chain.
199
-
There are however two more files `chain1hcv.log` and `chain1hcv.trees`.
200
-
These two files, log the states of the 1st heated chain and are not needed for the post-processing.
201
-
If we look at the inferred distributions between the two files `hcv.log` and `chain1hcv.log`, we see that these don't match up and that `chain1hcv.log` explores less optimal states with higher frequency.
202
209
203
210
<figure>
204
211
<a id="fig:dimensions"></a>
205
-
<img src="figures/HeatedChains.png" alt="">
206
-
<figcaption>Figure 7: The heated chain does no correctly explore the posterior probability space.</figcaption>
212
+
<img src="figures/Tracer.png" alt="">
213
+
<figcaption>Figure 7: opening the log file in tracer.</figcaption>
207
214
</figure>
208
215
<br>
209
216
@@ -229,41 +236,35 @@ The output will have the years on the x-axis and the effective population size o
229
236
230
237
There are two ways to save the analysis, it can either be saved as a `*.pdf` or as a tab delimited file. To save it as a tab delimited file, you can go to `File > Export Data`. The exported file will have five rows, the time, the mean, median lower 95% interval and the upper 95% interval of the estimates, which you can use to plot the data with other software (R, Matlab, etc).
231
238
239
+
### Assessing convergence
232
240
241
+
Since parallel tempering runs multiple chains, it is possible for all these chains to be stuck in local optima.
242
+
Parallel tempering will then cycle through these chains that are all stuck in local optima.
243
+
This can create vert high ESS values of analyses that did not converge.
244
+
It is therefore highly advisable to run several replicates (e.g. 3) of the same analysis to see if they all give the same result.
245
+
Additionally, ESS might not be the best measure of converge of a parallel tempering analysis and something like the potential scale reduction factor might be more suited to assess convergence.
233
246
247
+
(Running replicates is not only advisable for parallel tempering analysis, but for MCMC as well).
234
248
235
-
## Setting up the same analysis without using BEAUTi
236
249
237
-
In order to setup the analysis to run with coupled MCMC without using BEAUTi, we can create and xml that is supposed to run with regular MCMC.
238
-
After this is done and the `*.xml` file (here `hcv_mcmc.xml`), has been saved, open the `*.xml` file in a Text Editor (e.g. TextEdit in MAC or notepad, but not word! in Windows).
239
250
240
-
Next, go to the line that contains the code `id="mcmc"`. In `hcv_mcmc.xml`, this is going to be the following line
251
+
## Setting up the same analysis for packages that require loading their own template
*`chainLength="100000000"` defines for how many iterations the chains is run
252
-
253
-
*`deltaTemperature="0.05"` defines the temperature difference between the chain *n* and chain *n-1*.
254
-
255
-
*`chains="2"` defines the number of parallel chains that are run. The first chain is the one that explores the posterior just like a normal MCMC chain. All other chains are what's called *heated*. This means that MCMC moves of those chains have a higher probability of being accepted. While these heated chains don't explore the posterior properly, they can be used to propose new states to the one cold chain.
253
+
In order to setup a parallel tempering analysis for packages that require loading their own packages, we can use a BEAUti app.
254
+
To do so, open BEAUti and go to `File`, select `Launch Apps`.
255
+
There, click on MCMC to Coupled MCMC converter and click `Launch`.
256
256
257
+
First, load the MCMC xml and define an output file for the parallel tempering xml.
258
+
Then, the analysis can be setup, such as for example the number of chains can be defined.
259
+
When everything is setup, just press launch and the parallel tempering xml will be created.
260
+
This xml can then be run using parallel tempering.
257
261
258
-
Next, save the xml file again and run it with BEAST. In order to post-process the output, just use the log files that do *not* start with `chain...` since these are the log files for the heated chains.
259
-
260
-
261
-
### A note on resuming coupled MCMC runs
262
-
263
-
Coupled MCMC runs can be resumed just like any other BEAST.
264
-
It is however possible that the different log files of the different chains are at different iterations, which will return an error if you try to resume this run.
265
-
If this error happens, load the log files of the cold chain and all hot chains (the chains that start with `chain...`) and look at the lowest value of the iteration.
266
-
Next, open the log files of all chains which had a higher iteration and remove the last lines until the last line has the same sample number as the lowest iteration of any chain.
0 commit comments