JuliaStats / GLM.jl

Generalized linear models in Julia
Other
584 stars 114 forks source link

ditch negative zero in ftest output #501

Closed palday closed 1 year ago

palday commented 1 year ago

closes #461.

I also updated some docstring tests so that they would pass. (cf. also #469)

codecov-commenter commented 1 year ago

Codecov Report

Base: 87.08% // Head: 87.09% // Increases project coverage by +0.01% :tada:

Coverage data is based on head (5b7defe) compared to base (7299d18). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #501 +/- ## ========================================== + Coverage 87.08% 87.09% +0.01% ========================================== Files 7 7 Lines 929 930 +1 ========================================== + Hits 809 810 +1 Misses 120 120 ``` | [Impacted Files](https://codecov.io/gh/JuliaStats/GLM.jl/pull/501?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaStats) | Coverage Δ | | |---|---|---| | [src/ftest.jl](https://codecov.io/gh/JuliaStats/GLM.jl/pull/501/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaStats#diff-c3JjL2Z0ZXN0Lmps) | `100.00% <100.00%> (ø)` | | | [src/GLM.jl](https://codecov.io/gh/JuliaStats/GLM.jl/pull/501/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaStats#diff-c3JjL0dMTS5qbA==) | `50.00% <0.00%> (-16.67%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaStats). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaStats)

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

nalimilan commented 1 year ago

Thanks. Just another though: maybe we should apply rounding only in show? The advantage is that we know we use 4 digits, so we can change -0.0000 to 0.0000 safely without applying an arbitrary threshold.

This wouldn't fix tests that check internal fields directly, but anyway if we only clamp small negative values to zero, we have to use isapprox with some tolerance to handle small positive values.

palday commented 1 year ago

Can do, but mathematically this is non-adjusted R2, so should be strictly non-negative. Negative zero is just a floating point issue.

nalimilan commented 1 year ago

Yes, I agree, but the choice of an arbitrary threshold is annoying, and it seems safer to just store whatever r2 returns to avoid hiding potential bugs in implementations.