Network-penalized generalized linear models in R and C++.


netReg is an R/C++ implementation of a network-regularized linear regression model. Graph prior knowledge, in the form of biological networks, is being incorporated into the loss function of the linear model which allows better estimation of regression coefficients.

Depending on your installed libraries netReg uses OpenBLAS or BLAS and Lapack for fast computation of matrix operations in an Armadillo\RcppArmadillo framework. We use Dlib in order to calculate the most optimal set of shrinkage parameters using k-fold cross-validation.

For instance, using R, you could fit a network-regularized model like that:

> X <- matrix(rnorm(10*5), 10)
> Y <- matrix(rnorm(10*5), 10)
> aff.mat <- abs(rWishart(1, 10, diag(5))[,,1])

> fit <- edgenet(X=X, Y=Y, G.X=aff.mat, 
                 lambda=1, psigx=1, family="gaussian")
> print(fit)

#>Call: edgenet.default(X = X, Y = Y, G.X = aff.mat, lambda = 1, psigx = 1, 
#>                      family = "gaussian")

#>             [,1]       [,2]       [,3]      [,4]        [,5]
#>[1,]  0.015999757  0.0000000  0.1614923 0.1200417  0.11848110
#>[2,]  0.023446755 -0.2021715  0.0000000 0.4316659  0.00000000
#>[3,] -0.139861486  0.0000000  0.2917003 0.3362468  0.82524790
#>[4,]  0.000000000  0.4495721 -0.2507407 0.3454617 -0.01794482
#>[5,] -0.007317568  0.0000000  0.2590443 0.0000000 -0.10663651

#>[1,]  0.18825966
#>[2,] -0.36970048
#>[3,]  0.27555425
#>[4,]  0.04295871
#>[5,]  0.25898488

#>lambda psi_gx psi_gy 
#>     1      1      0 

#>[1] "gaussian"


netReg comes as a stand alone C++ command line tool shipped with bioconda as well as a Bioconductor package.

Installation of the R package

You can install and use netReg either as an R library from Bioconductor, or by downloading the tarball.

If you want to use the recommended way using Bioconductor just call:

> source("")
> biocLite("netReg")
> library(netReg)

from the R-console. Installing the R package using the downloaded tarball works like this:

$ R CMD install <netReg-x.y.z.tar.gz>

I do not recommend using devtools, but preferring tarballed releases over the most recent commit.

Installation of the command-line tool

You can install the C++ command line tool using conda. For that you should download Anaconda and create a virtual environment. Then install the tool using:

$ conda install -c bioconda netreg
$ netReg -h

You can find more instructions for (manual) installation here.


  • For the R package: load the package using library(netReg). We provide a vignette for the package that can be called using: vignette("netReg").
  • For the command-line tool: You can also use the online tutorial. Have a look at the command line tutorial.


It would be great if you cited netReg like this:

Simon Dirmeier, Christiane Fuchs, Nikola S Mueller, Fabian J Theis; netReg: network-regularized linear models for biological association studies, Bioinformatics, Volume 34, Issue 5, 1 March 2018, Pages 896–898,