Skip to content

feat(proportion.independent.ci): add more solvers and algorithms#394

Open
Snoopy1866 wants to merge 8 commits into
mainfrom
feat-proportion-independent-ci-add-solvers
Open

feat(proportion.independent.ci): add more solvers and algorithms#394
Snoopy1866 wants to merge 8 commits into
mainfrom
feat-proportion-independent-ci-add-solvers

Conversation

@Snoopy1866

@Snoopy1866 Snoopy1866 commented Jun 8, 2026

Copy link
Copy Markdown
Owner

新增下列置信区间算法:

  • newcombe_wilson
  • newcombe_wilson_cc
  • farrington_manning
  • miettinen_nurminen

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests labels Jun 8, 2026
@read-the-docs-community

read-the-docs-community Bot commented Jun 8, 2026

Copy link
Copy Markdown

Documentation build overview

📚 pystatpower | 🛠️ Build #33051480 | 📁 Comparing 023b76f against latest (2d848bb)

  🔍 Preview build  

2 files changed
± api/proportion/independent/ci/index.html
± models/proportion/independent/ci/index.html

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2d848bb) to head (023b76f).

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #394    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           25        25            
  Lines         1363      1573   +210     
==========================================
+ Hits          1363      1573   +210     
Flag Coverage Δ
test-core-macos-latest-py3.10 100.00% <100.00%> (?)
test-core-macos-latest-py3.11 100.00% <100.00%> (?)
test-core-macos-latest-py3.12 100.00% <100.00%> (?)
test-core-macos-latest-py3.13 100.00% <100.00%> (?)
test-core-macos-latest-py3.14 100.00% <100.00%> (?)
test-core-ubuntu-latest-py3.10 100.00% <100.00%> (?)
test-core-ubuntu-latest-py3.11 100.00% <100.00%> (?)
test-core-ubuntu-latest-py3.12 100.00% <100.00%> (?)
test-core-ubuntu-latest-py3.13 100.00% <100.00%> (?)
test-core-ubuntu-latest-py3.14 100.00% <100.00%> (?)
test-core-windows-latest-py3.10 100.00% <100.00%> (?)
test-core-windows-latest-py3.11 100.00% <100.00%> (?)
test-core-windows-latest-py3.12 100.00% <100.00%> (?)
test-core-windows-latest-py3.13 100.00% <100.00%> (?)
test-core-windows-latest-py3.14 100.00% <100.00%> (?)
test-full-py3.10-scipy1.10 ?
test-full-py3.10-scipy1.11 ?
test-full-py3.10-scipy1.12 ?
test-full-py3.10-scipy1.13 ?
test-full-py3.10-scipy1.14 ?
test-full-py3.10-scipy1.15 ?
test-full-py3.10-scipy1.7 ?
test-full-py3.10-scipy1.8 ?
test-full-py3.10-scipy1.9 ?
test-full-py3.11-scipy1.10 ?
test-full-py3.11-scipy1.11 ?
test-full-py3.11-scipy1.12 ?
test-full-py3.11-scipy1.13 ?
test-full-py3.11-scipy1.14 ?
test-full-py3.11-scipy1.15 ?
test-full-py3.11-scipy1.16 ?
test-full-py3.11-scipy1.17 ?
test-full-py3.12-scipy1.11 ?
test-full-py3.12-scipy1.12 ?
test-full-py3.12-scipy1.13 ?
test-full-py3.12-scipy1.14 ?
test-full-py3.12-scipy1.15 ?
test-full-py3.12-scipy1.16 ?
test-full-py3.12-scipy1.17 ?
test-full-py3.13-scipy1.15 ?
test-full-py3.13-scipy1.16 ?
test-full-py3.13-scipy1.17 ?
test-full-py3.14-scipy1.16 ?
test-full-py3.14-scipy1.17 ?
test-minimum-scipy-ubuntu-latest-py3.10-scipy1.7.2 100.00% <100.00%> (?)
test-minimum-scipy-ubuntu-latest-py3.11-scipy1.10.1 100.00% <100.00%> (?)
test-minimum-scipy-ubuntu-latest-py3.12-scipy1.11.3 100.00% <100.00%> (?)
test-minimum-scipy-ubuntu-latest-py3.13-scipy1.15.0 100.00% <100.00%> (?)
test-minimum-scipy-ubuntu-latest-py3.14-scipy1.16.1 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rc/pystatpower/models/proportion/independent/ci.py 100.00% <100.00%> (ø)

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

While the PR successfully adds Newcombe-Wilson algorithms and standardizes one-sided terminology, there is a significant discrepancy between the PR's stated goals and the implementation: the farrington_manning algorithm is completely missing from the code despite being listed in the description.

Additionally, the _distance_newcombe_wilson_cc implementation is susceptible to ValueError: math domain error for certain edge cases (small sample sizes or low confidence levels). Several documentation and type-hint mismatches were also identified, particularly in the test suite and function docstrings. Although Codacy analysis indicates the code is otherwise up to standards, these issues should be addressed before merging.

About this PR

  • The PR description explicitly states that the 'farrington_manning' algorithm is added, but no implementation or test cases appear in the code changes. Please either implement the missing algorithm or update the PR description to match the actual scope.

Test suggestions

  • Calculate confidence interval distance using Newcombe-Wilson method for two-sided, lower one-sided, and upper one-sided types.
  • Calculate confidence interval distance using Newcombe-Wilson with continuity correction for two-sided, lower one-sided, and upper one-sided types.
  • Calculate confidence interval distance using Farrington-Manning method.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Calculate confidence interval distance using Farrington-Manning method.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread src/pystatpower/models/proportion/independent/ci.py
Comment thread src/pystatpower/models/proportion/independent/ci.py
Comment thread tests/test_models/test_proportion/test_independent/test_ci.py Outdated
Comment thread src/pystatpower/models/proportion/independent/ci.py Outdated
Comment thread docs/models/proportion/independent/ci.md Outdated
@codacy-production

codacy-production Bot commented Jun 8, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 6 high

Alerts:
⚠ 6 issues (≤ 0 issues of at least minor severity)

Results:
6 new issues

Category Results
Security 6 high

View in Codacy

🟢 Metrics 31 complexity

Metric Results
Complexity 31

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@Snoopy1866 Snoopy1866 force-pushed the feat-proportion-independent-ci-add-solvers branch from bb09eec to d6478e6 Compare June 8, 2026 08:51
@Snoopy1866 Snoopy1866 changed the title feat(proportion.independent.ci): support more confidence interval algorithms feat(proportion.independent.ci): add more solvers Jun 9, 2026
@Snoopy1866 Snoopy1866 changed the title feat(proportion.independent.ci): add more solvers feat(proportion.independent.ci): add more solvers and algorithms of confidence interval Jun 9, 2026
@Snoopy1866 Snoopy1866 changed the title feat(proportion.independent.ci): add more solvers and algorithms of confidence interval feat(proportion.independent.ci): add more solvers and algorithms Jun 9, 2026
@Snoopy1866 Snoopy1866 force-pushed the feat-proportion-independent-ci-add-solvers branch from 023b76f to e758463 Compare June 9, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request proportion.independent.ci tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant