Skip to main content

bdd2_delayed.tppl

function bdd2​

Model function for BDD2

model function bdd2(tree: Tree, rho: Real, numIntervals: Int) => Real[]

function bddCase​

Help function to determine BDD case

function bddCase(timeSegment: Real, waitingTime: Real, deltaT: Real) => BDDCase

type BDDCase​

Type for capturing BDD time segment cases

type BDDCase =
| DeltaT {timeSegment:Real}
| Event {timeSegment:Real}
| EndOfBranch {timeSegment:Real}

type Dists​

Type for distributions

type Dists = Dists {
gdist: GammaDist,
nigdist: NormalInverseGammaDist
}

type DistsBool​

type DistsBool = DistsBool {
d: Dists,
detected: Bool
}

type Globals​

Type for global model parameters

type Globals = Globals {
epsilon: Real,
rho: Real,
deltaT: Real
}

function isDetected​

Forward simulation determining whether a tree survives and is detected

function isDetected(g: Globals, d: Dists, multiplier: Real, tBegin: Real) => DistsBool

function numTrialsUntilMRCADetection​

Get an estimate of the probability of the MRCA being detected under given parameter values

function numTrialsUntilMRCADetection(g: Globals, d: Dists, tRoot: Real, mMax: Int) => Int

type Params​

Types for returns

type Params = Params {
d: Dists,
multiplier: Real
}

function predictUndetectedProb​

Help function to predict the prob that a tree goes undetected

function predictUndetectedProb(g: Globals, d: Dists, multiplier: Real, time: Real) => Real

function simHiddenSpeciation​

Simulate hidden speciation process along a branch in the reconstructed tree

function simHiddenSpeciation(g: Globals, d: Dists, multiplier: Real, tBegin:Real, tEnd: Real) => Params

type alias Tree​

We use clock tree representation

type alias Tree = ClockTree

function walk​

Simulate ("walk") along the reconstructed tree

function walk(g: Globals, d: Dists, multiplier: Real, parentAge: Real, node: Tree) => Dists