BUG: Fix scale attribute and resid_pearson for fixed scale cov_type (#8190)#9824
BUG: Fix scale attribute and resid_pearson for fixed scale cov_type (#8190)#9824shipitdev wants to merge 5 commits intostatsmodels:mainstatsmodels/statsmodels:mainfrom shipitdev:fix-8190-ols-fixed-scaleshipitdev/statsmodels:fix-8190-ols-fixed-scaleCopy head branch name to clipboard
Conversation
b00a965 to
3c7f8f8
Compare
|
There are soo many test failures 😿
|
Hi @Aniketsy, thanks so much for taking a look at this, especially since it's my very first contribution to the project! I noticed that massive failure count too and dug into the raw logs to see what went wrong. It looks like those 1,001 failures are solely due to the experimental pip-pre build environment check, after digging i found out it tests the unreleased development versions of upstream dependencies like NumPy and SciPy. The standard stable runtime environments and the codecov/path are currently passing cleanly for the core OLS/WLS scale handling changes. Since i am still learning the working behind statsmodels, please let me know if i've misinterpreted the logs or if there is anything else i Should adjust or re-run locally to make sure everything is in perfect shape |
hii @shipitdev i'd be happy to help you 😊 i'll look into this tommorrow , and try to figure out the root cause of these failures. also thanks for the contribution |
@shipitdev yes, these failures looks unrelated, maybe re-running ci should fix this.... @bashtage gentle ping, please let me know your thoughts on this |
|
Pip-pre is not required to pass. It is a canary build that help find upstream changes. |
|
Going to close and reopen to get a fresh CI run on this. |
|
Resolved a conflict which is enough to get a fresh CI. |
Remove reset_randomstate Avoid np.random.func to not change global state
Resolves #8190.
When cov_type='fixed scale' (or the 'fixed_scale' alias) is used, the scale attribute of the results object was not being updated, leading to incorrect calculations for resid_pearson and potentially other diagnostic statistics.
Changes
• Updated get_robustcov_results in linear_model.py to explicitly set res.scale = scale.
• Added a unit test test_ols_wls_fixed_scale in test_regression.py covering:
• fit() with cov_type='fixed scale' (OLS/WLS).
• fit() with cov_type='fixed_scale' (WLS alias).
• Direct construction via get_robustcov_results().
• Verification of scale attribute and resid_pearson calculations.
Testing
Verified using pytest locally. All assertions pass for both standard and robust covariance construction paths.