[R-sig-eco] Question regarding Bray Curtis and NMDS

Martin Weiser we|@er2 @end|ng |rom n@tur@cun|@cz
Fri Oct 13 15:02:49 CEST 2023


Dne 10. 10. 23 v 18:26 Barton, Alana Charlotte napsal(a):
> Hello,
> I was recommended this email by another student for R help;
> I am currently analyzing differences in fish assemblages due to temperature
> extremes. I am looking at data over multiple years.
> I chose three sampling sites within a single bay, the sites are used as
> replicates for my analysis. The ultimate goal would be to determine if
> there is any difference between assemblages in a given year and is it the
> significant difference occurring between a warm and cold year.
>   I am interested in determining if the assemblages have a significant
> difference between species in the the years, thus I am looking to use Bray
> Curtis dissimilarity and displaying it in NMDS.
> I want to use the transformed Bray-Curtis for NMDS rather than Hellinger
> transformation but it is not displaying properly as Bray Curtis will only
> display the years not the species names in the matrix.  I am fairly new to
> vegan and multivariate analysis.
> Thank you for your time and help,
> Data Code:
> #Packages
> library(vegan)
> library(ggvegan)
> library(ggplot2)
> library(tidyverse)
> #4th root transformation for count data
>   >BBcounts_transformed<-siteBB^(1/4)
> #Bray-Curtis analysis
>   >BBtrans_bray<-vegdist(BBcounts_transformed, method="bray")
> 
> Wish to replace with hellinger transformation for this given code:
> #NMDS-unconstrained
> #Transform using Hellinger
>> BB_hel<-decostand(siteBB, method="hellinger")
>> BB_nmds<-metaMDS(BB_hel,autotransform = F)
> #Fortify graphing
>> fort_BB<-fortify(BB_nmds)
>> ggplot() +
>    geom_point(data=subset(fort_BB, Score =='sites'),
>               mapping = aes(x = NMDS1, y = NMDS2),
>               color="black",
>               alpha=0.5) +
>    geom_segment(data=subset(fort_BB,Score == 'species'),
>                 mapping=aes(x=0,y=0,xend=NMDS1,yend=NMDS2),
>                 arrow=arrow(length = unit(0.015,"npc"),
>                             type="closed"),
>                 color="darkgrey",
>                 size=0.8) +
>    geom_text(data=subset(fort_BB, Score == 'species'),
>              mapping=aes(label=Label, x= NMDS1 * 1.3, y= NMDS2 *1.3))+
>    geom_abline(intercept=0,slope=0,linetype="dashed", size=0.8,
> color="gray") +
>    geom_vline(aes(xintercept=0), linetype="dashed", size=0.8, color="gray") +
>    theme(panel.grid.major = element_blank(),
>          panel.grid.minor = element_blank(),
>          panel.background = element_blank(),
>          axis.line=element_line(color="black")
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Dear Alana Charlotte Barton,

If you have a hypothesis to visualize/to test, i.e. the difference 
between years, I suggest using some more regression-like technique than 
the NMDS.

Given the choice of the package, what about cca() ?
In that, you use your communities directly (not the distances). First, 
it might help if you exclude very rare species, e.g. species that 
occurred just once or twice (or three times) in the whole dataset.

Then you just run:
cca(communityMatrix ~ yearTemperature), and you are done. Or, taken into 
account the site identity as well:
model <- cca(communityMatrix ~ yearTemperature + Condition(Site))

then you just run

anova(model)

and you get the significance test of the hypothesis

This makes the plot:

plot(model)

(of course, you might take into account autocorrelation of temperature, 
weird counts, etc., but that should be done anyway)

HTH,

Martin


-- 
Please expect long response time (3d+) - this is because of family reasons



More information about the R-sig-ecology mailing list