reconsi package: vignette

Introduction

The aim of this pacakage is to improve simultaneous inference for correlated hypotheses using collapsed null distributions. These collapsed null distributions are estimated in an empirical Bayes framework through resampling. Wilcoxon rank sum test and two sample t-test are natively implemented, but any other test can be used.

Installation

library(BiocManager)
BiocManager::install("reconsi")
library(devtools)
install_github("CenterForStatistics-UGent/reconsi")
suppressPackageStartupMessages(library(reconsi))
cat("reconsi package version", as.character(packageVersion("reconsi")), "\n")
## reconsi package version 1.0.0

General use

We illustrate the general use of the package on a synthetic dataset. The default Wilcoxon rank-sum test is used.

The method provides an estimate of the proportion of true null hypothesis, which is close to the true 90%.

## [1] 0.8513562

The result of the procedure can be represented graphically as follows:

## Warning: Removed 121 row(s) containing missing values (geom_path).

The approximate correlation matrix of test statistic can be visualized as follows:

It is also possible to provide a custom test function, which must accept at least a ‘y’ response variable and a ‘x’ grouping factor. Additionally, quantile, distribution and density functions should be supplied for transformation through quantiles to z-values.

This framework also accepts more than 2 groups, and additional covariates through the “argList” argument.

If the null distribution of the test statistic is not known, it is also possbile to execute the procedure on the scale of the original test statistics, rather than z-values by setting zValues = FALSE. This may be numerically less stable.

Alternatively, the same resampling instances may be used to determine the marginal null distributions as to estimate the collapsed null distribution, by setting the “permZvals” flag to true.

When no grouping variable is available, one can perform a bootstrap as resampling procedure. This is achieved by simply not supplying a grouping variable “x”. Here we perform a one sample Wilcoxon rank sum test for equality of the means to 0.

Case study

We illustrate the package using an application from microbiology. The species composition of a community of microorganisms can be determined through sequencing. However, this only yields compositional information, and knowledge of the population size can be acquired by cell counting through flow cytometry. Next, the obtained species compositions can multiplied by the total population size to yield approximate absolute cell counts per species. Evidently, this introduces strong correlation between the tests due to the common factor. In other words: random noise in the estimation of the total cell counts will affect all hypotheses. Therefore, we employ resampling to estimate the collapsed null distribution, that will account for this dependence.

The dataset used is taken from Vandeputte et al., 2017 (see manuscript), a study on gut microbiome in healthy and Crohn’s disease patients. The test looks for differences in absolute abundance between healthy and diseased patients. It relies on the phyloseq package, which is the preferred way to interact with our machinery for microbiome data.

The estimated tail-area false discovery rates can then simply be extracted as

##           0%          25%          50%          75%         100% 
## 1.549927e-17 1.884717e-02 3.217944e-01 7.424020e-01 8.769332e-01

Session info

Finally all info on R and package version is shown

sessionInfo()
## R version 4.0.0 (2020-04-24)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.11-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.11-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] reconsi_1.0.0
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.4.6        ape_5.3             phyloseq_1.32.0    
##  [4] lattice_0.20-41     Biostrings_2.56.0   assertthat_0.2.1   
##  [7] digest_0.6.25       foreach_1.5.0       R6_2.4.1           
## [10] plyr_1.8.6          stats4_4.0.0        evaluate_0.14      
## [13] ggplot2_3.3.0       pillar_1.4.3        zlibbioc_1.34.0    
## [16] rlang_0.4.5         data.table_1.12.8   vegan_2.5-6        
## [19] S4Vectors_0.26.0    Matrix_1.2-18       rmarkdown_2.1      
## [22] labeling_0.3        splines_4.0.0       stringr_1.4.0      
## [25] igraph_1.2.5        munsell_0.5.0       compiler_4.0.0     
## [28] xfun_0.13           pkgconfig_2.0.3     BiocGenerics_0.34.0
## [31] multtest_2.44.0     mgcv_1.8-31         htmltools_0.4.0    
## [34] biomformat_1.16.0   tidyselect_1.0.0    tibble_3.0.1       
## [37] IRanges_2.22.0      codetools_0.2-16    permute_0.9-5      
## [40] crayon_1.3.4        dplyr_0.8.5         MASS_7.3-51.6      
## [43] grid_4.0.0          nlme_3.1-147        jsonlite_1.6.1     
## [46] gtable_0.3.0        lifecycle_0.2.0     magrittr_1.5       
## [49] scales_1.1.0        KernSmooth_2.23-17  stringi_1.4.6      
## [52] farver_2.0.3        XVector_0.28.0      reshape2_1.4.4     
## [55] ellipsis_0.3.0      vctrs_0.2.4         Rhdf5lib_1.10.0    
## [58] iterators_1.0.12    tools_4.0.0         ade4_1.7-15        
## [61] Biobase_2.48.0      glue_1.4.0          purrr_0.3.4        
## [64] parallel_4.0.0      survival_3.1-12     yaml_2.2.1         
## [67] colorspace_1.4-1    rhdf5_2.32.0        cluster_2.1.0      
## [70] knitr_1.28