In R, from a vector of trait values for exploiter species, and another one for victim species, I want to generate a network of interactions between exploiters and victims following the trait matching function, in which the probability that an interaction occurs between an exploiter and victim depends on the distance between their trait values:
In the image, f(zi - zj) would correspond to the probability of interaction (zi being the trait value for a victim and zj for the exploiter). Therefore, I can assign either 0 (no interaction) or 1 (interaction) between the exploiter and the victim if I compute the probability that they interact given by the difference in trait values between them.
I envision something like having a "trait matching matrix" first, where the difference in trait values is calculated between all exploiters and victims. And then, apply the matching function to this difference (y axis in the image) to obtain a certain probability for the interaction to occur (x axis) and then compute these probabilities to convert the matrix to 0 and 1 (which interactions occur and which ones don't).
How could we do this?
Any package/function you know to generate networks with the trait matching model/function?