Package balance. October 12, 2018

Similar documents
Package bisect. April 16, 2018

Package fastdummies. January 8, 2018

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package coda.base. August 6, 2018

Package ECctmc. May 1, 2018

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package vinereg. August 10, 2018

Package SEMrushR. November 3, 2018

Package validara. October 19, 2017

Package gtrendsr. October 19, 2017

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package canvasxpress

Package barcoder. October 26, 2018

Package WordR. September 7, 2017

Package PCADSC. April 19, 2017

Package docxtools. July 6, 2018

Package gtrendsr. August 4, 2018

Package omu. August 2, 2018

Package kdtools. April 26, 2018

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package propr. November 19, 2018

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package spark. July 21, 2017

Package widyr. August 14, 2017

Package preprosim. July 26, 2016

Package ClusterSignificance

Package qualmap. R topics documented: September 12, Type Package

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package effectr. January 17, 2018

Package lumberjack. R topics documented: July 20, 2018

Package milr. June 8, 2017

Package kerasformula

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package NFP. November 21, 2016

Package projector. February 27, 2018

Package deductive. June 2, 2017

Package raker. October 10, 2017

Package fitbitscraper

Package climber. R topics documented:

Package crossrun. October 8, 2018

Package rsppfp. November 20, 2018

Package ClustGeo. R topics documented: July 14, Type Package

Package splithalf. March 17, 2018

Package metaheur. June 30, 2016

Package semver. January 6, 2017

Package RNAseqNet. May 16, 2017

Package optimus. March 24, 2017

Package fastrtext. December 10, 2017

Package Numero. November 24, 2018

Package fusionclust. September 19, 2017

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package superheat. February 4, 2017

Package MTLR. March 9, 2019

Package rzeit2. January 7, 2019

Package weco. May 4, 2018

Package calpassapi. August 25, 2018

Package samplesizecmh

Package vip. June 15, 2018

Package wrswor. R topics documented: February 2, Type Package

Package queuecomputer

Package editdata. October 7, 2017

Package repec. August 31, 2018

Package catenary. May 4, 2018

Package modmarg. R topics documented:

Package glmnetutils. August 1, 2017

Package meme. November 2, 2017

Package triebeard. August 29, 2016

Package philr. August 25, 2018

Package svalues. July 15, 2018

Package geneslope. October 26, 2016

Package facerec. May 14, 2018

Package bayesdp. July 10, 2018

Package sgmcmc. September 26, Type Package

Package quickreg. R topics documented:

Package datasets.load

Package PDN. November 4, 2017

Package CuCubes. December 9, 2016

Package EvolutionaryGames

Package gppm. July 5, 2018

Package zoomgrid. January 3, 2019

Package autocogs. September 22, Title Automatic Cognostic Summaries Version 0.1.1

Package breakdown. June 14, 2018

Package dgo. July 17, 2018

Package readxl. April 18, 2017

Package regexselect. R topics documented: September 22, Version Date Title Regular Expressions in 'shiny' Select Lists

Package elmnnrcpp. July 21, 2018

Package TrafficBDE. March 1, 2018

Package pdfsearch. July 10, 2018

Package sigqc. June 13, 2018

Package scmap. March 29, 2019

Package epitab. July 4, 2018

Package crochet. January 8, 2018

Package edfreader. R topics documented: May 21, 2017

Package C50. December 1, 2017

Package ScottKnottESD

Package frequencyconnectedness

Package redlistr. May 11, 2018

Package colf. October 9, 2017

Package zebu. R topics documented: October 24, 2017

Transcription:

Title Visualize Balances of Compositional Data Version 0.1.6 URL http://github.com/tpq/balance Package balance October 12, 2018 BugReports http://github.com/tpq/balance/issues Balances have become a cornerstone of compositional data analysis. However, conceptualizing balances is difficult, especially for high-dimensional data. Most often, investigators visualize balances with ``balance dendrograms''. However, this visualization tool does not scale well for large data. This package provides an alternative scheme for visualizing balances, described in [Quinn (2018) <DOI:10.12688/f1000research.15858.1>]. This package also provides a method for principal balance analysis. License GPL-2 LazyData TRUE VignetteBuilder knitr RoxygenNote 6.1.0 Encoding UTF-8 Imports methods, ggplot2, grid Depends R (>= 3.2.2) Suggests ape, ggthemes, knitr, philr, propr, reshape2, rmarkdown, robcompositions, testthat NeedsCompilation no Author Thomas Quinn [aut, cre] Maintainer Thomas Quinn <contacttomquinn@gmail.com> Repository CRAN Date/Publication 2018-10-12 13:30:03 UTC R topics documented: balance........................................... 2 balance.combine...................................... 2 1

2 balance.combine balance.fromcontrast.................................... 3 balance.fromsbp...................................... 4 balance.plot......................................... 4 bplot-class.......................................... 5 pba.............................................. 6 pba-class.......................................... 7 sbp.fromhclust....................................... 9 sbp.frompba........................................ 9 sbp.sort........................................... 10 vlr.............................................. 11 wide2long.......................................... 12 Index 13 balance Calculate and Visualize Balances This function wraps balance.plot. balance(...)... to balance.plot. balance.combine Combine Two Sub-Plots This function combines the "partition" sub-plot with the "distribution" sub-plot, preserving scale. balance.combine(balance.partition, balance.distribution, size = "first") balance.partition A ggplot object. The "partition" sub-plot. balance.distribution A ggplot object. The "distribution" sub-plot. size A string. Toggles whether to size final figure based on "first" (partition) or "last" (distribution) figure provided.

balance.fromcontrast 3 res <- balance(x, sbp) custom1 <- res[[1]] + ggplot2::theme_dark() custom2 <- res[[2]] + ggplot2::theme_dark() balance.combine(custom1, custom2) balance.fromcontrast Transform Samples with the ilr of a Balance Transform Samples with the ilr of a Balance balance.fromcontrast(x, contrast) x A matrix with rows as samples (N) and columns as components (D). contrast A vector. One column of a serial binary partition matrix with values [-1, 0, 1] describing D components. A transformation of samples for the balance provided. balance.fromcontrast(x, sbp[,1])

4 balance.plot balance.fromsbp Compute Balances from an SBP Matrix Compute Balances from an SBP Matrix balance.fromsbp(x, y) x y A matrix with rows as samples (N) and columns as components (D). A serial binary partition matrix with rows as components (D) and columns as balances (D-1). A transformation of samples for each balance in the SBP matrix. balance.fromsbp(x, sbp) balance.plot Calculate and Visualize Balances This function calculates balances based on the compositional data set and serial binary partition (SBP) matrix provided, then generates a figure from the results. balance.plot(x, y, d.group, n.group, boxplot.split = TRUE, weigh.var = FALSE, size.text = 20, size.pt = 4)

bplot-class 5 x y d.group n.group boxplot.split weigh.var size.text size.pt A matrix with rows as samples (N) and columns as components (D). A serial binary partition matrix with rows as components (D) and columns as balances (D-1). A vector of group labels for components. Optional. If provided, used to color component points. A vector of group labels for samples. Optional. If provided, used to color sample points. A boolean. Toggles whether to split the boxplot by n.group. TRUE better resembles balance dendrogram style. A boolean. Toggles whether to weigh line width by the proportion of explained variance. Only do this if balances come from an SBP that decomposes variance. An integer. Sets legend text size. An integer. Sets point size. A list of the "partition" ggplot object, the "distribution" ggplot object, and the per-sample balances. balance(x, sbp) bplot-class A pba model S4 class A pba model S4 class ## S4 method for signature 'bplot' show(object) ## S4 method for signature 'bplot' x[[i]]

6 pba object, x i A bplot object. An integer. Used to index the bplot object. Methods (by generic) Slots show: Method to show bplot object. [[: Method to subset bplot object. balance.partition A ggplot object. The "partition" sub-plot. balance.distribution A ggplot object. The "distribution" sub-plot. balances The results of balance.fromsbp. balance(x, sbp) pba Principal Balance Analysis This function performs a principal balance analysis using the hierarchical clustering of components method described by Pawlowsky-Glahn et al. in "Principal balances" from the CoDaWork 2011 proceedings. pba(x, alpha = NA) x alpha A matrix with rows as samples (N) and columns as components (D). A double. Defines a hyper-parameter used by the Box-Cox transformation to approximate log-ratio variance in the presence of zeros. Skip with NA.

pba-class 7 Details This resultant object contains the original data, the serial binary partition, the principal balances, and the fractional variances per balance. Use predict to deploy the pba model on new data. A pba object. train <- iris[1:50,1:4] test <- iris[51:150,1:4] model <- pba(train) predict(model, test) plot(model, test) pba-class A pba model S4 class A pba model S4 class ## S4 method for signature 'pba' show(object) ## S4 method for signature 'pba' predict(object, y) ## S4 method for signature 'pba,missing' plot(x, y, group, pb1 = 1, pb2 = 2, size.text = 18) ## S4 method for signature 'pba,matrix' plot(x, y, group, pb1 = 1, pb2 = 2, size.text = 18) ## S4 method for signature 'pba,data.frame' plot(x, y, group, pb1 = 1, pb2 = 2, size.text = 18)

8 pba-class object, x y group pb1, pb2 size.text A pba object. A matrix on which to deploy the pba model. A character vector. Group labels used to color points. An integer. Sets principal balances to plot. An integer. Sets legend text size. Methods (by generic) show: Method to show pba model. predict: Method to deploy pba model. plot: Method to plot pba model. plot: Method to plot pba model. plot: Method to plot pba model. Slots data A matrix. The original data. sbp A matrix. The SBP matrix. pba A matrix. The balances. totvar A numeric vector. The total variance per balance. subvar A numeric vector. The fractional variance per balance. train <- iris[1:50,1:4] test <- iris[51:150,1:4] model <- pba(train) predict(model, test) plot(model, test)

sbp.fromhclust 9 sbp.fromhclust Build SBP Matrix from hclust Object This function builds an SBP matrix from an hclust object as produced by the hclust function. sbp.fromhclust(hclust) hclust An hclust object. An SBP matrix. data(cars) h <- hclust(dist(cars)) sbp.fromhclust(h) sbp.frompba Build SBP Matrix of Principal Balances This function builds an SBP of principal balances using the hierarchical clustering of components method described by Pawlowsky-Glahn et al. in "Principal balances" from the CoDaWork 2011 proceedings. sbp.frompba(x, alpha = NA)

10 sbp.sort x alpha A matrix with rows as samples (N) and columns as components (D). A double. Defines a hyper-parameter used by the Box-Cox transformation to approximate log-ratio variance in the presence of zeros. Skip with NA. An SBP matrix. sbp.frompba(x) sbp.sort Sort SBP Matrix Sort SBP Matrix sbp.sort(sbp) sbp An SBP matrix. An SBP matrix.

vlr 11 sbp.sort(sbp) vlr Calculate Log-ratio Variance This function calculates the log-ratio variance for all components in a matrix. vlr(x, alpha = NA) x alpha A matrix with rows as samples (N) and columns as components (D). A double. Defines a hyper-parameter used by the Box-Cox transformation to approximate log-ratio variance in the presence of zeros. Skip with NA. A VLR matrix. vlr(x)

12 wide2long wide2long Make Long Data from Wide Data Make Long Data from Wide Data wide2long(wide) wide A data set in wide format. A data set in long format. wide2long(sbp)

Index [[,bplot-method (bplot-class), 5 balance, 2 balance.combine, 2 balance.fromcontrast, 3 balance.fromsbp, 4 balance.plot, 2, 4 bplot-class, 5 pba, 6 pba-class, 7 plot,pba,data.frame-method (pba-class), 7 plot,pba,matrix-method (pba-class), 7 plot,pba,missing-method (pba-class), 7 predict,pba-method (pba-class), 7 sbp.fromhclust, 9 sbp.frompba, 9 sbp.sort, 10 show,bplot-method (bplot-class), 5 show,pba-method (pba-class), 7 vlr, 11 wide2long, 12 13