- Introduced by
- Tibshirani, R.
- Year
- 1996
- Type
- Regularized linear regression (L1 penalty)
What does it do?
Lasso regression, introduced by Robert Tibshirani in 1996, is a linear regression method that adds an L1 penalty (the sum of the absolute values of the coefficients) to the least-squares loss.
The penalty shrinks coefficients and can set some of them exactly to zero, so fitting and variable selection happen together and the result is a sparse model.
The intuition behind the method
Ordinary least squares gives every predictor a coefficient and can spread weight across many correlated or irrelevant variables, which makes the estimates unstable and hard to interpret. Lasso limits the total absolute size of the coefficients; as the limit tightens, weak predictors are pushed to exactly zero and drop out of the model. What remains is a smaller set of variables with more stable estimates. Tibshirani's abstract describes the same idea as minimising the residual sum of squares subject to a bound on the sum of the absolute values of the coefficients.
History
Robert Tibshirani introduced the lasso in 1996 as a constrained least-squares method. It minimises the residual sum of squares subject to a bound on the sum of the absolute values of the coefficients, and this constraint tends to produce coefficients that are exactly zero. In simulation studies, Tibshirani found that the lasso shares some favourable properties of both subset selection and ridge regression: it produces interpretable models like subset selection while exhibiting the stability of ridge regression. The paper also notes that the idea extends to generalized regression models and tree-based models.
When to use it
Choose lasso when the goal is prediction or a sparse, interpretable linear model from many candidate predictors, especially when predictors are correlated and you want the fit itself to choose among them. It assumes a roughly linear relationship between the predictors and the outcome. On small samples the selected variables can be unstable, so compare lasso with ridge regression using cross-validated error and check how stable the selected set is before relying on it. When predictors outnumber observations, the selected set can also be unstable, and elastic net is a related penalised alternative that can be considered. If the aim is valid inference on individual coefficients, the selected set should not be treated as if it had been chosen in advance.
Limitations and considerations
- Assumes a roughly linear relationship between predictors and outcome; the cited paper's basic setting is the linear model.
- The penalty depends on coefficient scale, so unstandardised features are penalised unevenly.
- On small samples the selected variables can be unstable, so the selection should be checked for stability before it is relied on.
- With more predictors than observations the selected set can be unstable, and elastic net is a related penalised alternative for this setting.
- The coefficients are shrunk, so they are biased estimates of effect sizes, and standard errors from an ordinary regression refitted on the selected variables do not account for the selection step.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Performs coefficient shrinkage and variable selection in a single fit, giving a sparse model.
- Sets weak predictors exactly to zero, which simplifies the model and can reduce overfitting.
- Gives a principled way to choose among correlated predictors, where ordinary least squares would spread weight across them.
- The estimator itself does not require normally distributed errors. Standard errors and p-values for the selected coefficients rely on further assumptions and do not, in the usual form, account for the selection step.
- Has one main tuning parameter, lambda, which can be set by cross-validation.
Applications
- Building sparse, interpretable prediction models from many candidate predictors.
- Selecting a subset of correlated predictors when the fit itself should choose among them.
- High-dimensional problems where only some features are expected to matter.
- A regularised baseline before trying elastic net or more complex models.
How it works
How it works
Lasso minimises the usual sum of squared residuals plus a penalty equal to lambda times the sum of the absolute values of the coefficients. This L1 penalty is the defining feature: the larger lambda is, the more the coefficients are pulled toward zero.
Formula
\min_{\beta} \; \|y - X\beta\|_2^2 + \lambda \sum_j |\beta_j|The L1 penalty has corners at zero, so in the solution many coefficients are set exactly to zero rather than merely made small. Variables with zero coefficients are dropped, so fitting and variable selection happen in one step and the final model is sparse.
Lambda sets the trade-off between fit and sparsity and is usually chosen by cross-validation: a range of values is tried and the one with the lowest cross-validated mean squared error is kept. Because one penalty applies to all coefficients, the predictors should be standardised first so that a variable is not penalised more heavily only because of its units. Coefficients estimated on standardised predictors are on that standardised scale, so they should be converted back to the original units before effect sizes are interpreted.
Common pitfalls
- Fitting lasso without standardising the features, so the penalty depends on the units of each predictor.
- Choosing lambda by hand rather than by cross-validation.
- Trusting the selected variables on a very small sample, where the selection is unstable.
- Reading p-values from an ordinary regression refitted on the lasso-selected variables as if the selection had not taken place.
- Treating residual diagnostics as a check on variable selection: residual plots for normality and homogeneity assess the linear fit and do not show whether the right variables were kept.
Frequently asked questions
How is lambda chosen?
Lambda controls how strongly coefficients are penalised. It is selected by cross-validation: a range of values is tried and the one minimising the cross-validated mean squared error is kept.
Why must I standardise the features?
The single L1 penalty applies equally to every coefficient, so predictors measured on larger scales would otherwise be penalised less. Standardising the features first makes the penalty fair across variables.
How does Lasso differ from ridge regression?
Lasso uses an L1 penalty that can set coefficients exactly to zero, performing variable selection, while ridge uses an L2 penalty that shrinks coefficients but does not zero them out. On small samples or when the selected set is unstable, compare the two methods by cross-validated error before relying on the lasso selection.
What should I check after fitting?
Inspect the cross-validation error curve to confirm the chosen lambda, and review which variables were kept and which were set to zero. Residual plots can check the linear fit for normality and homogeneity, but they do not show whether the selection was correct; the stability of the selected set on resampled or new data is the more relevant check.
Related methods
Sources
Tibshirani, R. (1996). Regression Shrinkage and Selection via the Lasso. Journal of the Royal Statistical Society: Series B, 58(1), 267–288.
Open DOI reference