structured_coal.simulate: Simulate expansion structured coalescent Population size must...

View source: R/structured_coal.R

structured_coal.simulateR Documentation

Simulate expansion structured coalescent Population size must be locally smooth around divergence time and must reach 0 at divergence time !! Note: This simulation relies on inverse transform sampling and numerical inverses of Neg.rate.ints

Description

Simulate expansion structured coalescent Population size must be locally smooth around divergence time and must reach 0 at divergence time !! Note: This simulation relies on inverse transform sampling and numerical inverses of Neg.rate.ints

Usage

structured_coal.simulate(
  sampling_times,
  colours,
  div_times,
  div_events,
  Neg.rates,
  Neg.rate.ints,
  div.from = NA
)

Arguments

sampling_times

Nx1 times of leaves.

colours

Nx1 colour assignment of leaves

div_times

Kx1 divergence times for colours, neutral colour must diverge at -Inf. MUST BE IN DESCENDING ORDER

div_events

Kx1 colour assignment for divergence times, i.e. which colour corresponds to which divergence time

Neg.rates

Kx1 List of Functions (t)->(R+). 1/Neg(t) for each colour.

Neg.rate.ints

Kx1 List of Functions (t, s)->(R+). int_t^s 1/Neg(tau),d tau for each colour

div.from

Kx1 List of integers denoting parents of diverging lineages. If NA parents will be randomised

Value

A list consisting of the simulate coalescent times coalescent_times and the log-likelihood of the simulation log_likelihood.


dhelekal/CaveDive documentation built on June 11, 2024, 4:32 p.m.