Skip to contents

Takes idea from Wu et al. (citation below) and calculates IQLR for Lambda, potentially useful if you believe there is an invariant group of categories (e.g., taxa / genes) that are not changing (in absolute abundance) between samples. IQLR is defined as $$IQLR_x = log(x_i/g(IQVF))$$ for i in 1,...,D. IQVF are the CLR coordinates whose variance is within the inter-quantile range (defined by probs argument to this function). A different IQVF is fit for each posteior sample as the IQVFs are calculted based on posterior estimates for Lambda. The variance of a CLR coordinate is defined as the norm of each row of Lambda[,focus.cov] (i.e., the covariation in Eta, explained by those covariates). This definition of variance allows uses to exclude variation from technical / trivial sources in calculation of IQVF/IQLR.

Usage

lambda_to_iqlr(m, focus.cov = NULL, probs = c(0.25, 0.75))

Arguments

m

object of class pibblefit (e.g., output of pibble)

focus.cov

vector of integers or characters specifying columns (covariates) of Lambda to include in calculating IQLR (if NULL, default, then uses all covariates)

probs

bounds for categories (i.e., features / genes / taxa) to include in calculation of iqlr (smaller bounds means more stringent inclusion criteria)

Value

array of dimension (D, Q, iter) where D is number of taxa, Q is number of covariates, and iter is number of posterior samples.

Details

Primarily intended for doing differential expression analysis under assumption that only small group of categories (e.g., taxa / genes) are changing

References

Jia R. Wu, Jean M. Macklaim, Briana L. Genge, Gregory B. Gloor (2017) Finding the center: corrections for asymmetry in high-throughput sequencing datasets. arxiv:1704.01841v1

Examples


sim <- pibble_sim()
fit <- pibble(sim$Y, sim$X)
# Use first two covariates to define iqlr, just show first 5 samples
lambda_to_iqlr(fit, 1:2)[,,1:5] 
#> , , 1
#> 
#>              [,1]       [,2]
#>  [1,]  2.71086966  5.7756342
#>  [2,] -2.83387197 -2.8177118
#>  [3,]  6.21734877 -1.0205003
#>  [4,]  1.03795398 -1.1817226
#>  [5,]  0.02936279  0.6105819
#>  [6,]  0.56491065 -1.4853419
#>  [7,] -0.35171465 -0.2038065
#>  [8,]  0.99487170  2.1857393
#>  [9,] -2.59773634  0.4813253
#> [10,]  1.00534847 -0.3817622
#> 
#> , , 2
#> 
#>             [,1]         [,2]
#>  [1,]  3.0282808  6.150287737
#>  [2,] -2.3594906 -2.576907294
#>  [3,]  6.5439513 -0.302916382
#>  [4,]  1.2905173 -1.711260645
#>  [5,]  0.7489538  0.465223279
#>  [6,]  1.1754987 -1.210338979
#>  [7,]  0.3202066 -0.008866017
#>  [8,]  0.5439563  3.397195594
#>  [9,] -3.0099723 -0.475595970
#> [10,]  1.5254589 -0.142063900
#> 
#> , , 3
#> 
#>             [,1]       [,2]
#>  [1,]  2.5343542  5.5237336
#>  [2,] -2.8942428 -2.2415649
#>  [3,]  7.2954993 -0.3862755
#>  [4,]  1.0831178 -0.4090549
#>  [5,]  0.3286953  0.6520604
#>  [6,]  1.1259718 -1.2595486
#>  [7,]  0.1886304  0.2571886
#>  [8,]  0.5532129  2.6440282
#>  [9,] -2.7623024 -0.9754247
#> [10,]  1.2980611 -0.2556193
#> 
#> , , 4
#> 
#>              [,1]        [,2]
#>  [1,]  3.52305266  5.21132802
#>  [2,] -3.00855521 -3.21624947
#>  [3,]  6.30345752 -0.46103455
#>  [4,]  1.11136601 -0.40460251
#>  [5,]  0.81671390  0.49443808
#>  [6,]  1.37591213 -1.08911184
#>  [7,]  0.06188396 -0.03022373
#>  [8,]  0.57146984  2.31820778
#>  [9,] -2.00926594 -1.19887222
#> [10,]  1.61737686 -0.11045263
#> 
#> , , 5
#> 
#>             [,1]       [,2]
#>  [1,]  2.7257996  5.9445044
#>  [2,] -3.2776972 -3.5446320
#>  [3,]  5.0955870 -0.1133081
#>  [4,]  0.9483930 -2.2406642
#>  [5,] -0.1463391  0.5437634
#>  [6,]  0.9236704 -1.3396334
#>  [7,] -0.4409935 -0.3799092
#>  [8,]  0.8102189  2.5869159
#>  [9,] -2.6822822  0.9933817
#> [10,]  1.0285488 -0.2413530
#>