Home  /  Products  /  Features  /  Lasso


With Stata's lasso and elastic net features, you can perform model selection and prediction for your continuous, binary, and count outcomes. Want to estimate effects and test coefficients? With cutting-edge inferential methods, you can make inferences for variables of interest while lassos select control variables for you. You can even account for endogenous covariates.

Learn about lasso in Stata.

Lasso for prediction and model selection

  • Lasso
  • Elastic net
  • Square-root lasso
  • Continuous, binary, count, and survival-time outcomes Updated
  • Clustered data

Lasso for inference

  • Effect estimates for covariates of interest
  • Coefficients, SEs, tests, confidence intervals
  • Robust and cluster–robust SEs
  • Lasso selects control variables
  • Robust to model-selection mistakes by lasso
  • Double selection
  • Partialing out
  • Cross-fit partialing out
  • Double machine learning (DML1 and DML2)
  • Linear, logit, and Poisson regression
  • Endogenous covariates in linear models
  • Causal inference/Treatment effects

Bayesian lasso

Data preparation

  • Divide data into random samples
  • Manage large lists of variables
    • Create names for referring to
      • All continuous variables
      • All categorical variables
      • Your own variable groupings

Selection methods

Evaluate selected model

  • Graphs
    • Cross-validation function plot
    • Coefficient paths
  • Goodness of fit
    • Mean squared error of prediction
    • In-sample and out-of-sample R-squareds
    • Deviance
    • In-sample and out-of-sample deviance ratios
    • BIC
    • Relative L1-norm of coefficients
    • Relative L2-norm squared of coefficients
  • Estimated coefficients
    • Penalized
    • Postselection


Additional resources

See New in Stata 18 to learn about what was added in Stata 18.