InstituteofBotany,theChineseAcademyofSciences用vegan进行排序分析米湘成InstituteofBotany,theChineseAcademyofSciences一、vegan软件包是Vegetationanalysis的缩写。是一个群落分析的软件。作者:JariOksanen~jarioksa/softhelp/vegan.htmllibrary(vegan)InstituteofBotany,theChineseAcademyofSciences群落数据gtsdata=read.table(“gtsdata.txt”,header=T);gtsdatadim(gtsdata)CASEYRSCHSUPDAPOLDPINMASCINSUBCYCGLAMACTHULITGLACASFARMELOLDMYRRUBADIMILALBKALSORFOLCYCMYRTOXSUCCASTIB12238109090110000102108404120300140002034270425041010000104222901251510102000075115308532400300002637108630100300000715520653000140002081459061105000000000926311141106001300020102359121108000510000111424113320004210010121275012115031200000134510060602000000041442100252000000313153220614100100040416144405540000110300InstituteofBotany,theChineseAcademyofSciences环境数据gtsenv=read.table(“gtsenv.txt”,header=T);gtsenvdim(gtsenv)elevconvexslopeaspectNPKpH154.89275-1.743750046.78939114.017753.3343760.21476543.6946244.713993257.99200-2.215000045.69906263.083394.2021020.24519584.3732284.773120354.503253.840750044.46079256.716993.8336740.22605204.2897544.935478447.896004.326000039.24653237.811063.0797960.20179853.9589305.087159546.189001.779000037.27584110.115732.8877530.19636633.6448215.167524651.843004.287000035.67033185.922263.6789460.24223174.6241014.815154760.736001.848000033.06503201.076744.6544440.28534135.0905614.678613873.48775-2.681750037.39011184.012564.7104660.28415185.8146824.571590989.08200-1.253000045.07064150.558804.2921080.23286005.7267864.68215310104.62625-6.429250045.64218131.798893.7989710.20103995.4816894.765959InstituteofBotany,theChineseAcademyofSciences数据的标准化1.decostand(x,method,MARGIN,range.global,na.rm=FALSE)total:除以行和或列和(defaultMARGIN=1);max:除以行或列的最大值(defaultMARGIN=2);freq:除以行或列的最大值,并乘以非零值的个数(defaultMARGIN=2);normalize:使行或列的平方和等于1(defaultMARGIN=1);range:标准化使行或列的值在0...1(defaultMARGIN=2).standardize:标准化使行或列的和为1且方差为1(defaultMARGIN=2);pa:将数据转换为0、1数据;chi.square:除以行和及列和的平方根;hellinger:采用total标准化以后再取平方根;2.wisconsin(x):除以列最大值,再除以行和。InstituteofBotany,theChineseAcademyofSciences一、什么是排序(ordination)?排序的过程是将样方或植物种排列在一定的空间,使得排序轴能够反映一定的生态梯度,从而,能够解释植被或植物种的分布与环境因子间的关系,也就是说排序是为了揭示植被-环境间的生态关系。因此,排序也叫梯度分析(gradientanalysis)。间接梯度分析(Indirectgradientanalysis)直接梯度分析(directgradientanalysis)InstituteofBotany,theChineseAcademyofSciences一、什么是排序(ordination)?排序的过程是将样方或植物种排列在一定的空间,使得排序轴能够反映一定的生态梯度,从而,能够解释植被或植物种的分布与环境因子间的关系,也就是说排序是为了揭示植被-环境间的生态关系。因此,排序也叫梯度分析(gradientanalysis)。间接梯度分析(Indirectgradientanalysis)直接梯度分析(directgradientanalysis)InstituteofBotany,theChineseAcademyofSciences2个种的排序图3个种的排序图4个种的排序图???40个种排序图???InstituteofBotany,theChineseAcademyofSciences排序的内容:1.降低维数,减少坐标轴的数目;2.由降低维数引起的信息损失尽量少,即发生最小的畸变,也就是说它的第1-3轴排序轴包含大量的生态信息。InstituteofBotany,theChineseAcademyofSciences排序的目标:表示植被与环境之间的关系:所有排序方法都反映植物种和环境之间的关系以及在某一环境梯度上的种间关系。1.线形模型(linearmodel),短的梯度,主成分分析(Principlecomponentanalysis),需要对数据进行非线性转换,如取对数;2.非线性模型(non-linearmodel)如高斯模型,长的梯度,对应分析(Correspondenceanalysis)InstituteofBotany,theChineseAcademyofSciences排序采用的距离方法:1.欧氏距离:2.卡方距离InstituteofBotany,theChineseAcademyofSciences二、主成分分析(Principlecomponentanalysis,PCA)主成分分析的主要原理是:使坐标旋转一定的角度后,使第一轴表示数据最大的方差,使第二轴表示数据第二的方差。而且轴与轴之间是正交的(orthogonal)。InstituteofBotany,theChineseAcademyofSciencesPCA和RDA都采用函数rda实现:在vegan包中,rda(formula,data,scale=FALSE,...)rda(X,Y,Z,scale=FALSE,...)scores(x,display=c(sites,species),choices,...)在stat包中:princomp(x,...)princomp(formula,data=NULL,subset,na.action,...)InstituteofBotany,theChineseAcademyofSciences主成分分析表示信息的方法:1.特征值(eigenvalue)和Inertia每一个轴都有一个特征值表示其信息量也就是方差的大小。InstituteofBotany,theChineseAcademyofSciencesgts.rda=rda(gtsdata)gts.rdaCall:rda(X=gtsdata)InertiaRankTotal352.1Unconstrained352.122InertiaisvarianceEigenvaluesforunconstrainedaxes:PC1PC2PC3PC4PC5PC6PC7PC8111.77973.58054.60732.95926.48118.06312.7637.637sum(apply(gtsdata,2,var))summary(gts.rda)!!所以如果不对数据做标准化的话,丰富种的值就非常大,排序时就只能看清丰富种的位置,其它种就拥挤在一起。InstituteofBotany,theChineseAcademyofSciencesplot(rda(gtsdata,scale=T))plot(rda(gtsdata))InstituteofBotany,theChineseAcademyofSciences2.特征值向量(eigenvector)和负荷(loading)虽然所有的属性在排序中共同起作用,但各个属性的贡献是不等的,这可以用负荷量(Loading)表示。为特征向量,为特征根,为负荷;jijijULjiUjijLInstituteofBotany,theChineseAcademyofSciencesgts.pca=princomp(gtsdata);summary(gts.pca)Importanceofcomponents:Comp.1Comp.2Comp.3Comp.4Comp.5Comp.6Comp.7Comp.8Comp.9Standarddeviation10.43955718.46998177.29667505.66876885.08121974.196604293.527610812.728742481.97771180ProportionofVariance0.31747080.20897990.15509210.09360890.07521000.051302160.036249410.021690260.01139372CumulativeProportion0.31747080.52645070.68154280.77515170.85036170.901663880.937913290.959603550.97099728Comp.10Comp.11Comp.12Comp.13Comp.14Comp.15Comp.16Comp.17Standarddeviation1.73232991.357293351.2006073700.9812191070.8860183240.7329182870.6155476930.603479672ProportionofVariance0.00874180.005366450.0041989590.0028046050.0022867830.0015647710.0011037310.001060877CumulativeProportion0.97973910.985105530.9893044850.9921090900.9943958730.9959606440.9970643740.998125251Comp.18Comp.19Comp.20Comp.21Comp.22St