Skip to content

docs(stats): clarify TukeyHSD reject and pvalues access - #9956

Merged
bashtage merged 3 commits into
statsmodels:mainfrom
Solaris-star:docs/2346-tukey-reject-pvalues
Aug 13, 2026
Merged

bashtage merged 3 commits into
statsmodels:mainfrom
Solaris-star:docs/2346-tukey-reject-pvalues

Conversation

@Solaris-star

@Solaris-star Solaris-star commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

#2346 asks how to retrieve Tukey HSD reject decisions and numeric p-values. These already exist on TukeyHSDResults (reject, pvalues, summary(), summary_frame()), but the public wrapper docstring did not spell out the access path.

Fix

Document attribute / table access on pairwise_tukeyhsd and clarify that pvalues are the numeric adjusted p-values.

Verification

  • The requested RST change was moved into the Notes section as an unordered list.
  • A concrete Examples section accesses reject and rounded pvalues.
  • The docstring doctest passes locally.
  • git diff --check passes.
  • The tracked-content secret scan reports no new findings versus upstream/main.

Fixes #2346

AI Disclosure

Contributions must comply with the statsmodels AI Policy.

If using AI tools, edit the second option to explain which tool was selected and
how the tool's output was used.

Please complete one of the following:

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Hermes Agent.
    Used for: investigating maintainer feedback, editing docstrings, running verification commands, and preparing signed commits.
    I have personally read, understood, and can explain every line of this diff, and
    have verified the statistical/numerical correctness of the change.
Details

Notes:

  • It is essential that you add a test when making code changes. Tests are not
    needed for doc changes.
  • When adding a new function, test values should usually be verified in another package (e.g., R/SAS/Stata).
  • When fixing a bug, you must add a test that would produce the bug in main and
    then show that it is fixed with the new code.
  • New code additions must be well formatted. Changes should pass flake8. If on Linux or OSX, you can
    verify you changes are well formatted by running
    git diff upstream/main -u -- "*.py" | flake8 --diff --isolated
    
    assuming flake8 is installed. This command is also available on Windows
    using the Windows System for Linux once flake8 is installed in the
    local Linux environment. While passing this test is not required, it is good practice and it help
    improve code quality in statsmodels.
  • Docstring additions must render correctly, including escapes and LaTeX.
  • If AI tools were used to help write this PR, see the
    AI Policy for what
    disclosure and review is expected of you before submitting.

@bashtage bashtage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to ensure that the RST is valid

Comment thread statsmodels/stats/multicomp.py Outdated
calculations, including adjusted p-value
calculations, including adjusted p-value.

The boolean reject decisions and numeric adjusted p-values are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check that this is valid RST? I don't think this is. Perhaps use an unordered list?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, could you move the attributes to the notes section as an unordered list and then add an example using an example section where you access the attributes.

Comment thread statsmodels/stats/multicomp.py Outdated
calculations, including adjusted p-value
calculations, including adjusted p-value.

The boolean reject decisions and numeric adjusted p-values are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, could you move the attributes to the notes section as an unordered list and then add an example using an example section where you access the attributes.

@Solaris-star

Copy link
Copy Markdown
Contributor Author

Addressed the RST feedback in eb9ca116c: moved the result attributes/methods into Notes as an unordered list and added a concrete Examples section that accesses both reject and pvalues. The doctest passes, and the project validator no longer reports section-order or example failures for this docstring.

Document that pairwise_tukeyhsd results expose boolean `reject` and
numeric adjusted `pvalues`, plus `summary()` / `summary_frame()` for
tabular access (#2346).

Fixes #2346

Signed-off-by: Solaris-star <[email protected]>
@Solaris-star
Solaris-star force-pushed the docs/2346-tukey-reject-pvalues branch from eb9ca11 to adcca2b Compare August 12, 2026 22:45
@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Thanks, the AI Disclosure section looks complete.

@bashtage bashtage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the doc fixes. Could I kindly ask you to fix the docstring a bit more?

Comment thread statsmodels/sandbox/stats/multicomp.py Outdated
q_crit : critical value of studentized range statistic at given alpha
halfwidths : half widths of simultaneous confidence interval
pvalues : adjusted p-values from the HSD test
pvalues : adjusted p-values from the HSD test (numeric floats; use this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc string overall needs a lot fo work. The correct style is

attribute : type
    Description

For example

reject : array
    A boolean array that is True if we reject Null for group pair

Could you have a pass at all attributes?

Comment thread statsmodels/stats/multicomp.py Resolved
Address review feedback: expand all 18 attributes with proper
numpy docstring format (name : type + description) and add
short descriptions under each See Also reference.

Closes GH-2346

Signed-off-by: Solaris-star <[email protected]>
@Solaris-star

Copy link
Copy Markdown
Contributor Author

已更新 468fe4a6:

  1. TukeyHSDResults 属性:全部 18 个属性改为 numpy 标准格式,包含类型和描述
  2. See Also:每个参考项加了简短描述

CI 正在重新运行,等待完成。

@bashtage

Copy link
Copy Markdown
Member

We mostly ask for English in comments if that is ok.

@Solaris-star

Copy link
Copy Markdown
Contributor Author

Thanks — English is fine.

I updated the current head 468fe4a6630e31b93de8b0dfb059ef70fa6a2387 with the requested docstring refinements. The latest GitHub validation is green: Generate Documentation, CodeQL, ruff/flake8, Pyodide, both Python 3.14 wheel builds, Codecov, and the statsmodels Azure check all pass. The AI disclosure check also passes.

I have not claimed a local full-suite run; the remaining blocker is your review of the final docstring wording.

@bashtage
bashtage merged commit b40c7ae into statsmodels:main Aug 13, 2026
12 checks passed
@bashtage

bashtage commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Thanks

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.

pairwise_tukeyhsd - retrieve "reject" values

2 participants