Merged
Conversation
Implement complete Markov switching framework wrapping statsmodels: Models: - MarkovRegression, MarkovAR, MarkovADL with fit() -> Results pattern - from_model() class methods for one-way mapping from OLS/AR/ADL - markov_switching() convenience methods on existing model classes - Label switching resolution via ordering="first_appearance" (default) Restricted transitions: - RestrictedMarkovRegression/AR with constrained transition matrices - non_recurring() factory for Chib (1998) structural break structure - Override transform_params to enforce exact zeros in transition matrix Testing algorithms: - NonRecurringRegimeTest: LR test for non-recurring vs unrestricted - SequentialRestrictionTest: GETS-style algorithm for transition restrictions with Holm-Bonferroni correction and joint test safeguard - Chi-bar-squared and parametric bootstrap critical values Regime number selection: - RegimeNumberSelection with IC (AIC/BIC/HQIC) and sequential LRT methods Visualization: - plot_smoothed_probabilities, plot_regime_shading, plot_transition_matrix, plot_parameter_time_series, plot_ic Tests: 98 new tests (816 total), all passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Markov regime-switching models, restricted transitions, sequential restriction testing, regime number selection, and visualization functions to README.md, ROADMAP.md, and CHANGELOG.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Auto-fixed: unused imports (F401), f-strings without placeholders (F541), unsorted __all__ (RUF022). Manually fixed: unused local variables (F841), unused loop variables (B007), nested if statements (SIM102), unnecessary generator (C401), TYPE_CHECKING import placement (TC001/TC004). Applied ruff format for consistent formatting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
markov/subpackage with MarkovRegression, MarkovAR, and MarkovADL wrapping statsmodels' Markov switching implementationmarkov_switching()on OLS, AR, and ADL for one-way mapping to MS modelsArchitecture
No overlap with PR #4 (Bai-Perron fixes) — these can merge in either order.
Test plan
tests/test_markov/,tests/test_visualization/test_markov_viz.py)import regimes as rg🤖 Generated with Claude Code