JuliaStats / HypothesisTests.jl

Hypothesis tests for Julia
MIT License
295 stars 87 forks source link

Wald interval with continuity correction #291

Closed PharmCat closed 1 year ago

PharmCat commented 1 year ago

For consistent with other statistical software add :waldcc: Wald interval with continuity correction (add 0.5/n to interval).

# Wald interval with continuity correction
function ci_waldcc(x::BinomialTest, alpha::Float64=0.05)
    μ = x.x / x.n
    σ = sqrt(μ*(1-μ)/x.n)
    (quantile(Normal(μ, σ), alpha/2) - 0.5/x.n, quantile(Normal(μ, σ), 1-alpha/2) + 0.5/x.n)
end
codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 :tada:

Comparison is base (a1713cf) 93.78% compared to head (6b88135) 93.81%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #291 +/- ## ========================================== + Coverage 93.78% 93.81% +0.02% ========================================== Files 28 28 Lines 1739 1745 +6 ========================================== + Hits 1631 1637 +6 Misses 108 108 ``` | [Impacted Files](https://app.codecov.io/gh/JuliaStats/HypothesisTests.jl/pull/291?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaStats) | Coverage Δ | | |---|---|---| | [src/binomial.jl](https://app.codecov.io/gh/JuliaStats/HypothesisTests.jl/pull/291?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaStats#diff-c3JjL2Jpbm9taWFsLmps) | `92.22% <100.00%> (+0.55%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

ararslan commented 1 year ago

Sorry, suggestion was broken, thanks for catching and fixing 😅