MultivariateAnalysisofEcologicalCommunitiesinR:vegantutorialJariOksanenFebruary8,2013AbstractThistutorialdemostratestheuseofordinationmethodsinRpack-agevegan.ThetutorialassumesfamiliaritybothwithRandwithcommunityordination.Packagevegansupportsallbasicor-dinationmethods,includingnon-metricmultidimensionalscaling.Theconstrainedordinationmethodsincludeconstrainedanalysisofproximities,redundancyanalysisandconstrainedcorrespondenceanalysis.Packageveganalsohassupportfunctionsforttingen-vironmentalvariablesandforordinationgraphics.Contents1Introduction22Ordination:basicmethod32.1Non-metricMultidimensionalscaling............32.2Communitydissimilarities..................52.3Comparingordinations:Procrustesrotation........82.4Eigenvectormethods.....................82.5Detrendedcorrespondenceanalysis.............112.6Ordinationgraphics.....................123Environmentalinterpretation143.1Vectortting.........................143.2Surfacetting.........................153.3Factors.............................164Constrainedordination184.1Modelspecication......................194.2Permutationtests.......................214.3Modelbuilding........................234.4Linearcombinationsandweightedaverages........284.5Biplotarrowsandenvironmentalcalibration........294.6Conditionedorpartialmodels................3011INTRODUCTION5Dissimilaritiesandenvironment325.1adonis:MultivariateANOVAbasedondissimilarities...325.2Homogeneityofgroupsandbetadiversity.........335.3Manteltest..........................355.4Protest:Procrustestest...................366Classication366.1Clusteranalysis........................366.2Displayandinterpretationofclasses............386.3Classiedcommunitytables.................391IntroductionThistutorialdemonstratestypicalworkowsinmultivariateordinationanalysisofbiologicalcommunities.Thetutorialrstdiscussesbasicun-constrainedanalysisandenvironmentalinterpretationoftheirresults.Thenitintroducesconstrainedordinationusingconstrainedcorrespon-denceanalysisasanexample:alternativemethodssuchasconstrainedanalysisofproximitiesandredundancyanalysiscanbeused(almost)similarly.Finallythetutorialdescribesanalysisofspecies{environmentrelationswithoutordination,andbrieytouchesclassicationofcommu-nities.Theexamplesinthistutorialaretested:ThisisaSweavedocument.TheoriginalsourcelecontainsonlytextandRcommands:theiroutputandgraphicsaregeneratedwhilerunningthesourcethroughSweave.However,youmayneedarecentversionofvegan.Thisdocumentwasgeneretatedusingveganversion2.0-6andRversion2.15.1(2012-06-22).Themanualcoversordinationmethodsinvegan.Itdoesnotdis-cussmanyothermethodsinvegan.Forinstance,thereareseveralfunc-tionsforanalysisofbiodiversity:diversityindices(diversity,renyi,fisher.alpha),extrapolatedspeciesrichness(specpool,estimateR),speciesaccumulationcurves(specaccum),speciesabundancemodels(rad-fit,fisherfit,prestonfit)etc.NeitherisvegantheonlyRpack-ageforecologicalcommunityordination.BaseRhasstandardstatisticaltools,labdsvcomplementsveganwithsomeadvancedmethodsandpro-videsalternativeversionsofsomemethods,andade4providesanalter-nativeimplementationforthewholegammeofordinationmethods.Thetutorialexplainsonlythemostimportantmethodsandshowstypicalworkows.Iseeordinationprimarilyasagraphicaltool,andIdonotshowtoomuchexactnumericalresults.Instead,therearesmallvignettesofplottingresultsinthemarginsclosetotheplacewhereyouseeaplotcommand.Isuggestthatyourepeattheanalysis,trydierentalternativesandinspecttheresultsmorethoroughlyatyourleisure.Thefunctionsareexplainedonlybriey,anditisveryusefultocheckthecor-respondinghelppagesforamorethoroughexplanationofmethods.Themethodsalsoareonlybrieyexplained.Itisbesttoconsultatextbookonordinationmethods,ormylectures,forrmertheoreticalbackground.22ORDINATION:BASICMETHOD2Ordination:basicmethod2.1Non-metricMultidimensionalscalingNon-metricmultidimensionalscalingcanbeperformedusingisoMDSfunc-tionintheMASSpackage.Thisfunctionneedsdissimilaritiesasinput.Functionvegdistinvegancontainsdissimilaritieswhicharefoundgoodincommunityecology.ThedefaultisBray-Curtisdissimilarity,nowadaysoftenknownasSteinhausdissimilarity,orinFinlandasSrensenindex.Thebasicstepsare:library(vegan)library(MASS)data(varespec)vare.dis-vegdist(varespec)vare.mds0-isoMDS(vare.dis)initialvalue18.026495iter5value10.095483finalvalue10.020469convergedThedefaultistondtwodimensionsandusemetricscaling(cmdscale)asthestartingsolution.Thesolutionisiterative,ascanbeseenfromthetracinginformation(thiscanbesuppressedsettingtrace=F).TheresultsofisoMDSisalist(itemspoints,stress)forthecon-gurationandthestress.StressSisastatisticofgoodnessoft,anditisafunctionofandnon-linearmonotonetransformationofobserveddissimilarities(d)andordinationdistances~d.S=vuutPi6=j[(dij) ~dij]2Pi6=j~d2ijNmdsmapsobservedcommunitydissimilaritiesnonlinearlyontoordi-nationspaceanditcanhandlenonlinearspeciesresponsesofanyshape.WecaninspectthemappingusingfunctionShepardinMASSpackage,orasimplewrapperstressplotinvegan:stressplot(vare.mds0,vare.dis)●●●●●●●●●●●●●●●●●●●●●●●●●●●●●