[R-sig-eco] Extract residuals from adonis function in vegan package

Jari Oksanen jari.oksanen at oulu.fi
Tue Mar 18 15:06:18 CET 2014


On 18/03/2014, at 15:23 PM, Eduard Szöcs wrote:

> Dear Alicia and Jari,
> 
> just a thought:
> Couldn't be capscale or betadisper be used for this?
> - To obtain the distances to the group centroid?
> 
> But than: How to convert this from distances to abundances?
> 
You can *almost* do this with capscale(), but not quite: for semimetric dissimilarities the results are not identical with capscale (they are identical with metric distances). The capscale() function also has fitted() and residuals() methods that both return dissimilarities. Now it also depends on what you mean with "residuals". The capscale() interpretation and the one I had on my mind is that 

1) adonis(fitted(adonis(y ~ model)) ~ model) should give distances where the fitted part of adonis(y ~model) and the residual variation part should be null, and

2) adonis(residuals(adonis(y ~model) ~ model) should give distances where fit would be null and residual similar as in the original adonis(y ~ model).

It would be possible to develop such functions, but not with the current adonis() output. You can approximate both of these with capscale() and its fitted() and residuals() methods, but not exactly. 

The ecodist package of Sarah Goslee takes a different approach, and could return something usable (but I do not know that package very well).

What really is needed depends on what you mean with "residuals". Should they be dissimilarities (which cannot be negative) or straightforward residuals (which have an average of zero and some of which are negative).

Cheers, jari Oksanen


 



More information about the R-sig-ecology mailing list