Skip to content

Loggers

Igor Siveroni edited this page May 28, 2020 · 21 revisions

Loggers

PhyDyn is equipped with two types of loggers, TrajectoryLogger and STreeRootLogger.

TrajectoryLogger

The TrajectoryLogger records the population sizes of deme and non-demes along the population trajectories generated during an MCMC run, as well as birth and migration rates (optional). In addition to the fileName and logEvery standard Logger arguments, the TrajectoryLogger uses the following:

  • popModel(BEAST object): reference to the PhyDyn population model BEAST object (trajectory) to log.
  • pointFrequency (integer): frequency of between timepoints points from trajectory timeseries to log.
  • logrates (string): Indicates birth and migration rates (matrix equation entries) to log.
    Syntax:
    <logrates> ::= (<matrix-rate> | F | G)+ | all
    <matrix-rate> ::= F(<deme> , <deme>) | G(<deme>, <deme>)
    where <X>+ denotes a space-separated sequence of <X>s.

The number of points recorded per trajectory depends on the value of the pointFrequency parameter, and the number of points used to approximate the trajectory the PopModelODE solver (integrationSteps arguemnt in TrajectoryParameters). For example, the logger defined by:

<logger id = "popModelLogger" fileName="model.traj" logEvery="100">
  <log id="trajectoryLogger" spec="TrajectoryLogger" popModel="@sirmodel" pointFrequency="1"></log>
</logger>

will log every point in the trajectory - since the point frequency is one - into file model.traj. A pointFrequency of 10, for example, would log points 0,9,19,29,..., plus the last-point. The logger produces a tab-separated table where each row corresponds to a time-point, which can be plotted by running the plot_trajectory.R script.

STreeRootLogger

The STreeRootLogger logs the state probabilities at the root of the trees sampled during an MCMC run. It is defined as follows:

<logger id="probtreelog" fileName="rootStateProbabilities.log" logEvery="1" mode="tree">
	<log id="logTrees" spec="STreeRootLogger" tree="@tree" density="@stlikelihood"/>
</logger>

Clone this wiki locally