We recognize that this package uses concepts that are not necessarily intuitive. As such, we offer a brief critique of proportionality analysis. Although the user may feel eager to start here, we strongly recommend first reading the companion vignette, “An Introduction to Proportionality”.

To facilitate discussion, we simulate count data for 5 features (e.g., genes) labeled “a”, “b”, “c”, “d”, and “e”, as measured across 100 subjects.

```
library(propr)
N <- 100
a <- seq(from = 5, to = 15, length.out = N)
b <- a * rnorm(N, mean = 1, sd = 0.1)
c <- rnorm(N, mean = 10)
d <- rnorm(N, mean = 10)
e <- rep(10, N)
X <- data.frame(a, b, c, d, e)
```

Let us assume that these data \(X\) represent absolute abundance counts (i.e., not relative data). We can build a relative dataset, \(Y\), by constraining and perturbing \(X\):

`Y <- X / rowSums(X) * abs(rnorm(N))`

We can check that the new feature vectors do in fact contain relative quantities. For example, the ratio of the second feature to the first is the same for both the absolute and relative datasets.

`all(round(X[, 2] / X[, 1] - Y[, 2] / Y[, 1], 5) == 0)`

`## [1] TRUE`

Next, we compare pairwise scatterplots for the absolute count data and the corresponding relative count data. We see quickly how these relative data suggest a *spurious correlation*: although genes “c” and “d” do not correlate with one another absolutely, their relative quantities do.

`pairs(X) # absolute data`

`pairs(Y) # relative data`

Spurious correlation is evident by the correlation coefficients too.

`suppressWarnings(cor(X)) # absolute correlation`

```
## a b c d e
## a 1.0000000 0.95625381 -0.11641626 0.1411743 NA
## b 0.9562538 1.00000000 -0.04313455 0.1533650 NA
## c -0.1164163 -0.04313455 1.00000000 0.1442480 NA
## d 0.1411743 0.15336500 0.14424801 1.0000000 NA
## e NA NA NA NA 1
```

`cor(Y) # relative correlation`

```
## a b c d e
## a 1.0000000 0.9916106 0.8822107 0.9010848 0.9037788
## b 0.9916106 1.0000000 0.8824385 0.8982183 0.9014402
## c 0.8822107 0.8824385 1.0000000 0.9736572 0.9883908
## d 0.9010848 0.8982183 0.9736572 1.0000000 0.9831245
## e 0.9037788 0.9014402 0.9883908 0.9831245 1.0000000
```

In contrast, the **variance of the log-ratios** (VLR), defined as the variance of the logarithm of the ratio of two feature vectors, offers a measure of dependence that (a) does not change with respect to the nature of the data (i.e., absolute or relative), and (b) does not change with respect to the number of features included in the computation. As such, the VLR, constituting the numerator portion of the \(\phi\) metric and a portion of the \(\rho\) metric as well, is considered *sub-compositionally coherent*. Yet, while VLR yields valid results for compositional data, it lacks a meaningful scale.

`propr:::proprVLR(Y[, 1:4]) # relative VLR`

```
## a b c d
## a 0.000000000 0.008564302 0.11257667 0.10127560
## b 0.008564302 0.000000000 0.12040585 0.11182877
## c 0.112576670 0.120405854 0.00000000 0.01784847
## d 0.101275596 0.111828774 0.01784847 0.00000000
```

`propr:::proprVLR(X) # absolute VLR`

```
## a b c d e
## a 0.000000000 0.008564302 0.112576670 0.10127560 0.097960496
## b 0.008564302 0.000000000 0.120405854 0.11182877 0.110233122
## c 0.112576670 0.120405854 0.000000000 0.01784847 0.008246335
## d 0.101275596 0.111828774 0.017848472 0.00000000 0.012376781
## e 0.097960496 0.110233122 0.008246335 0.01237678 0.000000000
```

In the calculation of proportionality, we adjust the arbitrarily large VLR by the variance of its individual constituents. To do this, we need to place samples on a comparable scale. Log-ratio transformation, such as the **centered log-ratio** (clr) transformation, shifts the data onto a “standardized” scale that allows us to compare differences in the VLR-matrix.

In the next figures, we compare pairwise scatterplots for the clr-transformed absolute count data and the corresponding clr-transformed relative count data. While equivalent, we see a relationship between “c” and “d” that should not exist based on what we know from the non-transformed absolute count data. This demonstrates that, although the clr-transformation helps us compare values across samples, it does not rescue information lost by making absolute data relative.

`pairs(propr:::proprCLR(Y[, 1:4])) # relative clr-transformation`

`pairs(propr:::proprCLR(X)) # absolute clr-transformation`

Proportionality is a compromise between the advantages of VLR and the disadvantages of clr to establish a measure of dependence that is robust yet interpretable. Note, however, that because of the division of VLR by the variance of the clr-transformed data, proportionality is not sub-compositionally coherent. As such, spurious proportionality is possible when the clr does not adequately approximate the absolute data.

`propr(Y[, 1:4])@matrix # relative proportionality with clr`

```
## a b c d
## a 1.0000000 0.8490644 -0.9000464 -0.8658031
## b 0.8490644 1.0000000 -0.8859082 -0.8994115
## c -0.9000464 -0.8859082 1.0000000 0.7092301
## d -0.8658031 -0.8994115 0.7092301 1.0000000
```

`propr(X)@matrix # absolute proportionality with clr`

```
## a b c d e
## a 1.0000000 0.8904492 -0.8830075 -0.7881833 -0.8230823
## b 0.8904492 1.0000000 -0.8266403 -0.7816485 -0.8413788
## c -0.8830075 -0.8266403 1.0000000 0.5977907 0.8011662
## d -0.7881833 -0.7816485 0.5977907 1.0000000 0.6770485
## e -0.8230823 -0.8413788 0.8011662 0.6770485 1.0000000
```

Unlike the clr which adjusts each subject vector by the geometric mean of that vector, the **additive log-ratio** (alr) adjusts each subject vector by the value of one its own components, chosen as a *reference*. If we select as a reference some feature \(D\) with an *a priori* known fixed absolute count across all subjects, we can effectively “back-calculate” absolute data from relative data. When initially crafting the data \(X\), we included “e” as this fixed value.

The following figures compare pairwise scatterplots for alr-transformed relative count data (i.e., \(alr(Y)\) with “e” as the reference) and the corresponding absolute count data. We see here how alr-transformation eliminates the *spurious correlation* between “c” and “d”.

`pairs(propr:::proprALR(Y, ivar = 5)) # relative alr`

`pairs(X[, 1:4]) # absolute data`

Again, this gets reflected in the results of `perb`

when we select “e” as the reference.

`propr(Y, ivar = 5)@matrix # relative proportionality with alr`

```
## a b c d e
## a 1.0000000 0.95886376 -0.05997580 0.08212710 0
## b 0.9588638 1.00000000 -0.01625934 0.08793033 0
## c -0.0599758 -0.01625934 1.00000000 0.13454048 0
## d 0.0821271 0.08793033 0.13454048 1.00000000 0
## e 0.0000000 0.00000000 0.00000000 0.00000000 1
```

Now, let us assume these same data, \(X\), actually measure relative counts. In other words, \(X\) is already relative and we do not know the real quantities which correspond to \(X\) absolutely. Well, if we knew that “a” represented a known fixed quantity, we could use alr-transformation again to “back-calculate” the absolute abundances. In this case, we will see that “c”, “d”, and “e” actually do have proportional expression under these conditions. Although the measured quantity of “c”, “d”, and “e” do not change considerably across subjects, the measured quantity of the known fixed feature does change. As such. whenever “a” increases while “c”, “d”, and “e” remains the same, the latter three features have actually decreased. Since they all decreased together, they act as a highly proportional *module*.

`pairs(propr:::proprALR(X, ivar = 1)) # new relative alr`

Again, this gets reflected in the results of `perb`

when we select “a” as the reference.

`propr(X, ivar = 1)@matrix # new relative proportionality with alr`

```
## a b c d e
## a 1 0.000000000 0.000000000 0.00000000 0.00000000
## b 0 1.000000000 0.006068288 -0.01810704 -0.03481184
## c 0 0.006068288 1.000000000 0.91653831 0.96083193
## d 0 -0.018107041 0.916538308 1.00000000 0.93787882
## e 0 -0.034811836 0.960831929 0.93787882 1.00000000
```

We see here that, unlike clr-transformed proportionality metrics, the alr-transformed metric \(\rho\) is sub-compositionally coherent and yields identical results regardless of the nature of the data explored. Of course, this assumes that one knows the identity of a feature fixed across all subjects.

To learn more about proportionality, we refer the reader to the relevant literature.

`citation("propr")`

```
##
## To cite propr in publications use:
##
## Quinn T, Richardson MF, Lovell D, Crowley T (2017) propr: An
## R-package for Identifying Proportionally Abundant Features Using
## Compositional Data Analysis. Scientific Reports 7(16252):
## doi:10.1038/s41598-017-16520-0
##
## Erb I, Quinn T, Lovell D, Notredame C (2017) Differential
## Proportionality - A Normalization-Free Approach To Differential
## Gene Expression. Proceedings of CoDaWork 2017, The 7th
## Compositional Data Analysis Workshop; available under bioRxiv
## 134536: doi:10.1101/134536
##
## Quinn T, Erb I, Richardson MF, Crowley T (2018) Understanding
## sequencing data as compositions: an outlook and review.
## Bioinformatics. Advanced Access Publication:
## doi:10.1093/bioinformatics/bty175
##
## Lovell D, Pawlowsky-Glahn V, Egozcue JJ, Marguerat S, Bahler J
## (2015) Proportionality: A Valid Alternative to Correlation for
## Relative Data. PLoS Comput Biol 11(3):
## doi:10.1371/journal.pcbi.1004075
##
## Erb I, Notredame C (2016) How should we measure proportionality
## on relative gene expression data? Theory Biosci 135(1):
## doi:10.1007/s12064-015-0220-8
##
## To see these entries in BibTeX format, use 'print(<citation>,
## bibtex=TRUE)', 'toBibtex(.)', or set
## 'options(citation.bibtex.max=999)'.
```