/
Package calibrate February   Version Package calibrate February   Version

Package calibrate February Version - PDF document

test
test . @test
Follow
491 views
Uploaded On 2015-03-02

Package calibrate February Version - PPT Presentation

72 Date 20130909 Title Calibration of Scatterplot and Biplot Axes Author Jan Graffelman Maintainer Jan Graffelman Depends R 180 MASS Description Package for drawing calibrated scales with tick marks on nonorthogonal variable vectors in scatterplot ID: 40466

Date 20130909 Title Calibration

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Package calibrate February Version" 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.


Presentation Transcript

Package`calibrate'June19,2020Version1.7.7Date2020-06-18TitleCalibrationofScatterplotandBiplotAxesAuthorJanGraffelman&#xjan.;&#xgraf;þlm; n@u;&#xpc.e; u00;MaintainerJanGraffelman&#xjan.;&#xgraf;þlm; n@u;&#xpc.e; u00;DependsR&#xjan.;&#xgraf;þlm; n@u;&#xpc.e; u00;(=3.5.0),MASSDescriptionPackagefordrawingcalibratedscaleswithtickmarkson(non-orthogonal)variablevectorsinscatterplotsandbiplots.Alsoprovidessomefunctionsforbiplotcreationandformultivariateanalysissuchasprincipalcoordinateanalysis.LicenseGPL-2NeedsCompilationnoRepositoryCRANDate/Publication2020-06-1905:40:14UTCRtopicsdocumented:bplot.............................................2calibrate...........................................3calves............................................6canocor...........................................6circle............................................8dlines............................................9goblets............................................10heads............................................10linnerud...........................................11ones.............................................11origin............................................12PrinCoor...........................................13rad2degree..........................................14rda..............................................15shiftvector..........................................16spaindist...........................................17storks............................................18textxy............................................181 2bplotIndex20 bplotGeneralfunctionformakingbiplots DescriptionFunctionbplotcreatesbiplotsonthebasismatricesofrowandcolumnmarkers.Usagebplot(Fr,G,rowlab=rownames(Fr),collab=rownames(G),qlt=rep(1,nrow(Fr)),refaxis=TRUE,ahead=T,xl=NULL,yl=NULL,frame=F,qltlim=0,rowch=19,colch=19,qltvar=NULL,rowcolor="red",colcolor="blue",rowmark=TRUE,colmark=TRUE,rowarrow=FALSE,colarrow=TRUE,markrowlab=TRUE,markcollab=TRUE,xlab="",ylab="",cex.rowlab=1,cex.rowdot=0.75,cex.collab=1,cex.coldot=0.75,cex.axis=0.75,lwd=1,arrowangle=10,...)ArgumentsFrmatrixwithcoordinatesoftherowmarkers.Gmatrixwithcoordinatesofthecolumnmarkers.rowlabvectorwithlabelsfortherows.collabvectorwithlabelsforthecolumns.qltgoodnessoftoftherows.refaxisdrawcoordinatesystemrefaxis=TRUEornot.aheadputaheadonthevectorsahead=TRUEornot.xllimitsforthex-axis.yllimitsforthey-axis.framedrawaboxaroundtheplotframe=TRUEornot.qltlimdrawonlythevectorswithagoodnessoftlargerthanqltlim.rowchcharacterusedfortherowmarkers.colchcharacterusedforthecolumnmarkers.qltvarvectorwiththegoodnessoftofeachvariable.rowcolorcolourusedfortherowmarkers.colcolorcolourusedforthecolumnmarkers.rowmarkshowrowmarkers(rowmark=TRUE)ornot.colmarkshowcolumnmarkers(colmark=TRUE)ornot.rowarrowdrawvectorsfromtheorigintotherowmarkers(rowarrow=TRUE)ornot.colarrowdrawvectorsfromtheorigintothecolumnmarkers(colarrow=TRUE)ornot.markrowlabdepictrowmarkerlabels(rowlab=TRUE)ornot. calibrate3markcollabdepictcolumnmarkerlabels(collab=TRUE)ornot.xlabalabelforthex-axis.ylabalabelforthey-axis.cex.rowlabexpansionfactorfortherowlabels.cex.rowdotexpansionfactorfortherowmarkers.cex.collabexpansionfactorforthecolumnlabels.cex.coldotexpansionfactorforthecolumnmarkers.cex.axisexpansionfactorfortheaxis.lwdlinewidthforbiplotvectors.arrowangleanglefortheedgesofthearrowhead....extraargumentsforplot.ValueNone.Thefunctionproducesagraphic.Author(s)JanGraffelman(jan.graffelman@upc.edu)Examplesset.seed(123)Xmatrix(runif(40),byrow=TRUE,ncol=4)colnames(X)paste("X",1:ncol(X),sep="")out.pcaprincomp(X,cor=TRUE)Fpout.pca$scoresGsas.matrix(unclass(out.pca$loadings))bplot(Fp,Gs,colch=NA) calibrateCalibrationofBiplotandScatterplotAxis DescriptionRoutineforthecalibrationofanyaxis(variablevector)inabiplotorascatterplotUsagecalibrate(g,y,tm,Fr,tmlab=tm,tl=0.05,dt=TRUE,dp=FALSE,lm=TRUE,verb=TRUE,axislab="",reverse=FALSE,alpha=NULL,labpos=1,weights=diag(rep(1,length(y))),axiscol="blue",cex.axislab=0.75,graphics=TRUE,where=3,laboffset=c(0,0),m=matrix(c(0,0),nrow=1),markerpos=3,showlabel=TRUE,lwd=1,shiftvec=c(0,0),shiftdir="none",shiftfactor=1.05) 4calibrateArgumentsgthevectortobecalibrated(2x1).ythedatavectorcorrespondingtog,appropriatelycentredand/orstandardized.tmthevectoroftickmarks,appropiatelycentredand/orscaled.Frthecoordinatesoftherowsmarkersinthebiplot.tmlabalistorvectoroftickmarklabels.tltheticklength.Bydefault,thetickmarkershavelength0.05.dtdrawticks.Bydefault,ticksmarkersaredrawn.Setdt=Finordertocomputecalibrationresultswithoutactuallydrawingthecalibratedscale.dpdropperpendiculars.Withdp=TperpendicularlineswillbedrawnfromtherowmarkersspeciedbyFrontothecalibratedaxis.Thisisagraphicalaidtoreadoffthevaluesinthecorrespondingscale.lmlabelmarkers.Bydefault,alltickmarksarelabelled.Settinglm=Fturnsoffthelabellingofthetickmarks.Thisallowsforcreatingtickmarkswithoutlabels.Itisparticularlyusefulforcreatingnerscalesoftickmarkswithoutlabels.verbverboseparameter(F=bequiet,T=showresults).axislabalabelforthecalibratedaxis.reverseputsthetickmarksandtickmarklabelsontheothersideoftheaxis.alphaavalueforthecalibrationfactor.Thisparametershouldonlybespeciedifacalibrationisrequiredthatisdifferentfromtheonethatisoptimalfordatarecovery.labpospositionofthelabelforthecalibratedaxis(1,2,3or4).laboffsetoffsetvectorfortheaxislabel.Ifspecied,shiftsthelabelbythespeciedamountswithrespecttothecurrentposition.weightsamatrixofweights(optional).axiscolcolorofthecalibratedaxis.cex.axislabcharacterexpansionfactorforaxislabelandtickmarklabels.graphicsdographicsornot(F=nographicaloutput,T=drawscalibratedscale).wherelabelplacement(1=beginning,2=middle,3=end).mvectorofmeans.markerpospositionspecierforthetickmarklabels(1,2,3or4).showlabelshowaxislabelingraph(T)ornot(F).lwdlinewithforthecalibratedaxisshiftvecashiftvectorforthecalibratedaxis((0,0)bydefault)shiftdirindicatesinwhichdirectiontheaxisshouldbeshifted("left","right"or"none").Thisdirectionisw.r.t.vectorgshiftfactorscalarbywhichtheshiftvectorisstretched(orshrunken).Bydefault,thelengthoftheshiftvectorisstretchedby5percent(shiftfactor=1.05) calibrate5DetailsThisprogramcalibratesvariablevectorsinbiplotsandscatterplots,bydrawingtickmarksalongagiventhevectorandlabellingthetickmarkswithspeciedvalues.Theoptimalcalibrationisfoundby(generalized)leastsquares.Non-optimalcalibrationsarepossiblebyspecifyingacalibrationfactor(alpha).ValueReturnsalistwithcalibrationresultsuseralphacalibrationfactorspeciedbytheuseroptalphaoptimalcalibrationfactorlengthoneunitlengthintheplotofoneunitinthescaleofthecalibratedvariablegofgoodnessoft(asinregression)gosgoodnessofscaleMcoordinatesofthetickmarkersangangleindegreesofthebiplotaxiswiththepositivex-axisshiftvecthesuppliedorcomputedshiftvectorytttedvaluesforthevariableaccordingtothecalibrationeerrorsaccordingtothecalibrationFprcoordinatesoftheprojectionsoftherowmarkersontothecalibratedaxisMncoordinatesofthetickmarkerendpointsAuthor(s)JanGraffelman&#xjan.;&#xgraf;þlm; n@u;&#xpc.e; u00;ReferencesGower,J.C.andHand,D.J.,(1996)Biplots.Chapman&Hall,LondonGraffelman,J.andvanEeuwijk,F.A.(2005)CalibrationofmultivariatescatterplotsforexploratoryanalysisofrelationswithinandbetweensetsofvariablesingenomicresearchBiometricalJournal,47(6)pp.863-879.Graffelman,J.(2006)Aguidetobiplotcalibration.SeeAlsobiplot 6canocorExamplesxrnorm(20,1)yrnorm(20,1)xx-mean(x)yy-mean(y)zx+ybc(1,1)plot(x,y,asp=1,pch=19)tm()Calibrate.zcalibrate(b,z,tm,cbind(x,y),axislab="Z",graphics=TRUE) calvesDeliveryofDutchCalves DescriptionThisdatasetgivesacrossclassicationof7275calvesborninthelateninetiesaccordingtotypeofproductionandtypeofdelivery.Usagedata(calves)FormatAdataframecontainingacontingencytableof7275observations.SourceHollandGenetics.http://www.hg.nlReferencesGraffelman,J.(2005)Aguidetoscatterplotandbiplotcalibration. canocorCanonicalcorrelationanalysis Descriptioncanocorperformscanonicalcorrelationanalysisonthebasisofthestandardizedvariablesandstoresextensiveoutputinalistobject.Usagecanocor(X,Y) canocor7ArgumentsXamatrixcontainingtheXvariablesYamatrixcontainingtheYvariablesDetailscanocorcomputesthesolutionbyasingularvaluedecompositionofthetransformedbetweensetcorrelationmatrix.ValueReturnsalistwiththefollowingresultsccorthecanonicalcorrelationsAcanonicalweightsofthexvariablesBcanonicalweightsoftheyvariablesUcanonicalxvariatesVcanonicalyvariatesFsbiplotmarkersforxvariables(standardcoordinates)Gsbiplotmarkersforyvariables(standardcoordinates)Fpbiplotmarkersforxvariables(principalcoordinates)Gpbiplotmarkersforyvariables(principalcoordinates)fitRxygoodnessoftofthebetween-setcorrelationmatrixfitXsadequacycoefcientsofxvariablesfitXpredundancycoefcientsofxvariablesfitYsadequacycoefcientsofyvariablesfitYpredundancycoefcientsofyvariablesAuthor(s)JanGraffelman&#xjan.;&#xgraf;þlm; n@u;&#xpc.e; u00;ReferencesHotelling,H.(1935)Themostpredictablecriterion.JournalofEducationalPsychology(26)pp.139-142.Hotelling,H.(1936)Relationsbetweentwosetsofvariates.Biometrika(28)pp.321-377.Johnson,R.A.andWichern,D.W.(2002)AppliedMultivariateStatisticalAnalysis.NewJersey:PrenticeHall.SeeAlsocancor 8circleExamplesset.seed(123)Xmatrix(runif(75),ncol=3)Ymatrix(runif(75),ncol=3)cca.resultscanocor(X,Y) circleDrawacircle Descriptioncircledrawsacircleinanexistingplot.Usagecircle(radius,origin)ArgumentsradiustheradiusofthecircleorigintheoriginofthecircleValueNULLAuthor(s)JanGraffelman&#xjan.;&#xgraf;þlm; n@u;&#xpc.e; u00;Examplesset.seed(123)Xmatrix(rnorm(20),ncol=2)plot(X[,1],X[,2])circle(1,c(0,0)) dlines9 dlinesConnecttwosetsofpointsbylines Descriptiondlinesconnectstwosetsofpointsbylinesinarowwisemanner.Usagedlines(SetA,SetB,lin="dotted")ArgumentsSetAmatrixwiththerstsetofpointsSetBmatrixwithtehsecondsetofpointslinlinestylefortheconnectinglinesValueNULLAuthor(s)JanGraffelman(jan.graffelman@upc.edu)SeeAlsolinesExamplesXmatrix(runif(20),ncol=2)Ymatrix(runif(20),ncol=2)plot(rbind(X,Y))text(X[,1],X[,2],paste("X",1:10,sep=""))text(Y[,1],Y[,2],paste("Y",1:10,sep=""))dlines(X,Y) 10heads gobletsSizemeasurementsofarcheologicalgoblets DescriptionThisdatasetgives6differentsizemeasurementsof25gobletsUsagedata(goblets)FormatAdataframecontaining25observations.SourceManly,1989ReferencesManly,B.F.J.(1989)Multivariatestatisticalmethods:aprimer.London:ChapmanandHall,London headsDimensionsofheadsofrstandsecondsonsfor25families DescriptionVariablesX1andX2aretheheadlengthandheadbreadthoftherstsonandY1andY2arethesamevariablesforthesecondson.Usagedata(heads)FormatAdataframecontaining25observations.SourceMardia,1979,p.121 linnerud11ReferencesFrets,G.P.(1921)Heredityofheadforminman,Genetica3,pp.193-384.Mardia,K.V.andKent,J.T.andBibby,J.M.(1979)MultivariateAnalysis.AcademicPressLondon.Anderson,T.W.(1984)AnIntroductiontoMultivariateStatisticalAnalysis.NewYork:JohnWiley,Secondedition. linnerudLinnerud'sexerciseandbodymeasurements DescriptionThedatasetconsistof3exercisevariables(Tractionsalabarrexe,Flexions,Sauts)and3bodymeasurements(Poids,Tourdetalle,Pouls)of20individuals.Usagedata(linnerud)FormatAdataframecontaining20observations.SourceTenenhaus,1998,table1,page15ReferencesTenenhaus,M.(1998)LaRegressionPLS.Paris:EditionsTechnip. onesGeneratesamatrixofones Descriptiononesgeneratesamatrixofones.Usageones(n,p=n)Argumentsnnumberofrowspnumberofcolumns 12originDetailsifonlynisspecied,theresultingmatrixwillbesquare.Valueamatrixlledwithones.Author(s)JanGraffelman(jan.graffelman@upc.edu)SeeAlsomatrixExamplesIdones(3)print(Id) originOrigin DescriptionDrawscoordinateaxesinaplot.Usageorigin(m=c(0,0),...)Argumentsmthecoordinatesofthemeans(2x1)....otherargumentspassedontothelinesfunctionAuthor(s)JanGraffelman(jan.graffelman@upc.edu)SeeAlsolinesExamplesXmatrix(runif(40),ncol=2)plot(X[,1],X[,2])origin(m=c(mean(X[,1]),mean(X[,2]))) PrinCoor13 PrinCoorFunctionforPrincipalCoordinateAnalysis DescriptionFunctionPrinCoorimplementsPrincipalCoordinateAnalysis,alsoknownasclassicalmetricmul-tidimensionalscalingorclassicalscaling.Incomparisonwithothersoftware,itoffersrenedstatis-ticsforgoodness-of-tatthelevelofindividualobservationsandpairsofobservartions.UsagePrinCoor(Dis,eps=1e-10)ArgumentsDisAdistancematrixordissimilaritymatrixepsAtolerancecriterionfordecidingifeigenvaluesarezeroornotDetailsCalculationsarebasedonthespectraldecompositionofthescalarproductmatrixB,derivedfromthedistancematrix.ValueXThecoordinatesofthethesolutionlaTheeigenvaluesofthesolutionBThescalarproductmatrixstandard.decomStandardoverallgoodness-of-ttableusingalleigenvaluespositive.decomOverallgoodness-of-ttableusingonlypositiveeigenvaluesabsolute.decomOverallgoodness-of-ttableusingabsolutevaluesofeigenvaluessquared.decomOverallgoodness-of-ttableusingsquaredeigenvaluesRowStatsDetailedgoodness-of-tstatisticsforeachrowPairStatsDetailedgoodness-of-tstatisticsforeachpairAuthor(s)JanGraffelman&#xjan.;&#xgraf;þlm; n@u;&#xpc.e; u00;ReferencesGraffelman,J.(2019)Goodness-of-tlteringinclassicalmetricmultidimensionalscalingwithlargedatasets. oi:;&#x-310;10.1101/708339Graffelman,J.andvanEeuwijk,F.A.(2005)CalibrationofmultivariatescatterplotsforexploratoryanalysisofrelationswithinandbetweensetsofvariablesingenomicresearchBiometricalJournal,47(6)pp.863-879. 14rad2degreeSeeAlsoprincompExamplesdata(spaindist)resultsPrinCoor(as.matrix(spaindist)) rad2degreeConvertradianstodegrees. Descriptionrad2degreeconvertsradianstodegrees.Usagerad2degree(x)ArgumentsxanangleinradiansValuetheanglewiththepositivex-axisindegrees.Author(s)JanGraffelman(jan.graffelman@upc.edu)Examplesxpi/2arad2degree(x)cat("angleis",a,"degrees\n") rda15 rdaRedundancyanalysis Descriptionrdaperformsredundancyanalysisandstoresextensiveoutputinalistobject.Usagerda(X,Y,scaling=1)ArgumentsXamatrixofxvariablesYamatrixofyvariablesscalingscalingusedforxandyvariables.0:xandyonlycentered.1:xandystan-dardizedDetailsResultsarecomputedbydoingaprincipalcomponentanalyisofthettedvaluesoftheregressionofyonx.PlottingthersttwocolumnsofGxsandGyp,orofGxpandGysprovidesabiplotsofthematrixofregressioncoefcients.PlottingthersttwocolumnsofFsandGporofFpandGsprovidesabiplotofthematrixofttedvalues.ValueReturnsalistwiththefollowingresultsYhttedvaluesoftheregressionofyonxBregressioncoefcientsoftheregressonofyonxdecomvariancedecomposition/goodnessoftofthettedvaluesANDoftheregres-sioncoefcientsFsbiplotmarkersoftherowsofYh(standardcoordinates)FpbiplotmarkersoftherowsofYh(principalcoordinates)Gysbiplotmarkersfortheyvariables(standardcoordinates)Gypbiplotmarkersfortheyvariables(principalcoordinates)Gxsbiplotmarkersforthexvariables(standardcoordinates)Gxpbiplotmarkersforthexvariables(principalcoordinates)Author(s)JanGraffelman(jan.graffelman@upc.edu) 16shiftvectorReferencesVandenWollenberg,A.L.(1977)RedundancyAnalysis,analternativeforcanonicalcorrelationanalysis.Psychometrika42(2):pp.207-219.TerBraak,C.J.F.andLooman,C.W.N.(1994)BiplotsinReduced-RankRegression.BiometricalJournal36(8):pp.983-1003.SeeAlsoprincomp,canocor,biplotExamplesXmatrix(rnorm(75),ncol=3)Ymatrix(rnorm(75),ncol=3)rda.resultsrda(X,Y) shiftvectorComputeashiftvectorforacalibratedaxis. Descriptionshiftvectorcomputestwoshiftvectorsperpendiculartothesuppliedbiplotorscatterplotaxisg.Thevectornormiscomputedfromthetwomostextremedatapoints.Usageshiftvector(g,X,x=c(1,0),verbose=FALSE)ArgumentsgabiplotorscatterplotaxisXanby2matrixofscatterplotorbiplotcoordinatesxreferenceaxis,(1,0)bydefaultverboseprintinformationornotDetailsshiftvectorlocatesthetowmostextremedatapointsinthedirectionperpendiculartoaxisg.Valuedrtheright(w.r.t.thedirectionofg)shiftvectordltheleft(w.r.t.thedirectionofg)shiftvectorAuthor(s)JanGraffelman(jan.graffelman@upc.edu) spaindist17ReferencesGraffelman,J.andvanEeuwijk,F.A.(2005)CalibrationofmultivariatescatterplotsforexploratoryanalysisofrelationswithinandbetweensetsofvariablesingenomicresearchBiometricalJournal,47(6)pp.863-879.Graffelman,J.(2006)Aguidetobiplotcalibration.SeeAlsocalibrateExamplesXmatrix(rnorm(100),ncol=2)Xsscale(X)gc(1,1)plot(Xs[,1],Xs[,2],asp=1,pch=19)textxy(Xs[,1],Xs[,2],1:nrow(X))arrows(0,0,g[1],g[2])text(g[1],g[2],"g",pos=1)outshiftvector(g,X,verbose=TRUE)drout$drdlout$dlarrows(0,0,dl[1],dl[2])text(dl[1],dl[2],"dl",pos=1)arrows(0,0,dr[1],dr[2])text(dr[1],dr[2],"dr",pos=1) spaindistRoaddistancesbetweenSpanishcities DescriptionRoaddistancesinkilometersbetween47SpanishcitiesUsagedata(spaindist)FormatAdataframecontaining47observations. 18textxyReferencesGraffelman,J.(2019)Goodness-of-tlteringinclassicalmetricmultidimensionalscalingwithlargedatasets. oi:;&#x-310;10.1101/708339 storksFrequenciesofnestingstorksinDenmark DescriptionDanishdatafrom1953-1977givingthefrequencyofnestingstorks,thehumanbirthrateandthepercapitaelectricityconsumption.Usagedata(storks)FormatAdataframecontaining25observations.SourceGabrielandOdoroff,Table1.ReferencesGabriel,K.R.andOdoroff,C.L.(1990)Biplotsinbiomedicalresearch.StatisticsinMedicine9(5):pp.469-485. textxyNiceplacementoflabelsinaplot DescriptionFunctiontextxycallsfunctiontextinordertoaddtexttopointsinagraph.textxychoosesadifferentpositionforthetextdependingonthequadrant.Thistendstoproducesbetterreadableplots,withlabelsfanningawayfromtheorigin.Usagetextxy(X,Y,labs,m=c(0,0),cex=0.5,offset=0.8,...) textxy19ArgumentsXxcoordinatesofasetofpointsYycoordinatesofasetofpointslabslabelstobeplacednexttothepointsmcoordinatesoftheoriginoftheplot(default(0,0))cexcharacterexpansionfactoroffsetcontrolsthedistancebetweenthelabelandthepoint.Avalueof0willplotlabelsontopofthepoint.Largervaluesgivelargerseparationbetweenpointandlabel.Thedefaultvalueis0.8...additionaargumentsforfunctiontext.ValueNULLAuthor(s)JanGraffelman(jan.graffelman@upc.edu)ReferencesGraffelman,J.(2006)Aguidetobiplotcalibration.SeeAlsotextExamplesxrnorm(50)yrnorm(50)plot(x,y,asp=1)textxy(x,y,1:50,m=c(mean(x),mean(y))) IndexTopicaplotcircle,8dlines,9textxy,18Topicarithrad2degree,14Topicdatasetscalves,6goblets,10heads,10linnerud,11spaindist,17storks,18Topicmisctextxy,18Topicmultivariatebplot,2calibrate,3canocor,6ones,11origin,12PrinCoor,13rda,15shiftvector,16biplot,5,16bplot,2calibrate,3,17calves,6cancor,7canocor,6,16circle,8dlines,9goblets,10heads,10lines,9,12linnerud,11matrix,12ones,11origin,12princomp,14,16PrinCoor,13rad2degree,14rda,15shiftvector,16spaindist,17storks,18text,19textxy,1820