Hello dear stan community :)

Imagine a multivariate n \times p data set with covariance between columns (species) depending upon distance between species in a measured characteristic. In the case of normally distributed variables, I would wite the model as follow :

Where D is a matrix containing the distance between each species in terms of a measured trait, and f() a covariance function.

I have a strong theoretical assumption that the covariance function might be “U-shaped”. That is that both close and distance species might covary more than moderately related species.

I know there is plenty of covariance functions, and that we can add them or multiply them to create new ones. However, I did not find anything that seems to be able to fill my need.

Do you have any idea? Is my approach the correct one, or is there another, more pertinent way to look at the problem?

Thank you very much, and have a good day!

Lucas