continueMCMC {ratematrix} | R Documentation |
Continue unfinished MCMC chain or add more generations
Description
Function to continue an unfinished MCMC chain or to append more generations to a previously finished MCMC. It works by reading the last state of the chain and the tunning parameters of the previous chain, then restarting it from this step.
Usage
continueMCMC(handle, add.gen = NULL, save.handle = TRUE, dir = NULL)
Arguments
handle |
the output of 'ratematrixMCMC'. |
add.gen |
number of generations to be added to a finished chain. If 'NULL' (default), the function will only continue unfinished chains. |
save.handle |
whether to save the updated 'handle' object to the directory. This can overwrite the previous handle file. |
dir |
an optional path to the output files. See 'Details'. |
Details
The function will append the new generations to the same files created by the prior run of the 'ratematrixMCMC' function. The function will, by default, search for files in the same directory of the previous run (see 'handle$dir'). However, you can provide a new path (relative or absolute path) to the argument 'dir'. The path provided to 'dir' will override the path pointed by 'handle$dir'. The new 'handle' output from 'continueMCMC' will have an updated total number of generations and will also update the directory path, if required.
Value
Function will write the parameter values for each generation and the log to files. The new generations will be appended to the same files created by 'ratematrixMCMC'.
Author(s)
Daniel S. Caetano and Luke J. Harmon
Examples
## Continue unfinished run.
data(centrarchidae)
handle <- ratematrixMCMC(data=centrarchidae$data, phy=centrarchidae$phy.map, gen=10000
, dir=tempdir())
## Now add generations to the same MCMC chain.
handle.add <- continueMCMC(handle=handle, add.gen=10000)