Symetric covariance function

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 :

Y_{i,j} \sim MultiNormal(\mu_{i,j}, \Sigma)\\ \Sigma = f(D)

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!

Ok! I think that I found something, with non-parametric covariance functions…

Now, let’s see if it is really interesting to implement it and possible to estimate it…

Why don’t you try a euclidean distance first, Stan function cov_exp_quad and then replace the square by cosh for a U-shaped distance?