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

make.polynomial.decay(threshold, degree = 1)

Arguments

threshold

A numeric denoting how quickly the polynomial function decays. Distances greater than the threshold will return a success probability of 0.

degree

The degree of the polynomial

Value

An polynomial decay function

Details

The function computes: $$1- {\frac{d}{t}}^degree$$ Where d is the distance and t is the threshold

Examples

set.seed(17)
dist_func<- make.polynomial.decay(0.5,2)
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]]