Repository navigation
Conversation
- The degrees of freedom assumed every initial state has transitions in every stratum and reaches every terminal state. Count them per initial state as (s_i - 1)(c_i - 1) over the non-empty strata and terminal states instead, matching the conditional G-tests the statistic sums. For the Kullback (1962) example this gives 29: nothing moves from state 3 to state 0. - Convert F with np.asarray so nested lists work. - Remove the unused T6 term. Fixes pysal#265
This branch has not been deployed
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.
Fixes #265, with the approach suggested there for each point.
cdofis now the sum over initial states of(s_i - 1)(c_i - 1), wheres_icounts the strata with transitions from stateiandc_ithe terminal states reached from it (each factor floored at 0). That is the dof of the per-initial-state conditional G-tests the statistic already sums. Without empty margins it equalsr(s-1)(r-1)as before.test___init__and added a comment. The p-value there is still 0.0.F = np.asarray(F)at the top, so nested lists work.T6was unused, so I removed it.Tests (in
TestKullback):test_dof_with_empty_marginscompares the statistic and dof withchi2_contingencyon each initial state's strata x terminal-state table, after dropping empty rows and columns. This is the dof check the issue asked to add next totest_matches_conditional_g.test_list_inputBoth fail on
main(dof 6 instead of 3;TypeErrorfor the list) and pass with the change. The full test suite and themarkov.pydoctests pass, andruff check/ruff format --checkare clean.