Skip to content

BUG: Handle negative axes in powerdiscrepancy - #11305

Open
xihaian251 wants to merge 1 commit into
statsmodels:mainfrom
xihaian251:sprint3-final/C
Open

xihaian251 wants to merge 1 commit into
statsmodels:mainfrom
xihaian251:sprint3-final/C

Conversation

@xihaian251

Copy link
Copy Markdown
Contributor

Problem

  • NumPy reductions recognize negative axes, but subsequent broadcasting logic checks positive axis indices.
  • Equivalent positive and negative axes may therefore produce inconsistent results or exceptions.

Changes

  • Normalize valid negative axes before axis-dependent calculations.
  • Preserve rejection of out-of-range axes.
  • Leave existing zero-count behavior unchanged.

Validation

  • Positive and negative axis equivalence.
  • Non-square arrays, single-row and single-column inputs.
  • Multiple power-divergence parameters and degrees-of-freedom adjustments.
  • Independent Cressie–Read reference calculations.
  • test_gof.py: 67 passed.

AI Disclosure

Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the <...> placeholders in the second option with the tool name(s) and how the tool's output was used.

  • No AI tools were used to develop this pull request.
  • AI tools were used. Tool(s): WorkBuddy, Wolfram. Used for: implementation, regression testing, debugging and independent validation (WorkBuddy); independent mathematical and numerical cross-checks (Wolfram). I have personally read, understood, and can explain every line of this diff, and have verified the statistical/numerical correctness of the change.

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