An R package for multivariate adaptive shrinkage.
R C++
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

mashr: Multivariate Adaptive Shrinkage in R

Travis Build Status Appveyor Build status codecov

Welcome to mashr! This package implements methods to estimate and test many effects in many conditions (or many effects on many outcomes).

The methods use Empirical Bayes methods to estimate patterns of similarity among conditions, and then exploit those patterns of similarity among conditions to improve accuracy of effect estimates. See Urbut et al for details of the model and methods.

Note that this R package is a refactoring of the code originally used to create results for the paper. The original package code is here.

Quick Start

  1. Follow the setup instructions below.

  2. See the Introductory Vignette for an introduction to mashr.

  3. Then work through the other vignettes to learn more about mashr: Introduction to mash: data-driven covariances and Simulation with non-canonical matrices.


Please follow these steps to install the latest version of the mashr package:

  1. In R, install these three R packages from CRAN:

  2. Optionally, install the package used for memory profiling:

  3. Optionally, install MOSEK and the Rmosek package, for faster optimization in the ashr package. See the ashr Github repository for details.

  4. Install the ExtremeDeconvolution R package. Note that you will need to link to the GNU Scientific Library to build this package.

  5. Once you have installed all these packages, you can install and load the latest release of the mashr package:


    This command should automatically retrieve and install the ashr package from Github. If it does not, install ashr separately using devtools:


    Alternatively, if you have cloned the repository locally, you can install the package by following these steps:

    R CMD build mashr
    R CMD INSTALL mashr_0.2-6.tar.gz

Developer notes

  • When any changes are made to roxygen2 markup or the C++ code in the src directory, simply run devtools::document() to update the RcppExports.cpp, the package namespaces (see NAMESPACE), and the package documentation files (in the man directory),

  • These are the R commands to build the website (make sure you are connected to Internet while running these commands):

build_site(mathjax = FALSE)


If the data or code in this repository are useful for your research project, please cite our preprint:

S M Urbut, G Wang, M Stephens. Flexible statistical methods for estimating and testing effects in genomic studies with multiple conditions. bioRxiv doi:10.1101/096552.