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.
lambda_to_iqlr(m, focus.cov = NULL, probs = c(0.25, 0.75))
object of class pibblefit (e.g., output of pibble
)
vector of integers or characters specifying columns (covariates) of Lambda to include in calculating IQLR (if NULL, default, then uses all covariates)
bounds for categories (i.e., features / genes / taxa) to include in calculation of iqlr (smaller bounds means more stringent inclusion criteria)
array of dimension (D, Q, iter) where D is number of taxa, Q is number of covariates, and iter is number of posterior samples.
Primarily intended for doing differential expression analysis under assumption that only small group of categories (e.g., taxa / genes) are changing
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
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,] 0.9369377 -4.31456177
#> [2,] -2.6256559 -0.86229691
#> [3,] -0.9409115 -0.05178151
#> [4,] -0.8338864 -1.44359055
#> [5,] -0.0257660 -1.06327438
#> [6,] -0.4277051 -0.02538584
#> [7,] 1.6333409 1.60163199
#> [8,] 0.7446580 0.43526423
#> [9,] 1.0301398 1.06010783
#> [10,] -0.2246074 0.07037779
#>
#> , , 2
#>
#> [,1] [,2]
#> [1,] 1.5249387 -4.18279666
#> [2,] -3.6680319 -0.57792320
#> [3,] -0.9418494 -0.31654880
#> [4,] -0.9340701 -1.23658010
#> [5,] 0.0403386 -0.64724953
#> [6,] -0.5151245 0.31162298
#> [7,] 0.9467511 1.07606981
#> [8,] 0.3854450 -0.01598194
#> [9,] 1.0637496 0.94093906
#> [10,] -0.7078926 -0.03580975
#>
#> , , 3
#>
#> [,1] [,2]
#> [1,] 0.6362426 -3.88468928
#> [2,] -2.8706504 -0.52816598
#> [3,] -1.0589282 -0.01621284
#> [4,] -0.9329860 -1.35975552
#> [5,] -0.2900369 0.23922056
#> [6,] -0.1307388 0.21432833
#> [7,] 1.8337282 1.41371799
#> [8,] 0.3930429 0.56306570
#> [9,] 1.5988713 0.81290266
#> [10,] -0.5780974 0.52477438
#>
#> , , 4
#>
#> [,1] [,2]
#> [1,] 0.53178554 -3.25093876
#> [2,] -4.06741763 0.81671851
#> [3,] -0.89368194 -0.47989018
#> [4,] -1.31081533 -0.49658083
#> [5,] -0.04485319 -0.07585102
#> [6,] -0.26761683 0.23552933
#> [7,] 1.43581855 1.68263902
#> [8,] 0.80772819 0.18529295
#> [9,] 1.39676908 0.79117807
#> [10,] -0.54847792 0.65360631
#>
#> , , 5
#>
#> [,1] [,2]
#> [1,] 2.0635129 -3.53515949
#> [2,] -2.8579883 -0.08812692
#> [3,] -1.2420807 -0.92726836
#> [4,] -0.6525969 -0.96945236
#> [5,] -0.3114075 -0.46255526
#> [6,] -0.6233660 0.11264875
#> [7,] 1.2713000 1.38587337
#> [8,] 0.6233776 0.51084735
#> [9,] 1.4803826 1.21896340
#> [10,] -0.4633479 0.32970047
#>