|
1 | | -% Empirical Bayes Penalized Regression for univariate or multivariate outcomes, |
2 | | -% with shrinkage tuned to minimize prediction error by .632 bootstrap-based ML. |
| 1 | +% Empirical Bayes penalized regression for univariate or multivariate outcomes, |
| 2 | +% with shrinkage tuned to minimize prediction error by .632 bootstrap. |
3 | 3 | % |
4 | 4 | % -- Function File: bootridge (Y, X) |
5 | 5 | % -- Function File: bootridge (Y, X, CATEGOR) |
|
119 | 119 | % |
120 | 120 | % 'bootridge (Y, X, CATEGOR, NBOOT, ALPHA, L, DEFF, SEED, TOL)' controls |
121 | 121 | % the convergence tolerance for optimizing the ridge tuning constant lambda |
122 | | -% on the log10 scale. The search terminates when the width of the current |
123 | | -% bracket satisfies |
| 122 | +% on the log10 scale. Hyperparameter optimization terminates when the width |
| 123 | +% of the current bracket satisfies: |
124 | 124 | % |
125 | | -% log10(lambda_high) - log10(lambda_low) <= TOL. |
| 125 | +% log10(lambda_high) − log10(lambda_low) < TOL. |
126 | 126 | % |
127 | | -% Thus, TOL determines the relative precision of lambda. The default value |
128 | | -% TOL = 0.005 corresponds to approximately a 1% change in lambda (since |
129 | | -% 10^0.005 ≈ 1.01), which is typically well below the Monte Carlo noise of |
130 | | -% the .632 bootstrap estimate of prediction error. |
| 127 | +% Thus, TOL determines the relative (multiplicative) precision of lambda. |
| 128 | +% The default value TOL = 0.005 corresponds to approximately a 1% change in |
| 129 | +% lambda, which is typically well below the Monte Carlo noise of the .632 |
| 130 | +% bootstrap estimate of prediction error. |
131 | 131 | % |
132 | 132 | % * If sufficient parallel resources are available (four or more workers), |
133 | | -% the optimization uses a parallel k-section search; otherwise, a serial |
134 | | -% golden-section search is used. The tolerance TOL applies identically |
| 133 | +% the optimization uses a parallel k‑section search; otherwise, a serial |
| 134 | +% golden‑section search is used. The tolerance TOL applies identically |
135 | 135 | % in both cases. |
136 | 136 | % |
137 | 137 | % 'S = bootridge (Y, X, ...)' returns a structure containing posterior |
|
254 | 254 | % associated with classical post-hoc adjustments [6, 7]. |
255 | 255 | % |
256 | 256 | % PREDICTIVE OPTIMIZATION: |
257 | | -% The ridge tuning constant is selected empirically by minimizing the .632 |
258 | | -% bootstrap estimate of prediction error [1, 2]. This aligns lambda with |
259 | | -% minimum estimated out‑of‑sample mean squared prediction error (a Gaussian |
260 | | -% surrogate for Kullback–Leibler predictive risk), ensuring the model is |
261 | | -% optimized for generalizability rather than mere in-sample fit [8–10]. |
262 | | -% This lambda in turn determines the scale of the Normal ridge prior used |
263 | | -% to shrink slope coefficients toward zero [11]. |
| 257 | +% The ridge tuning constant (hyperparameter) is selected empirically by |
| 258 | +% minimizing the .632 bootstrap estimate of prediction error [1, 2]. This |
| 259 | +% aligns lambda with minimum estimated out‑of‑sample mean squared |
| 260 | +% prediction error, ensuring the model is optimized for generalizability |
| 261 | +% rather than mere in-sample fit [8–10]. This lambda in turn determines the |
| 262 | +% scale of the Normal ridge prior used to shrink slope coefficients toward |
| 263 | +% zero [11]. |
264 | 264 | % |
265 | 265 | % CONDITIONAL VS MARGINAL PRIORS: |
266 | 266 | % The ridge penalty (lambda) corresponds to a Normal prior on the |
|
1245 | 1245 | %! % Or we can get a obtain the design effect empirically using resampling. |
1246 | 1246 | %! % We already fit the model accounting for clustering, now lets fit it |
1247 | 1247 | %! % under I.I.D. (i.e. without clustering) |
1248 | | -%! % Fit model with resampling under I.I.D. |
1249 | 1248 | %! [STATS_SRS, BOOTSTAT_SRS] = bootlm (data, {group}, 'seed', 1, 'display', ... |
1250 | 1249 | %! 'off', 'contrasts', 'helmert', 'method', 'bayes', 'dim', 1, ... |
1251 | 1250 | %! 'posthoc', 'trt_vs_ctrl'); |
|
0 commit comments