sim_history_piece_conditional: Simulate history of discrete-character changes over a...

View source: R/posteriorpredictive_functions.R

sim_history_piece_conditionalR Documentation

Simulate history of discrete-character changes over a duration of time (i.e., a piece of a branch that the character evolved under a constant model) conditioning on the start and end states (implementing algorithm #5 of Hobolth and Stone, 2009)

Description

Simulate history of discrete-character changes over a duration of time (i.e., a piece of a branch that the character evolved under a constant model) conditioning on the start and end states (implementing algorithm #5 of Hobolth and Stone, 2009)

Usage

sim_history_piece_conditional(
  node_ages,
  Q,
  Q_ages = NULL,
  P = NULL,
  node_state_indices
)

Arguments

node_ages

Start and end ages of this duration

Q

An instantaneous-rate matrix (or a list of matrices for a piecewise constant geographic model) characterizes the CTMC

Q_ages

A vector containing boundaries of time intervals for a piecewise constant geographic model (NULL means a constant model); the length of this vector should be one shorter than the Q-matrix list, sorted from oldest to youngest.

P

The transition probability matrix computed from the Q matrix (if not provided then it will be computed in this function)

node_state_indices

State indices (i.e., the indices to use to fecth the states from the states vector) pf the start and end nodes

Value

A list containing two vectors, one for the end state of each event over this duration and other for the age of each event


jsigao/prioritree documentation built on Jan. 9, 2023, 5:35 a.m.