Create a linear decay function for genetic distance of two taxa and the probability of success of a hybridization event

make.linear.decay(threshold)

Arguments

threshold

A numeric representing how quickly the hybridization success decays. Smaller values denote a quicker decay

Value

A linear decay function

Details

The function computes: $$1-\frac{d}{t} $$ where d is the genetic distance between taxa

Note

a distance \(d\) greater than \(t\) will return 0

Examples

set.seed(17)
dist_func<- make.linear.decay(0.5)
net<-sim.bdh.age(1,1,5,2,2,c(1/3,1/3,1/3),hyb.inher.fxn = make.uniform.draw(),
hyb.rate.fxn=dist_func,complete=TRUE)[[1]]