Repository navigation
Add homogeneity_test(): chi2, likelihood-ratio, and Kullback tests for transition regimes - #3
Merged
Merged
Conversation
Tests whether transition dynamics differ across regimes. For grd_spatial_markov objects this is the Rey, Kang & Wolf (2016) question: do the lag-conditioned matrices differ from the pooled matrix? Reports: - Pearson chi-squared Q and likelihood-ratio tests with the Bickenbach & Bald (2003) degrees-of-freedom adjustment - the Kullback, Kupperman & Ku (1962) information test Returns a tidy one-row-per-test tibble. A list method accepts arbitrary regime count matrices (e.g. LISA Markov quadrant regimes or time regimes), so the machinery is not tied to spatial conditioning. Validated against PySAL giddy 2.3.9: exact agreement with Spatial_Markov Q/LR/dof/p-values and giddy.markov.kullback() on the usjoin spatial count matrices (fixture generated by tools/oracle/pysal_giddy_inference.py), plus the published Kullback (1962) Table 9.2 example as a shipped reference test. 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.
Second tranche of the 0.2.0 feature work: the inference layer. This closes the biggest scoping caveat — griddy could show that lag-conditioned matrices differ but not test whether they differ beyond sampling noise.
New function
homogeneity_test(x)— generic with two methods:grd_spatial_markov: tests the Rey, Kang & Wolf (2016) question directly — do the transition matrices conditioned on spatial-lag class differ from the pooled matrix?Returns a tidy tibble with one row per test: Pearson chi-squared Q and likelihood-ratio (both with the Bickenbach & Bald 2003 degrees-of-freedom adjustment), and the Kullback, Kupperman & Ku (1962) information test.
On the bundled
usjoinpanel: Q = 200.6 (df 60), LR = 170.7 — spatial conditioning decisively matters, which is the headline number for the release post.Validation
Spatial_Markovhomogeneity attributes (Q, LR, dof, p-values) andgiddy.markov.kullback()on the usjoin spatial count matrices; fixture generated by the newtools/oracle/pysal_giddy_inference.py(kept separate from the existing oracle script to avoid cross-branch conflicts)devtools::check(): 0 errors, 0 warnings, 0 notesNote: branched off main independently of #2; both add a section under the same NEWS heading, so whichever merges second needs a trivial conflict resolution there.
🤖 Generated with Claude Code