匠人府分享 http://blog.sciencenet.cn/u/meiweipingg

博文

在R中运行metaMDS

已有 7684 次阅读 2016-10-18 10:02 |个人分类:R语言|系统分类:科研笔记| not, metaMDS, actual, nMDS

中英文混合版。

Function metaMDS performs Nonmetric Multidimensional Scaling (NMDS), and tries to find a stable solution using several random starts. In addition, it standardizes the scaling in the result, so that the configurations are easier to interpret, and adds species scores to the site ordination.

The metaMDS{vegan} functiondoes not provide actual NMDS, but itcalls another function for the purpose. Currently monoMDS {vegan} isthe default choice, and it is also possible to call the isoMDS (MASS package).


#---------------------------------------metaMDS-----------------------------------


FishEnv<- read.csv("~/FishEnv.csv")

View(FishEnv)

FishBio <- read.csv("~/FishBio.csv")

View(FishBio)

# 数据含义请参考博文在R中正确运行ANOSIM——样品组间差异显著性检测及注意事项



# FishEnv.csv


#FishBio.Env


library("vegan")

distance.bray<-vegdist(FishBio,method = 'bray')


n<-metaMDS(distance.bray,k=2)


# plot(n,type='text')

# plot metaMDS in different colors for each group


op=plot(n,type = 'n')

#points

cols=c('darkred','green',’blue’,’pink’)

points(n,cex=2, pch=16, col=cols[FishEnv$Group])

#decoration

ordispider(n,groups = FishEnv$Group,label = TRUE)  #add a spider lines for each species to centriod

ordihull(n,groups = FishEnv$Group,lty='dotted')  #add hull convex for each Group.

legend('topright',pch=16,col=cols,legend =levels(FishEnv$Group))

n$stress

# [1] 0

# stress = 0




# over


相关博文:

1.正确作“系统(层次)聚类分析”之R(或Rstudio)应用

2.在R中正确运行PERMANOVA  and pairwise comparison——样品组间差异显著性检验及注意点

3.在R中正确运行ANOSIM——样品组间差异显著性检测及注意点





http://blog.sciencenet.cn/blog-651374-1009412.html

上一篇:在R中正确运行PERMANOVA and pairwise comparison及注意事项
下一篇:非线性回归(迭代法)及其两种拟合曲线:y=a+b*exp(c*x)

0

该博文允许注册用户评论 请点击登录 评论 (6 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2020-12-1 02:10

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部