Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: Fix scale attribute and resid_pearson for fixed scale cov_type (#8190)#9824

Open
shipitdev wants to merge 5 commits into
statsmodels:mainstatsmodels/statsmodels:mainfrom
shipitdev:fix-8190-ols-fixed-scaleshipitdev/statsmodels:fix-8190-ols-fixed-scaleCopy head branch name to clipboard
Open

BUG: Fix scale attribute and resid_pearson for fixed scale cov_type (#8190)#9824
shipitdev wants to merge 5 commits into
statsmodels:mainstatsmodels/statsmodels:mainfrom
shipitdev:fix-8190-ols-fixed-scaleshipitdev/statsmodels:fix-8190-ols-fixed-scaleCopy head branch name to clipboard

Conversation

@shipitdev

Copy link
Copy Markdown
Contributor

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.

@shipitdev
shipitdev force-pushed the fix-8190-ols-fixed-scale branch from b00a965 to 3c7f8f8 Compare June 8, 2026 08:27
@Aniketsy

Aniketsy commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

There are soo many test failures 😿

= 1001 failed, 18473 passed, 437 skipped, 142 xfailed, 3895 warnings, 55 errors in 857.45s (0

@shipitdev

Copy link
Copy Markdown
Contributor Author

There are soo many test failures 😿

= 1001 failed, 18473 passed, 437 skipped, 142 xfailed, 3895 warnings, 55 errors in 857.45s (0

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

@Aniketsy

Aniketsy commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

There are soo many test failures 😿
= 1001 failed, 18473 passed, 437 skipped, 142 xfailed, 3895 warnings, 55 errors in 857.45s (0

Hi @Aniketsy, thanks so much for taking a look at this, especially since it's my very first contribution to the project!

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

@Aniketsy

Copy link
Copy Markdown
Contributor

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

@shipitdev yes, these failures looks unrelated, maybe re-running ci should fix this.... @bashtage gentle ping, please let me know your thoughts on this

@bashtage

Copy link
Copy Markdown
Member

Pip-pre is not required to pass. It is a canary build that help find upstream changes.

Comment thread statsmodels/regression/linear_model.py
@bashtage

Copy link
Copy Markdown
Member

Going to close and reopen to get a fresh CI run on this.

@bashtage

Copy link
Copy Markdown
Member

Resolved a conflict which is enough to get a fresh CI.

Remove reset_randomstate
Avoid np.random.func to not change global state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: OLS, WLS, fixed scale cov_type does not change scale attribute, wrong resid_pearson

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.