Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Tuning-free sparse variable selection with the TREX

This is a resource page for the TREX which allows sparse tuning-free variable selection for linear regression. The TREX is currently available as MATLAB package. R/Python packages are under development.


The forward model is assumed to be the standard linear model:

Here, X is a known design matrix and y is a known continuous response vector. The vector β comprises the unknown coefficients and σ an unknown scale.

The TREX estimator [1] is based on solving the following objective function:

The constant c is by default set to c=0.5, thus requiring no tuning (as compared to, e.g, the Lasso). However, the objective is non-convex and comprises 2p minima.

Several different algorithmic strategies are available to solve the objective. A proximal gradient descent for an approximate solution has been introduced in [1], referred to as q-TREX. Via appropriate reformulation and decomposition, the TREX can be solved exactly by solving 2p convex Second-Order Cone Programs (SOCPs) [2], referred to as c-TREX. Alternatively, the convex subproblems in the c-TREX can also be solved with Douglas-Rachford proximal splitting [3]. The latter algorithm also allows solving sub-problems of the generalized TREX [3]:

where any q>1 can be chosen. Note that in the limit q=1, the TREX reduces to the Sqrt-Lasso [4].

The package includes all of the above algorithmic strategies in one framework. Theoretical bounds for the TREX prediction error are available in [5].

Package structure

The TREX package contains the following files and folders

  • examples/ (different scenarios), also includes figure creation for [2].
  • solvers/ (Schmidt's PSG code, place the ecos/SCS solver here (after download))
  • trex/ (TREX solvers (both single and multi-thread versions), TREX knockoff filter)
  • misc/ (additional files including barweb plotting and the knockoff filter (after download))


External solvers

Two solvers have been tested to solve the TREX problem in SOCP form.

  • ecos: Conic solver for the c-TREX. The software can be downloaded here. The MATLAB interface can be found here.

  • SCS: SOCP solver for the c-TREX. SCS can be downloaded here.

The solver packages should be compiled and placed in the solver/ folder.

Knockoff filter

Knockoff filtering with the TREX requires the MATLAB knockoff filter package by Barber-Foygel and Candes. The software can be downloaded here.

The deprecated link during initial development was here

Please place it in the misc/ folder

Other solvers

The proximal solvers from [1] and [3] are fully integrated and do not rely on external software.

Basic example

To include the package in your MATLAB environment, type first



The code builds on results from the following papers:


Known issues

Workaround for compiling SCS code using mex for Mac OS X with MATLAB 2015a and Xcode 7+


Tuning-free sparse variable selection with the TREX



No releases published


No packages published
You can’t perform that action at this time.