Adaptive Shrinkage of Correlation and Covariance Matrices

Performs adaptive shrinkage of correlation and covariance matrices using a mixture model prior over the Fisher z-transformation of the correlations. It allows separate shrinkage intensity for each cell of the correlation matrix. Can also we flexibly extended to shrinking correlation like quantities such as cosine similarities in word2vec models and to partial correlations in conditional graph estimation. For details on methods, refer to Stephens (2017) "False discovery rates: a new deal", .


R package for adaptive correlation and covariance matrix shrinkage.

Kushal K Dey, Matthew Stephens.

License

Copyright (c) 2017-2018, Kushal Dey.

All source code and software in this repository are made available under the terms of the GNU General Public License. See the LICENSE file for the full text of the license.

Citing this work

If you find that this R package is useful for your work, please cite the following paper:

Methods Overview

A companion package to the ashr package by Matthew Stephens see paper, CorShrink adaptive shrinks correlation between a pair of variables based on the number of pairwise complete observations. CorShrink can be applied to a vector or matrix of pairwise correlations and can also be generalized to quantities similar in nature to correlations - like partial correlations, rank correlations and cosine simialrities from word2vec model. CorShrink when applied to a data matrix, is able to learn an individual shrinkage intensity for a pair of variables from the number of missing observations between each such pair - which allows the method to handle large scale missing observations (a demo of which is presented in the example below).

Quick Start

The instructions for installing the package are as follows.

For CRAN version:

install.packages("CorShrink")

For the development version:

library(devtools)
install_github("kkdey/CorShrink", build_vignettes = TRUE)

Then load the package with:

library(CorShrink)

A demo example usage of CorShrink is given below. For detailed examples and methods, check here.

We first load an example data matrix of gene expression for a specific gene in a tissue sample drawn from a test individual in the GTEx Project. We note that there are many missing observations in this data matrix, which correspond to tissue samples not contributed by an individual.

data("sample_by_feature_data")
sample_by_feature_data[1:5, 1:5]

           Adipose - Subcutaneous Adipose - Visceral (Omentum)
GTEX-111CU              10.472332                     10.84006
GTEX-111FC               7.335392                           NA
GTEX-111VG               9.118889                           NA
GTEX-111YS              10.806459                     11.26113
GTEX-1122O              11.040446                     11.71497
           Adrenal Gland Artery - Aorta Artery - Coronary
GTEX-111CU      2.721234             NA                NA
GTEX-111FC            NA             NA                NA
GTEX-111VG            NA             NA                NA
GTEX-111YS      3.454823       1.162059                NA
GTEX-1122O      1.522667       1.674467          4.188002

We use CorShrink to estimate the correlation matrix taking account of the missing observations and compare the result with the matrix of pairwise correlations generated from complete observations for each pair of features.

out <- CorShrinkData(sample_by_feature_data, sd_boot = FALSE, image = "both",
                    image.control = list(tl.cex = 0.2))                            
Structure Plot

The above approach uses an asymototic version of CorShrink. Alternatively, one can use a re-sampling or Bootstrapping approach.

out <- CorShrinkData(sample_by_feature_data, sd_boot = TRUE, image = "both",
                    image.control = list(tl.cex = 0.2))
Structure Plot

Walk through some more detailed examples in the vignette:

vignette("corshrink")

Credits

The authors would like to thank the GTEx Consortium, John Blischak, Sarah Urbut, Chiaowen Joyce Hsiao, Peter Carbonetto and all members of the Stephens Lab. For any queries related to the CorShrink package, contact Kushal K. Dey here [email protected]

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("CorShrink")

0.1-6 by Kushal Dey, 5 months ago


https://github.com/kkdey/CorShrink


Report a bug at http://github.com/kkdey/CorShrink/issues


Browse source code at https://github.com/cran/CorShrink


Authors: c(person("Kushal" , "Dey" , role=c("aut" , "cre") , email="[email protected]") , person("Matthew" , "Stephens" , role="aut") , person("Peter" , "Carbonetto" , role="ctb"))


Documentation:   PDF Manual  


GPL (>= 2) license


Imports ashr, glmnet, SQUAREM, reshape2, methods, Matrix, gridExtra, corrplot, corpcor, MASS

Suggests knitr, glasso, roxygen2, devtools


Imported by palasso.


See at CRAN