You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEAT] Apply the degree-of-freedom adjustment in BootstrapODPSample when the hat matrix is not used #1618
Follow-up to #1603 and #1616. With hat_adj=False, and when the hat matrix can't be computed, BootstrapODPSample resamples the unscaled Pearson residuals with no adjustment (L244–L247). The degree-of-freedom factor in fit was never applied (see the blame in #1603) and is commented out (L225–L229).
Shapland and Leong ("Bootstrap Modeling: Beyond the Basics", CAS E-Forum, Fall 2010, pp. 13–14) give the factor as eq. (3.22), f = sqrt(N / (N − p)), with N residuals and p parameters. They note that England and Verrall (2002) multiply the Pearson residuals by it to correct for a bias, and that the hat matrix factor (3.24) replaces it, so the two are alternatives.
Is your feature request aligned with the scope of the package?
Yes, absolutely!
No, but it's still worth discussing.
N/A (this request is not a codebase enhancement).
Describe the solution you'd like, or your current workaround.
When hat_ is None, multiply the unscaled residuals by sqrt(N / (N − p)) before resampling, using the N and p that scale_ already uses (degree_freedom in _get_simulation). scale_ doesn't change; resampled_triangles_ changes for hat_adj=False and for the fallback, and the default path is untouched.
If you'd rather keep hat_adj=False unadjusted and add the factor as its own option, that works too.
Do you have any additional supporting notes?
Test: on genins (10 × 10), N = 55 and p = 19, so f = sqrt(55/36) = 1.2360. With the same random_state, each resampled incremental's distance from its fitted value is 1.2360 times what hat_adj=False gives today, because dropping zero residuals and centering them both commute with a constant factor.
Would you be willing to contribute this ticket?
Yes, absolutely!
Yes, but I would like some help.
No.
(This issue was written with Árbol, an AI assistant, under my direction.)
Activity