Discussion:
[R] Problem with metaMDS in vegan
Fabian B
2014-02-10 11:26:54 UTC
Permalink
Hello,

I am relatively new to vegan and need some help with metaMDS. My R is
Version 3.0.2. I am analysing cuticular profiles of flys from different
locations an different gender. My data is in a 48 x 70 matrix. It is about
percentages and so, there are a lot of 0s included. If I run metaMDS, it
just gives me:

Warning message:
In metaMDS(data1, distance = "bray", k = 2, trymax = 100, autotransform = F)
:
Stress is (nearly) zero - you may have insufficient data

no matter, what I change. The error is always around 9.241406e-05, which
seems to be far to low for my data. By inspecting the data sheet, I clearly
see that there must be two clusters ? but there are still some differences
in these (meaning: Not all female flies show the same pattern than the
others and there are slight differences in the locations ?) - so I expect to
see two clusters for the sexes and in these, an accumulation of the
different locations.
But metaMDS just gives me 2 points (with ordiplot), where the 24 males and
the 24 females are completely stacked. That's just some kind of worthless
for me.
So is there any chance to get some nice clusters? I tried to limit the
number of iterationswith maxit, but had to go down to 10 to reach a suitable
result. And I don't think, I may limit the number of iterations that much.
What could possibly be the problem?

It would be great if somebody could help me.

Thaks!

Fabian



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022.html
Sent from the R help mailing list archive at Nabble.com.
David Carlson
2014-02-10 15:07:53 UTC
Permalink
Without more information, it is hard to say. You did not tell us much about the data beyond the dimensions, but it looks like you have several different kinds of measurements including location and gender (probably categorical) and cuticular profiles (presumably numeric). Without the commands you used, we can only guess what you are doing, but the snippet you provided suggests that you dumped different data types into metaMDS and used the Bray distance coefficient. The Bray coefficient is designed for analyzing community structure by comparing the counts of different species between samples. It does not appear that this is what you are trying to do.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Fabian B
Sent: Monday, February 10, 2014 5:27 AM
To: r-help at r-project.org
Subject: [R] Problem with metaMDS in vegan

Hello,

I am relatively new to vegan and need some help with metaMDS. My R is
Version 3.0.2. I am analysing cuticular profiles of flys from different
locations an different gender. My data is in a 48 x 70 matrix. It is about
percentages and so, there are a lot of 0s included. If I run metaMDS, it
just gives me:

Warning message:
In metaMDS(data1, distance = "bray", k = 2, trymax = 100, autotransform = F)
:
Stress is (nearly) zero - you may have insufficient data

no matter, what I change. The error is always around 9.241406e-05, which
seems to be far to low for my data. By inspecting the data sheet, I clearly
see that there must be two clusters ? but there are still some differences
in these (meaning: Not all female flies show the same pattern than the
others and there are slight differences in the locations ?) - so I expect to
see two clusters for the sexes and in these, an accumulation of the
different locations.
But metaMDS just gives me 2 points (with ordiplot), where the 24 males and
the 24 females are completely stacked. That's just some kind of worthless
for me.
So is there any chance to get some nice clusters? I tried to limit the
number of iterationswith maxit, but had to go down to 10 to reach a suitable
result. And I don't think, I may limit the number of iterations that much.
What could possibly be the problem?

It would be great if somebody could help me.

Thaks!

Fabian



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022.html
Sent from the R help mailing list archive at Nabble.com.
Fabian B
2014-02-10 15:57:55 UTC
Permalink
Thanks for the fast response!

My data is actually just the percentages of the substances found in the
cuticular layer of the flies. The quantitative and qualitative composition
of this layer differs in gender, locality and so on.
My 70 ?species? are the chemical compounds we identified and my 48 ?sites?
are the individuals (location and gender are encrypted in the individuals'
recognition code). Therefore, I have the percentages of one chemical
compound over all tested individuals in one row (as numeric data). You could
say that these are the abundances of the species (the compounds) at the
different sites (individuals). So my data is quite similar to community
structure. I have done this before and it worked just fine. I used:

metaMDS(data, distance=?bray?, k=2, trymax=10000, autotransform=F)

As I mentioned before, this time the stress is very low (around 9.5 * 10^-5)
and R gives me that warning message. Though I have always had data in the
same structure, I've never been in this situation. The NMDS just stops after
the first run, because of the low stress. But there are obviously some
differences in my data ? I can see them with my eye. If I discard the
'distance=?bray?', nothing changes.
May it be possible that these are simply just to little to be recognised
correctly? How could I change that?

If I add 'maxit=10', I get quite what I assumed. Two completely separated
clusters with cloudlike appearance (stress around 0.02). The clusters are
the two sexes and in each cluster, the localities group together. But I'm
not quite sure, if I may set a maxit-level that low ? or if I just create
some false relations with that.

I also recognised , that the stress gets lower, the higher I set 'maxit' and
the lower I set 'trymax'.

What could be going wrong? I really have no clue ?

Thanks for your help!

Regards,

Fabian






--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685043.html
Sent from the R help mailing list archive at Nabble.com.
David Carlson
2014-02-10 18:42:28 UTC
Permalink
A reproducible example would help. Look at the example in metaMDS using the dune data set. It consists of 20 observations (sites) with 30 species observed (columns). You indicate that your compounds (species) are the rows and your sites are the columns. So perhaps you are analyzing the distances between compounds not between sites? Have you tried analyzing t(data)?

David C

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Fabian B
Sent: Monday, February 10, 2014 9:58 AM
To: r-help at r-project.org
Subject: Re: [R] Problem with metaMDS in vegan

Thanks for the fast response!

My data is actually just the percentages of the substances found in the
cuticular layer of the flies. The quantitative and qualitative composition
of this layer differs in gender, locality and so on.
My 70 ?species? are the chemical compounds we identified and my 48 ?sites?
are the individuals (location and gender are encrypted in the individuals'
recognition code). Therefore, I have the percentages of one chemical
compound over all tested individuals in one row (as numeric data). You could
say that these are the abundances of the species (the compounds) at the
different sites (individuals). So my data is quite similar to community
structure. I have done this before and it worked just fine. I used:

metaMDS(data, distance=?bray?, k=2, trymax=10000, autotransform=F)

As I mentioned before, this time the stress is very low (around 9.5 * 10^-5)
and R gives me that warning message. Though I have always had data in the
same structure, I've never been in this situation. The NMDS just stops after
the first run, because of the low stress. But there are obviously some
differences in my data ? I can see them with my eye. If I discard the
'distance=?bray?', nothing changes.
May it be possible that these are simply just to little to be recognised
correctly? How could I change that?

If I add 'maxit=10', I get quite what I assumed. Two completely separated
clusters with cloudlike appearance (stress around 0.02). The clusters are
the two sexes and in each cluster, the localities group together. But I'm
not quite sure, if I may set a maxit-level that low ? or if I just create
some false relations with that.

I also recognised , that the stress gets lower, the higher I set 'maxit' and
the lower I set 'trymax'.

What could be going wrong? I really have no clue ?

Thanks for your help!

Regards,

Fabian






--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685043.html
Sent from the R help mailing list archive at Nabble.com.
Jari Oksanen
2014-02-11 09:56:54 UTC
Permalink
Post by Fabian B
Thanks for the fast response!
My data is actually just the percentages of the substances found in the
cuticular layer of the flies. The quantitative and qualitative composition
of this layer differs in gender, locality and so on.
My 70 ?species? are the chemical compounds we identified and my 48 ?sites?
are the individuals (location and gender are encrypted in the individuals'
recognition code). Therefore, I have the percentages of one chemical
compound over all tested individuals in one row (as numeric data). You could
say that these are the abundances of the species (the compounds) at the
different sites (individuals). So my data is quite similar to community
metaMDS(data, distance=?bray?, k=2, trymax=10000, autotransform=F)
As I mentioned before, this time the stress is very low (around 9.5 * 10^-5)
and R gives me that warning message. Though I have always had data in the
same structure, I've never been in this situation. The NMDS just stops after
the first run, because of the low stress. But there are obviously some
differences in my data ? I can see them with my eye. If I discard the
'distance=?bray?', nothing changes.
May it be possible that these are simply just to little to be recognised
correctly? How could I change that?
If I add 'maxit=10', I get quite what I assumed. Two completely separated
clusters with cloudlike appearance (stress around 0.02). The clusters are
the two sexes and in each cluster, the localities group together. But I'm
not quite sure, if I may set a maxit-level that low ? or if I just create
some false relations with that.
I also recognised , that the stress gets lower, the higher I set 'maxit' and
the lower I set 'trymax'.
What could be going wrong? I really have no clue ?
I think nothing is going wrong: you just have that kind of data, and
there is nothing wrong there.

There is nothing to reproduce here, but it *seems* that you may have
a disjoint data set with two clusters sharing nothing between them.
The metaMDS is obsessed with that difference and does its best to
separate these clusters. If you set 'maxit=10', it does not have time
to finish the job, and you get two clouds. Just let it finish, and the
clouds are squeezed to singularities.

If you want to see the structure within these singularities, you
could analyses these groups of points separately. Then the major
difference between clouds won't obscure you.

I am not quite convinced that Bray-Curtis (distance='bray') is the
best choice of dissimilarity measure for these kind of data. If you
have scaled values (percentages), choices like 'distance = "manhattan"'
or 'distance = "euclidean"' or 'distance = "gower"' could work better.

As we have no reproducible example, this is all guessing.

Cheers, Jari Oksanen
Fabian B
2014-02-11 17:42:05 UTC
Permalink
Thank you very much!

This is exactly the problem, I am in. I ran the NMDS for only one gender and
it shows me the results, I was expecting.

I was told to use bray-curtis, because there are a lot of "0"s in my data
set and in e.g. manhattan these would have to much influence on the result.
But in nature, chemicals that are only weakly represented may not have very
much influence on the other individuals. For the moment, I won't question
that decision, because it's quite a convention in chemical ecology, as I
heard.

Regards,

Fabian



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685134.html
Sent from the R help mailing list archive at Nabble.com.
Fabian B
2014-02-11 17:42:05 UTC
Permalink
Thank you very much!

This is exactly the problem, I am in. I ran the NMDS for only one gender and
it shows me the results, I was expecting.

I was told to use bray-curtis, because there are a lot of "0"s in my data
set and in e.g. manhattan these would have to much influence on the result.
But in nature, chemicals that are only weakly represented may not have very
much influence on the other individuals. For the moment, I won't question
that decision, because it's quite a convention in chemical ecology, as I
heard.

Regards,

Fabian



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685134.html
Sent from the R help mailing list archive at Nabble.com.

David Carlson
2014-02-10 18:42:28 UTC
Permalink
A reproducible example would help. Look at the example in metaMDS using the dune data set. It consists of 20 observations (sites) with 30 species observed (columns). You indicate that your compounds (species) are the rows and your sites are the columns. So perhaps you are analyzing the distances between compounds not between sites? Have you tried analyzing t(data)?

David C

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Fabian B
Sent: Monday, February 10, 2014 9:58 AM
To: r-help at r-project.org
Subject: Re: [R] Problem with metaMDS in vegan

Thanks for the fast response!

My data is actually just the percentages of the substances found in the
cuticular layer of the flies. The quantitative and qualitative composition
of this layer differs in gender, locality and so on.
My 70 ?species? are the chemical compounds we identified and my 48 ?sites?
are the individuals (location and gender are encrypted in the individuals'
recognition code). Therefore, I have the percentages of one chemical
compound over all tested individuals in one row (as numeric data). You could
say that these are the abundances of the species (the compounds) at the
different sites (individuals). So my data is quite similar to community
structure. I have done this before and it worked just fine. I used:

metaMDS(data, distance=?bray?, k=2, trymax=10000, autotransform=F)

As I mentioned before, this time the stress is very low (around 9.5 * 10^-5)
and R gives me that warning message. Though I have always had data in the
same structure, I've never been in this situation. The NMDS just stops after
the first run, because of the low stress. But there are obviously some
differences in my data ? I can see them with my eye. If I discard the
'distance=?bray?', nothing changes.
May it be possible that these are simply just to little to be recognised
correctly? How could I change that?

If I add 'maxit=10', I get quite what I assumed. Two completely separated
clusters with cloudlike appearance (stress around 0.02). The clusters are
the two sexes and in each cluster, the localities group together. But I'm
not quite sure, if I may set a maxit-level that low ? or if I just create
some false relations with that.

I also recognised , that the stress gets lower, the higher I set 'maxit' and
the lower I set 'trymax'.

What could be going wrong? I really have no clue ?

Thanks for your help!

Regards,

Fabian






--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685043.html
Sent from the R help mailing list archive at Nabble.com.
Jari Oksanen
2014-02-11 09:56:54 UTC
Permalink
Post by Fabian B
Thanks for the fast response!
My data is actually just the percentages of the substances found in the
cuticular layer of the flies. The quantitative and qualitative composition
of this layer differs in gender, locality and so on.
My 70 ?species? are the chemical compounds we identified and my 48 ?sites?
are the individuals (location and gender are encrypted in the individuals'
recognition code). Therefore, I have the percentages of one chemical
compound over all tested individuals in one row (as numeric data). You could
say that these are the abundances of the species (the compounds) at the
different sites (individuals). So my data is quite similar to community
metaMDS(data, distance=?bray?, k=2, trymax=10000, autotransform=F)
As I mentioned before, this time the stress is very low (around 9.5 * 10^-5)
and R gives me that warning message. Though I have always had data in the
same structure, I've never been in this situation. The NMDS just stops after
the first run, because of the low stress. But there are obviously some
differences in my data ? I can see them with my eye. If I discard the
'distance=?bray?', nothing changes.
May it be possible that these are simply just to little to be recognised
correctly? How could I change that?
If I add 'maxit=10', I get quite what I assumed. Two completely separated
clusters with cloudlike appearance (stress around 0.02). The clusters are
the two sexes and in each cluster, the localities group together. But I'm
not quite sure, if I may set a maxit-level that low ? or if I just create
some false relations with that.
I also recognised , that the stress gets lower, the higher I set 'maxit' and
the lower I set 'trymax'.
What could be going wrong? I really have no clue ?
I think nothing is going wrong: you just have that kind of data, and
there is nothing wrong there.

There is nothing to reproduce here, but it *seems* that you may have
a disjoint data set with two clusters sharing nothing between them.
The metaMDS is obsessed with that difference and does its best to
separate these clusters. If you set 'maxit=10', it does not have time
to finish the job, and you get two clouds. Just let it finish, and the
clouds are squeezed to singularities.

If you want to see the structure within these singularities, you
could analyses these groups of points separately. Then the major
difference between clouds won't obscure you.

I am not quite convinced that Bray-Curtis (distance='bray') is the
best choice of dissimilarity measure for these kind of data. If you
have scaled values (percentages), choices like 'distance = "manhattan"'
or 'distance = "euclidean"' or 'distance = "gower"' could work better.

As we have no reproducible example, this is all guessing.

Cheers, Jari Oksanen
Fabian B
2014-02-10 11:26:54 UTC
Permalink
Hello,

I am relatively new to vegan and need some help with metaMDS. My R is
Version 3.0.2. I am analysing cuticular profiles of flys from different
locations an different gender. My data is in a 48 x 70 matrix. It is about
percentages and so, there are a lot of 0s included. If I run metaMDS, it
just gives me:

Warning message:
In metaMDS(data1, distance = "bray", k = 2, trymax = 100, autotransform = F)
:
Stress is (nearly) zero - you may have insufficient data

no matter, what I change. The error is always around 9.241406e-05, which
seems to be far to low for my data. By inspecting the data sheet, I clearly
see that there must be two clusters ? but there are still some differences
in these (meaning: Not all female flies show the same pattern than the
others and there are slight differences in the locations ?) - so I expect to
see two clusters for the sexes and in these, an accumulation of the
different locations.
But metaMDS just gives me 2 points (with ordiplot), where the 24 males and
the 24 females are completely stacked. That's just some kind of worthless
for me.
So is there any chance to get some nice clusters? I tried to limit the
number of iterationswith maxit, but had to go down to 10 to reach a suitable
result. And I don't think, I may limit the number of iterations that much.
What could possibly be the problem?

It would be great if somebody could help me.

Thaks!

Fabian



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022.html
Sent from the R help mailing list archive at Nabble.com.
David Carlson
2014-02-10 15:07:53 UTC
Permalink
Without more information, it is hard to say. You did not tell us much about the data beyond the dimensions, but it looks like you have several different kinds of measurements including location and gender (probably categorical) and cuticular profiles (presumably numeric). Without the commands you used, we can only guess what you are doing, but the snippet you provided suggests that you dumped different data types into metaMDS and used the Bray distance coefficient. The Bray coefficient is designed for analyzing community structure by comparing the counts of different species between samples. It does not appear that this is what you are trying to do.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Fabian B
Sent: Monday, February 10, 2014 5:27 AM
To: r-help at r-project.org
Subject: [R] Problem with metaMDS in vegan

Hello,

I am relatively new to vegan and need some help with metaMDS. My R is
Version 3.0.2. I am analysing cuticular profiles of flys from different
locations an different gender. My data is in a 48 x 70 matrix. It is about
percentages and so, there are a lot of 0s included. If I run metaMDS, it
just gives me:

Warning message:
In metaMDS(data1, distance = "bray", k = 2, trymax = 100, autotransform = F)
:
Stress is (nearly) zero - you may have insufficient data

no matter, what I change. The error is always around 9.241406e-05, which
seems to be far to low for my data. By inspecting the data sheet, I clearly
see that there must be two clusters ? but there are still some differences
in these (meaning: Not all female flies show the same pattern than the
others and there are slight differences in the locations ?) - so I expect to
see two clusters for the sexes and in these, an accumulation of the
different locations.
But metaMDS just gives me 2 points (with ordiplot), where the 24 males and
the 24 females are completely stacked. That's just some kind of worthless
for me.
So is there any chance to get some nice clusters? I tried to limit the
number of iterationswith maxit, but had to go down to 10 to reach a suitable
result. And I don't think, I may limit the number of iterations that much.
What could possibly be the problem?

It would be great if somebody could help me.

Thaks!

Fabian



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022.html
Sent from the R help mailing list archive at Nabble.com.
Fabian B
2014-02-10 15:57:55 UTC
Permalink
Thanks for the fast response!

My data is actually just the percentages of the substances found in the
cuticular layer of the flies. The quantitative and qualitative composition
of this layer differs in gender, locality and so on.
My 70 ?species? are the chemical compounds we identified and my 48 ?sites?
are the individuals (location and gender are encrypted in the individuals'
recognition code). Therefore, I have the percentages of one chemical
compound over all tested individuals in one row (as numeric data). You could
say that these are the abundances of the species (the compounds) at the
different sites (individuals). So my data is quite similar to community
structure. I have done this before and it worked just fine. I used:

metaMDS(data, distance=?bray?, k=2, trymax=10000, autotransform=F)

As I mentioned before, this time the stress is very low (around 9.5 * 10^-5)
and R gives me that warning message. Though I have always had data in the
same structure, I've never been in this situation. The NMDS just stops after
the first run, because of the low stress. But there are obviously some
differences in my data ? I can see them with my eye. If I discard the
'distance=?bray?', nothing changes.
May it be possible that these are simply just to little to be recognised
correctly? How could I change that?

If I add 'maxit=10', I get quite what I assumed. Two completely separated
clusters with cloudlike appearance (stress around 0.02). The clusters are
the two sexes and in each cluster, the localities group together. But I'm
not quite sure, if I may set a maxit-level that low ? or if I just create
some false relations with that.

I also recognised , that the stress gets lower, the higher I set 'maxit' and
the lower I set 'trymax'.

What could be going wrong? I really have no clue ?

Thanks for your help!

Regards,

Fabian






--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685043.html
Sent from the R help mailing list archive at Nabble.com.
Loading...