# Partial correlations among three distance matrices

I am trying to test the hypothesis that related species should deviate more in niche space the more they overlap in geographic space. In other words, related species either forage similarly and don't show a lot of geographic overlap, or if they overlap a lot geographically, then they have shifted a lot in niche space. Phylogenetic distance (how closely the species are related) explains a good deal of the variance in a distance matrix of how far apart the species are in niche space.

So, I have three distance matrices among species: genetic distance, distance in niche space, and average geographic overlap. I don't think a partial Mantel test is exactly what I want, but I could definitely be wrong. Semi-mathematically, I'm thinking there is a strong correlation between the genetic distance matrix and distance in niche space (i.e. closely related species are not far apart in niche space), BUT when this doesn't hold true, it's because there is a large value in the corresponding cell in the geographic overlap distance matrix.

What is the correct statistical approach to employ? Any specifics about how to run this in R are welcome but not required.

Look into the 'multiple regression on distance matrices' approach used in this paper. The method is implemented in the R package ecodist (function MRM).