Skip to content

BUG: Decode group labels in runstest_2samp - #11301

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

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

Conversation

@xihaian251

Copy link
Copy Markdown
Contributor

Problem

  • Arbitrary group labels incorrectly passed to Runs, which internally expects binary labels.
  • Non-binary numeric labels, string labels and Python lists may produce incorrect results or exceptions.

Changes

  • Convert group labels to NumPy arrays.
  • Map the two unique labels to internal codes 0 and 1.
  • Apply consistent encoding to both tied and untied observations.

Validation

  • Numeric, negative, string and swapped group labels.
  • Equivalence between grouped and two-sample inputs.
  • Independent Wald–Wolfowitz reference calculation.
  • test_runs.py: 30 passed, 2 pre-existing xfailed.

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