1 Theoretical Background Morans autocorrelation coe64259cient often denoted as is an extension of Pear son productmoment correlation coe64259cient to a univariate series 2 5 Recall that Pearsons correlation denoted as between two variables and bot ID: 22325
Download Pdf The PPT/PDF document "Morans Autocorrelation Coecient in Compa..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Moran'sAutocorrelationCoecientinComparativeMethodsEmmanuelParadisAugust12,2020ThisdocumentclariestheuseofMoran'sautocorrelationcoecienttoquantifywhetherthedistributionofatraitamongasetofspeciesisaectedornotbytheirphylogeneticrelationships.1TheoreticalBackgroundMoran'sautocorrelationcoecient(oftendenotedasI)isanextensionofPear-sonproduct-momentcorrelationcoecienttoaunivariateseries[2,5].RecallthatPearson'scorrelation(denotedas)betweentwovariablesxandybothoflengthnis:=nXi=1(xix)(yiy) "nXi=1(xix)2nXi=1(yiy)2#1=2;wherexandyarethesamplemeansofbothvariables.measureswhether,onaverage,xiandyiareassociated.Forasinglevariable,sayx,Iwillmeasurewhetherxiandxj,withi6=j,areassociated.Notethatwith,xiandxjarenotassociatedsincethepairs(xi;yi)areassumedtobeindependentofeachother.Inthestudyofspatialpatternsandprocesses,wemaylogicallyexpectthatcloseobservationsaremorelikelytobesimilarthanthosefarapart.Itisusualtoassociateaweighttoeachpair(xi;xj)whichquantiesthis[3].Initssimplestform,theseweightswilltakevalues1forcloseneighbours,and0otherwise.Wealsosetwii=0.Theseweightsaresometimesreferredtoasaneighbouringfunction.I'sformulais:I=n S0nXi=1nXj=1wij(xix)(xjx) nXi=1(xix)2;(1)wherewijistheweightbetweenobservationiandj,andS0isthesumofallwij's:1 S0=nXi=1nXj=1wij:Quitenotsointuitively,theexpectedvalueofIunderthenullhypothesisofnoautocorrelationisnotequaltozerobutgivenbyI0=1=(n1).TheexpectedvarianceofI0isalsoknown,andsowecanmakeatestofthenullhypothesis.IftheobservedvalueofI(denoted^I)issignicantlygreaterthanI0,thenvaluesofxarepositivelyautocorrelated,whereasif^II0,thiswillindicatenegativeautocorrelation.Thisallowsustodesignone-ortwo-tailedtestsinthestandardway.Gittleman&Kot[4]proposedtouseMoran'sItotestfor\phylogeneticeects".Theyconsideredtwowaystocalculatetheweightsw:Withphylogeneticdistancesamongspecies,e.g.,wij=1=dij,wheredijaredistancesmeasuredonatree.Withtaxonomiclevelswherewij=1ifspeciesiandjbelongtothesamegroup,0otherwise.Notethatintherstsituation,therearequitealotofpossibilitiestosettheweights.Forinstance,Gittleman&Kotalsoproposed:wij=1=dijifdijcwij=0ifdij-390;c;wherecisacut-ophylogeneticdistanceabovewhichthespeciesareconsideredtohaveevolvedcompletelyindependently,andisacoecient(see[4]fordetails).Byanalogytotheuseofaspatialcorrelogramwherecoecientsarecalculatedassumingdierentsizesofthe\neighbourhood"andthenplottedtovisualizethespatialextentofautocorrelation,theyproposedtocalculateIatdierenttaxonomiclevels.2ImplementationinapeFromversion1.2-6,apehasfunctionsMoran.Iandcorrelogram.formulaim-plementingtheapproachdevelopedbyGittleman&Kot.Therewasanerrorinthehelppagesof?Moran.I(correctedinver.2.1)wheretheweightswerereferredtoas\distanceweights".Thishasbeenwronglyinterpretedinmybook[6,pp.139{142].Theanalysesbelowaimtocorrectthis.2.1PhylogeneticDistancesThedata,takenfrom[1],arethelog-transformedbodymassandlongevityofvespeciesofprimates:-390;body-c(4.09434,3.61092,2.37024,2.02815,-1.46968)ကlongevity-c(4.74493,3.3322,3.3673,2.89037,2.30259)ကnames(body)-names(longevity)-c("Homo","Pongo","Macaca","Ateles","Galago")2 Thetreehasbranchlengthsscaledsothattherootageisone.Wereadthetreewithape,andplotit:library(ape)trnwk-"((((Homo:0.21,Pongo:0.21):0.28,Macaca:0.49):0.13,Ateles:0.62)"ကtrnwk[2]-":0.38,Galago:1.00);"ကtr-read.tree(text=trnwk)ကplot(tr)ကaxisPhylo() Wechoosetheweightsaswij=1=dij,wherethed'sisthedistancesmeasuredonthetree:w-1/cophenetic(tr)ကwHomoPongoMacacaAtelesGalagoHomoInf2.38095241.02040820.80645160.5Pongo2.3809524Inf1.02040820.80645160.5Macaca1.02040821.0204082Inf0.80645160.5Ateles0.80645160.80645160.8064516Inf0.5Galago0.50000000.50000000.50000000.5000000InfOfcourse,wemustsetthediagonaltozero:ကdiag(w)-0WecannowperformtheanalysiswithMoran'sI:3 Moran.I(body,w)$observed[1]-0.07312179$expected[1]-0.25$sd[1]0.08910814$p.value[1]0.04714628Notsurprisingly,theresultsareoppositetothosein[6]since,there,thedistances(givenbycophenetic(tr))wereusedasweights.(Notethattheargumentdisthasbeensincerenamedweight.1)Wecannowconcludeforaslighlysignicantpositivephylogeneticcorrelationamongbodymassvaluesforthesevespecies.ThenewversionofMoran.Igainstheoptionalternativewhichspeciesthealternativehypothesis("two-sided"bydefault,i.e.,H1:I6=I0).Asexpectedfromtheaboveresult,wedividetheP-valuebetwoifwedeneH1asII0:Moran.I(body,w,alt="greater")$observed[1]-0.07312179$expected[1]-0.25$sd[1]0.08910814$p.value[1]0.02357314Thesameanalysiswithlongevitygives:Moran.I(longevity,w)$observed[1]-0.1837739$expected[1]-0.25 1Theoldercodewasactuallycorrect;nevertheless,ithasbeenrewritten,andisnowmuchfaster.Thedocumentationhasbeenclaried.Thefunctioncorrelogram.phylo,whichcomputedMoran'sIforatreegivenasargumentusingthedistancesamongtaxa,hasbeenremoved.4 $sd[1]0.09114549$p.value[1]0.4674727Asforbody,theresultsarenearlymirroredcomparedto[6]whereanon-signicantnegativephylogeneticcorrelationwasfound:itisnowpositivebutstilllargelynotsignicant.2.2TaxonomicLevelsThefunctioncorrelogram.formulaprovidesaninterfacetocalculateMoran'sIforoneorseveralvariablesgivingaseriesoftaxonomiclevels.Anexampleofitsusewasprovidedin[6,pp.141{142].Thecodeofthisfunctionhasbeensimplied,andthegraphicalpresentationoftheresultshavebeenimproved.correlogram.formula'smainargumentisaformulawhichis\sliced",andMoran.Iiscalledforeachoftheseelements.Twothingshavebeenchangedfortheend-useratthislevel:1.Intheoldversion,therhsoftheformulawasgivenintheorderofthetaxonomichierarchy:e.g.,Order/SuperFamily/Family/Genus.Notre-spectingthisorderresultedinanerror.Inthenewversion,anyorderisaccepted,buttheordergivenisthenrespectedwhenplottedthecorrelo-gram.2.Variabletransformations(e.g.,log)wereallowedonthelhsoftheformula.Becauseofthesimplicationofthecode,thisisnomorepossible.Soitistheresponsibilityoftheusertoapplyanytranformationbeforetheanalysis.FollowingGittleman&Kot[4],theautocorrelationatahigherlevel(e.g.,family)iscalculatedamongspeciesbelongingtothesamecategoryandtodif-ferentcategoriesatthelevelbelow(genus).Toformalizethis,letuswritethedierentlevelsasX1=X2=X3=:::=XnwithXnbeingthelowestone(Genusintheaboveformula):wij=1ifXki=XkjandXk+1i6=Xk+1jwij=0otherwiseknwij=1ifXki=Xkjwij=0otherwisek=nThisisthusdierentfromtheideaofa\neighbourhood"ofdierentsizes,butrathersimilartotheideaofpartialcorrelationwherethein uenceofthelowestlevelisremovedwhenconsideringthehighestones[4].Torepeattheanalysesonthecarnivoradataset,werstlog10-transformthevariablesmeanbodymass(SW)andthemeanfemalebodymass(FW):-278;data(carnivora)-278;carnivora$log10SW-log10(carnivora$SW)ကcarnivora$log10FW-log10(carnivora$FW)5 Werstconsiderasinglevariableanalysis(asin[6]):fm1.carn-log10SW~Order/SuperFamily/Family/Genusကco1-correlogram.formula(fm1.carn,data=carnivora)ကplot(co1) Alegendnowappearsbydefault,butcanberemovedwithlegend=FALSE.Mostoftheappearanceofthegraphcanbecustomizedviatheoptionoftheplotmethod(see?plot.correlogramfordetails).ThisisthesameanalysisthantheonedisplayedonFig.6.3of[6].Whenasinglevariableisgiveninthelhsincorrelogram.formula,anobjectofclass"correlogram"isreturnedasabove.Ifseveralvariablesareanalysedsimultaneously,theobjectreturnedisofclass"correlogramList",andthecorrelogramscanbeplottedtogetherwiththeappropriateplotmethod:fm2.carn-log10SW+log10FW~Order/SuperFamily/Family/Genusကco2-correlogram.formula(fm2.carn,data=carnivora)ကprint(plot(co2))6 Bydefault,latticeisusedtoplotthecorrelogramsonseparatepanels;usinglattice=FALSE(actuallythesecondargument,see?plot.correlogramList)makesastandardgraphsuperimposingthedierentcorrelograms:plot(co2,FALSE)7 Theoptionsareroughlythesamethanabove,butdonothavealwaysthesameeectsincelatticeandbasegraphicsdonothavethesamegraphicalpa-rameters.Forinstance,legend=FALSEhasnoeectiflattice=TRUE.3Implementationinade4Theanalysisdonewithade4in[6]suersfromthesameerrorthantheonedonewithMoran.Isinceitwasalsodonewithadistancematrix.SoIcorrectthisbelow:library(ade4)gearymoran(w,data.frame(body,longevity))class:krandtestMonte-CarlotestsCall:as.krandtest(sim=matrix(res$result,ncol=nvar,byr=TRUE),obs=res$obs,alter=alter,names=test.names)Testnumber:2Permutationnumber:999Alternativehypothesis:greaterTestObsStd.ObsPvalue1body-0.062567892.15233420.0012longevity-0.229904370.34614140.414otherelements:NULL8 Theresultsarewhollyconsistentwiththosefromape,buttheestimatedcoecientsaresubstantiallydierent.Thisisbecausethecomputationalmeth-odsarenotthesameinbothpackages.Inade4,theweightmatrixisrsttransformedasarelativefrequencymatrixwith~wij=wij=S0.Theweightsarefurthertransformedwith:pij=~wijnXi=1~wijnXj=1~wij;withpijbeingtheelementsofthematrixdenotedasP.Moran'sIisnallycomputedwithxTPx.Inape,theweightsarerstrow-normalized:wij.nXi=1wij;theneq.1isapplied.Anotherdierencebetweenbothpackages,thoughlessimportant,isthatinade4theweightmatrixisforcedtobesymmetricwith(W+WT)=2.Inape,thismatrixisassumedtobesymmetric,whichislikelytobethecaselikeintheexamplesabove.4OtherImplementationsPackagesphasseveralfunctions,includingmoran.test,thataremorespeci-callytargetedtotheanalysisofspatialdata.Packagespatialhasthefunctioncorrelogramthatcomputesandplotsspatialcorrelograms.AcknowledgementsIamthankfultoThibautJombartforclaricationsonMoran'sI.References[1]J.M.Cheverud,M.M.Dow,andW.Leutenegger.Thequantitativeas-sessmentofphylogeneticconstraintsincomparativeanalyses:sexualdimor-phisminbodyweightamongprimates.Evolution,39:1335{1351,1985.[2]A.D.CliandJ.K.Ord.SpatialAutocorrelation.Pion,London,1973.[3]A.D.CliandJ.K.Ord.Spatialandtemporalanalysis:autocorrelationinspaceandtime.InE.N.WrigleyandR.J.Bennett,editors,Quantita-tiveGeography:ABritishView,pages104{110.Routledge&KeganPaul,London,1981.[4]J.L.GittlemanandM.Kot.Adaptation:statisticsandanullmodelforestimatingphylogeneticeects.SystematicZoology,39:227{241,1990.[5]P.A.P.Moran.Notesoncontinuousstochasticphenomena.Biometrika,37:17{23,1950.[6]E.Paradis.AnalysisofPhylogeneticsandEvolutionwithR.Springer,NewYork,2006.9