Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MAINT: Cleanup dead code, address FIXMEs, and fix Kalman filter prediction corner case #9740 #9741

Open
un1u3 wants to merge 1 commit intostatsmodels:mainfrom
un1u3:statsmodels-cleanup-and-fixes
Open

MAINT: Cleanup dead code, address FIXMEs, and fix Kalman filter prediction corner case #9740 #9741
un1u3 wants to merge 1 commit intostatsmodels:mainfrom
un1u3:statsmodels-cleanup-and-fixes

Conversation

@un1u3
Copy link
Contributor

@un1u3 un1u3 commented Jan 13, 2026

PR for Issue #9740

This PR performs a broad cleanup of the statsmodels codebase to improve maintainability and addresses a specific corner case in Kalman filter predictions. Key changes include removing dead code, implementing missing convergence warnings, and refining diffuse initialization logic.

Detailed Changes

1. Bug Fixes & Improvements

  • Kalman Filter (kalman_filter.py): Fixed a corner case where dynamic/out-of-sample predictions were incorrectly initialized if the filter hadn't exited the diffuse phase. Now uses Initialization.from_components with the diffuse covariance when predicted_diffuse_state_cov is non-zero.
  • SARIMA Warnings (innovations.py): Added ConvergenceWarning to innovations_mle when the nonlinear optimizer fails (success=False).

2. Dead Code Removal (Library)

  • regressionplots.py: Removed internal helper _partial_regression which was unused and redundant.

3. Test Suite Cleanup

  • test_glm.py: Removed extensive commented-out test blocks relying on obsolete rpy2 infrastructure.
  • test_regression.py: Removed multiple unused check_confidenceintervals methods and associated FIXME comments.
  • test_var.py: Removed the unused CheckVAR class and broken generate_var functions.
  • test_data.py: Removed the commented-out TestDates class.

4. Documentation & Annotation

  • kernels.py: Removed a stale FIXME in aitchison_aitken_cdf. The logic was verified to be correct for joint CDF definitions of encoded discrete variables.

Verification Plan

  • Manual Inspection: Verified that all removed code has no callers in the current repository.
  • State Space Logic: Verified that predict now correctly passes Pinf when initializing the forecast model during the diffuse phase.
  • Local Testing: Individual syntax and logic checks were performed; full test suite execution was limited due to environment/versioning constraints with pytest.

@un1u3
Copy link
Contributor Author

un1u3 commented Jan 22, 2026

@bashtage any updates on this PR

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.

1 participant