A Matlab Toolbox for Sparse Statistical Modeling


SpasSM is a Matlab toolbox for performing sparse regression, classification and principal component analysis. The toolbox has been developed at the Department of Informatics at the Technical University of Denmark. Development started in 2004 and the toolbox receives regular updates.

The code is well documented and consists of a series of pure Matlab functions. Examples, test cases and utility functions are also included. The algorithms are based on the regularization path-following paradigm developed mainly at Stanford University (see publication list below).

Sparse Discriminant Analysis
Sparse Principal Component Analysis
The Elastic Net


Download paper and code here. The paper was published in the journal of statistical software April 2018. All code to reproduce the figures in the paper is included.

Related Publications

SpaSM - A Matlab Toolbox for Sparse Statistical Modeling - Sjöstrand, Clemmensen, Larsen, Ersbøll. Journal of Statistical Software. Submitted.

Sparse Discriminant Analysis - Clemmensen, Hastie, Witten, Ersbøll. Technometrics. 53(4):406-413, 2011.

Least Angle Regression - Efron, Hastie, Johnstone, Tibshirani. Annals of Statistics 32(2):407–499, 2004.

Regression Shrinkage and Selection via the LASSO - Tibshirani. Journal of the Royal Statistical Society B. 58(1):267-288, 1996.

Regularization and Variable Selection via The Elastic Net - Zou, Hastie. Journal of the Royal Statistical Society B. 67(2):301-320, 2005.

Sparse principal component analysis - Zou, Hastie, Tibshirani. Journal of Computational and Graphical Statistics. 15(2):262-286, 2006.


Karl Sjöstrand - karl.sjostrand(at)
Bjarne Ersbøll - be(at)