Skip to main content

Cookies on Macro by Mark.We use essential cookies for sign-in, locale, and security. With your permission, we also use optional cookies for preferences, for analytics, and for advertising measurement with the Meta (Facebook) Pixel. Read our cookie policy.

Macro by MarkMacro by Mark
  • Home
Loading…
Loading…
← Models
MacroConceptsPolicyModels

LASSO Model

L1-penalized linear regression - drives some coefficients to zero, doing variable selection inside the fit.

OverviewGraphMathReferences

Graph workspace

LASSO regularization path with variable entry markers

Graph workspace

The LASSO path - coefficients plotted against the penalty λ\lambdaλ (or the L1 norm of the coefficient vector) - is the canonical visualization. Unlike ridge's smooth traces, LASSO paths are piecewise linear with sharp kinks where variables enter or leave the active set. The path reveals both the order in which variables become important and their relative magnitudes after selection.

Chart axis metadata
xPenalty step: 0 is the strongest penalty, each step to the right relaxes it, 11 is a thousandth of itstep on a 12-point log grid of the penalty · 0 to 11yCoefficient valuestandardized units · -3.0 to 3.0
Coefficient paths as the lasso penalty
is relaxed (strongest at the left) static chart preview showing Coefficient 1, Coefficient 2, Coefficient 3, Coefficient 4, Coefficient 5
Selected coefficients at the chosen
penalty static chart preview showing Series 1
xPenalty step: 0 is the strongest penalty, each step to the right relaxes it, 11 is a thousandth of itstep on a 12-point log grid of the penalty · 0 to 11yCoefficient valuestandardized units · -3.0 to 3.0

Current results

Variables selected at the 1-SE penalty

Explain: Variables selected at the 1-SE penalty
∣A(λ1SE)∣|\mathcal{A}(\lambda_{1\text{SE}})|∣A(λ1SE​)∣

Number of nonzero coefficients at the penalty chosen on the held-out last third of the sample by the one-standard-error rule (the largest penalty whose validation error is within one standard error of the best). Compare to the true sparsity sss to assess selection accuracy.

6.00

count

True positive rate

Explain: True positive rate
∣A(λ1SE)∩supp(β0)∣  /  s|\mathcal{A}(\lambda_{1\text{SE}}) \cap \text{supp}(\beta_0)| \;/\; s∣A(λ1SE​)∩supp(β0​)∣/s

Fraction of truly active variables that LASSO correctly identifies. Ideally 1.0.

1.00

proportion

False discovery rate

Explain: False discovery rate
∣A(λ1SE)∖supp(β0)∣  /  ∣A(λ1SE)∣|\mathcal{A}(\lambda_{1\text{SE}}) \setminus \text{supp}(\beta_0)| \;/\; |\mathcal{A}(\lambda_{1\text{SE}})|∣A(λ1SE​)∖supp(β0​)∣/∣A(λ1SE​)∣

Fraction of selected variables that are actually irrelevant. Lower is better.

0.5000

proportion

Prediction MSE

Explain: Prediction MSE
nval−1∥yval−Xvalβ^LASSO∥22n_{\text{val}}^{-1}\|y_{\text{val}} - X_{\text{val}}\hat{\beta}_{\text{LASSO}}\|_2^2nval−1​∥yval​−Xval​β^​LASSO​∥22​

Mean squared prediction error on the held-out last third of the sample, against the observed outcome, at the chosen penalty. The noise variance σ2\sigma^2σ2 is its floor, and it is measured on the same split that chose the penalty, so it is slightly optimistic.

1.73

squared units

Controls

3
Explain: How many predictors really matter

How many predictors truly affect the outcome; the rest have no real effect.

More active variables produce more paths that separate from zero as λ\lambdaλ decreases. Fewer active variables leave most paths flat at zero.

predictors partly related
Explain: How alike the predictors are

Predictor correlation: 0.3

How closely the predictors move together; the more alike they are, the shakier the variable picks.

High ρ\rhoρ makes paths wobble and cross. Variables may enter and leave the active set as λ\lambdaλ decreases, visible as paths touching zero then rebounding.

1
Explain: How noisy the data is

How much random error the data carries; more noise raises the chosen penalty.

Higher σ\sigmaσ moves the one-standard-error choice toward the stronger penalties at the left of the path panel. On this one fixed sample the count of selected variables does not fall steadily with σ\sigmaσ: noise also lets spurious predictors in.

100
Explain: How many data points

How many observations the model sees; more data helps it find the variables that truly matter.

More data tends to lower the penalty needed and bring the active set closer to the true sparsity. On this one fixed sample the count of selected variables jumps around as n changes, because each n draws different data: at the defaults it runs from 3 to 14.

2
Explain: Size of the strongest effect

How large the biggest true effect is; stronger effects are easier to detect.

Larger signals make the active-variable paths separate from zero earlier (at higher λ\lambdaλ). The gap between true and spurious paths becomes clearer.

Keep going

Read next

Continue with a related concept, model, or example.

Theory model

IS-LM Model

a well-connected theoretical model two steps from here

New angle: theoretical model →
Macro by Mark
Help
Privacy PolicyTerms of UseEthics and Compliance

© 2026 Mark Jayson Nation LLC