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 to log.
  • pointFrequency (integer, default=1): frequency between points in time series to be logged. T Given a trajectory with n points [1,..,n], where point 1 corresponds to inital time t0 and point n to end time t1, the logger will log population (and rate) values for points [1,f+1,2f+1,....,n], where f denotes pointFrequency' he logger will log points 0, f, 2f, 3f, ..., last, where point 0 corresponds to t0, the trajectory's starting time, last corresponds to t1, and f to pointFrequence`.
  • 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 non-empty space-separated sequence of Xs.

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 of the trajectory - since the point frequency is one - into file model.traj. A pointFrequency of 10 combined with a popModel trajectory computed with 200 integration steps will log points 0,9,19,29,...,199 and 200, 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