Skip to content

Extract residuals from adonis function in vegan package

13 messages · Alicia Valdés, Eduard Szöcs, Cade, Brian +4 more

#
Dear Alicia Vald?s,
On 18/03/2014, at 13:53 PM, Alicia Vald?s wrote:
You cannot get residuals from the output of adonis(). 

We could change the function so that this is possible, but the current function does not return information for getting residuals. Neither would they be residuals in the traditional meaning of the word as we are dealing with dissimilarities or distances, and these cannot be negative. We got to discuss this with vegan developers.

Cheers, Jari Oksanen
#
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?

Eduard Sz?cs
On 03/18/2014 01:21 PM, Jari Oksanen wrote:

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

            
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
#
Hi all,
On 18.03.2014 12:53, Alicia Vald?s wrote:
Jari, and Eduard - please correct me if I'm wrong.
It's just a quick thought: couldn't you, Alicia, use Condition() to
remove the effect of region out of her analysis? Something in the line of:

capscale(communitydistances ~ environmentalvar+Condition(region))

Indicator species analysis could be done for each region separately.

And additionally, you could use simper() for analysing groups in your
data - which should be compatible to capscale if you use beta-w there
(as presence-absence analogon to BC distances).


Cheers,
 arne
#
On 18/03/2014, at 16:33 PM, Alicia Vald?s wrote:

            
Now you really have to tell us what do you mean with "true" residuals. From the point of view adonis() "true residuals" are dissimilarities, but it seems that you want something completely different. What that may be? Your concept of "residual" seems to be different from mine, so please explain what you want to have.

If you want to have residuals of raw data, you can use rda() and its residuals() method. However, if you intend to use these in subsequent analysis, please note that labdsv functions at least seem to assume that data are non-negative, but it does not check this.

Cheers, Jari Oksanen
#
On Tue, Mar 18, 2014 at 5:02 PM, Alicia Vald?s
<aliciavaldes1501 at gmail.com> wrote:
...
...

Isn't an indicator species analysis *based* on differences in species
composition? How could one "remove the difference in species
composition due to region" and then still hope to identify indicator
species for the regions that are "equalized"?

Cheers,
Ivailo
#
On Tue, Mar 18, 2014 at 5:02 PM, Alicia Vald?s
<aliciavaldes1501 at gmail.com> wrote:
...
Alicia,

following up on my previous comment, I think you might use the regions
as a typology on which to base your ISA. So you'll get the
characteristic species for each region and there is no need to
"account" for differences in species composition among regions
(moreover, I fail to understand why one might need to do so).

If you take a look at the help page for multipatt() in indicspecies,
you'll see that you need a community data table (your presence/absence
matrix) and a site classification (your "regions" if these are not
further classified into meaningful clusters; although you didn't
provide more details on how the forest patches relate to the regions
you wrote about) to run the analysis.

HTH,
Ivailo
#
Alicia

One more thought. I wonder if part of the problem is that you're
attempting to use ISA to do something it was not designed to deal with.
Sometimes that can work and result in a clever new approach, but in this
case, I don't see how it can work. As a recall, ISA is done by taking the
product of relative abundance and relative frequency. Therefore, as
mentioned by Jari, it can only be used with positive values of abundance
and frequency. Yes, it is true that you can transform the residual
abundances to make them all positive. That seems perfectly reasonable if
you then intend to use the residual abundances (and the residual
abundances only) to examine associations with environmental groups. What
is puzzling me is how one calculates a relative frequency using residual
abundances or how one calculates a "residual frequency." Is it your
intention to calculate residual frequencies? It's not clear to me how that
could be done. I suppose you could leave out the relative frequency when
doing the ISA, but that leads me to the following question: Can you tell
us why indicator species analysis is a better approach for determining
indication of particular environmental conditions than are species scores
generated from a capscale ordination?  Given the flexibility of capscale
to deal with categorical predictors, it has never been clear to me what
advantages ISA has over species scores in interpreting environmental
associations (other than generating a Monte Carlo-derived significance
value). If there is not much difference, then I would do a capscale
analysis using region as a Condition factor (as suggested by Arne) and
then examine the species scores.

Steve

 
J. Stephen Brewer 
Professor 
Department of Biology
PO Box 1848
 University of Mississippi
University, Mississippi 38677-1848
 Brewer web page - http://home.olemiss.edu/~jbrewer/
FAX - 662-915-5144
Phone - 662-915-1077
On 3/18/14 11:48 AM, "Alicia Vald?s" <aliciavaldes1501 at gmail.com> wrote: