Skip to content

Error with metaMDS

5 messages · suparna mitra, Sarah Goslee, Gavin Simpson

#
Hi,

What do you expect the dissimilarity between a site with no species
and a site with some species to be?

If you want to use Bray-Curtis dissimilarity, you need to drop the
sites with no species, as the error message suggests.

But if you can answer my first question, you may be able to select a
different dissimilarity metric that matches your expectations
numerically.

Sarah


On Mon, Jun 24, 2013 at 7:33 AM, Suparna Mitra
<suparna.mitra.sm at gmail.com> wrote:

  
    
#
Hi,

On Mon, Jun 24, 2013 at 12:04 PM, Suparna Mitra
<suparna.mitra.sm at gmail.com> wrote:
Well, that's what this says:
There's no reason to delete those. Bray-Curtis and similar metrics
consider only joint presences, not joint absences. If you have a lot
of sites with no species in common, it can also cause problems. That's
what vegan::stepacross is intended to deal with.
The best thing to do in such cases is to provide a reproducible
example to R-help. At the very least,
str(X)
str(data) # called in metaMDS() but not described; also, don't call
your data data

and double-check to make sure you don't have any all-zero rows or NA
values in your data.

Sarah

  
    
#
On Mon, 2013-06-24 at 19:33 +0800, Suparna Mitra wrote:
<snip />
That is fundamentally wrong - you are setting argument `X` to the
character vector `"bray"`, that is not how you call metaMDS(). Hence I
suspect you didn't bother to include the full code...!

Let's assume you cal actually call metaMDS() correctly...

The first set of warnings (not the error) come `vegdist()`. The first is
from :

if (method > 2 && any(rowSums(x, na.rm = TRUE) == 0))

and hence if you do

which(rowSums(X, na.rm = TRUE) == 0)

you'll see which rows (samples) have no counts at all. The second
warning in the first set comes from

if (any(is.na(d))) 
        warning("missing values in results")

hence by the time vegdist has computed the dissimilarity, those
computation ended up generating one or more `NA` values. Things go
downhill from there as the error generated from within metaMDS() is
because we are comparing the distances with the smallest representable
number and any comparison with `NA` yields `NA` and hence the first
Error you see. We should probably catch that but I don't have a
reproducible example to see why we don't...
Look at `str(data)` and if any of the columns are factors, change them
to be numeric or find out why R thinks they are factors - it wouldn't
normally convert numeric data to a factor when reading the data in.

What is `data`? You only refer to `Genus_data`.

Please try to be specific about exactly what you did - i.e. include the
actual code.

I suspect the things you try below are pointless as it is not zero
distances that are the problem but sites for which no observations were
recorded.

G