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

Elastic Net Model

Regularized regression that blends LASSO selection with ridge shrinkage for correlated predictor blocks.

OverviewGraphMathReferences

Graph workspace

Elastic net regularization path (coefficient traces vs. λ)

Graph workspace

The regularization path plotting coefficients against log-λ\lambdaλ is the canonical elastic net visual. It reveals grouped selection directly: correlated predictors enter and exit together, with their paths running in parallel, unlike LASSO paths where one member of a correlated pair jumps while the other stays flat. The path also shows how the L2 penalty smooths the piecewise-linear kinks of the LASSO path.

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
Signal-block coefficients as the
penalty is relaxed (strongest at the
left) static chart preview showing Signal coefficient 1, Signal coefficient 2, Signal coefficient 3, Signal coefficient 4, A coefficient with no signal
Coefficients at the chosen penalty, by
block 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}(\alpha, \lambda_{1\text{SE}})|∣A(α,λ1SE​)∣

Total count of nonzero coefficients at the penalty chosen on the held-out last third of the sample by the one-standard-error rule. Compare against true active count (8 in the seed) to assess selection accuracy.

10.00

count

Block recovery rate

Explain: Block recovery rate
(blocks with at least one selected member)/(true active blocks)\text{(blocks with at least one selected member)} / \text{(true active blocks)}(blocks with at least one selected member)/(true active blocks)

Fraction of true predictor blocks where at least one member is retained. Measures grouped detection. Ideally 1.0 for the two active blocks.

1.00

proportion

Within-block coefficient spread

Explain: Within-block coefficient spread
max⁡j,k∈G∣β^j−β^k∣\max_{j,k \in G} |\hat{\beta}_j - \hat{\beta}_k|maxj,k∈G​∣β^​j​−β^​k​∣

Maximum absolute difference in coefficients within the first (stronger) signal block. Smaller spread means the grouped selection property is working. It tends to fall as α\alphaα falls: on the default sample from about 0.32 at α=0.8\alpha = 0.8α=0.8 to 0.23 at 0.05, and at the presets' 120 observations from about 0.65 at α=0.95\alpha = 0.95α=0.95 to 0.34 at 0.5.

0.3027

standardized units

Prediction MSE

Explain: Prediction MSE
nval−1∥yval−Xvalβ^EN∥22n_{\text{val}}^{-1}\|y_{\text{val}} - X_{\text{val}}\hat{\beta}_{\text{EN}}\|_2^2nval−1​∥yval​−Xval​β^​EN​∥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.55

squared units

Controls

balanced mix
Explain: Drop variables or keep groups

L1/L2 mixing: 0.5

How much of the penalty drops variables outright rather than selecting them in groups.

At α\alphaα near 1, paths are piecewise linear with sharp entry points. As α\alphaα decreases, paths smooth out and correlated predictors enter together as parallel traces.

groups closely alike
Explain: How alike grouped variables are

Within-block correlation: 0.8

How closely variables in the same group move together, which sets how strongly groups are picked together.

High ρw\rho_wρw​ makes within-block paths nearly identical (tight parallel bundle). Low ρw\rho_wρw​ makes each predictor's path independent, resembling standard LASSO.

1
Explain: How noisy the data is

Spread of the random errors; more noise raises the chosen penalty.

More noise pushes the one-standard-error choice toward higher λ\lambdaλ. On this sample both signal blocks survive selection at every noise level on the slider; what grows is the held-out prediction error.

100
Explain: How much data you have

Number of observations; more data allows a lighter penalty and better recovery of the true groups.

More data tends to shift the one-standard-error choice toward lower λ\lambdaλ and bring the active set closer to the true block structure. On this one fixed sample the count of selected variables jumps around as nnn changes, because each nnn draws different data: at the defaults it runs from 8 to 24.

1.5
Explain: Size of the true effects

Size of the largest true effect, applied equally across each active group.

Stronger signals separate from zero at higher λ\lambdaλ. The gap between active-block paths and zero-block paths becomes wider.

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