Add ergodic chain summaries: sojourn_time(), first_passage(), mobility_index() - #2
Merged
Conversation
Ergodic chain summaries computed from grd_markov objects or raw transition probability matrices: - sojourn_time(): expected consecutive periods per class, 1/(1 - p_ii) - first_passage(): Kemeny-Snell mean first-passage times - mobility_index(): Prais-Shorrocks, determinant, Sommers-Conlisk eigenvalue, and Bartholomew mobility indices (Formby et al. 2004) All three match PySAL giddy (ergodic.mfpt, markov.sojourn_time, mobility.markov_mobility) exactly on the usjoin classic Markov matrix; fixtures generated by tools/oracle/pysal_giddy_oracle.py with giddy 2.3.9 and compared in the dev-only oracle test file. Shipped tests cover closed forms, invariants, and error paths. Co-Authored-By: Claude Fable 5 <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.
First tranche of the 0.2.0 feature work: scalar and matrix summaries derived from transition probability matrices, extending the family
steady_state()started.New functions
sojourn_time()— expected consecutive periods in each class,1/(1 - p_ii);Inffor absorbing classesfirst_passage()— Kemeny–Snell mean first-passage times; diagonal is mean recurrence time1/π; rejects non-ergodic chains with an informative errormobility_index()— Prais–Shorrocks trace, determinant, Sommers–Conlisk eigenvalue, and both Bartholomew indices (Formby, Smith & Zheng 2004)All are generics with
grd_markovand default (matrix/table) methods, so they work both on fitted objects and ontransition_matrix()output (including per-lag-class spatial matrices).Validation
ergodic.mfpt,markov.sojourn_time,mobility.markov_mobility) on the usjoin classic Markov matrix; fixtures generated by the extendedtools/oracle/pysal_giddy_oracle.py(existing fixtures regenerated byte-identical)devtools::check(): 0 errors, 0 warnings, 0 notes🤖 Generated with Claude Code