Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: forbid α=inf || β=inf in Beta distr. #299

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

FreezyLemon
Copy link
Contributor

Currently, new only rejects both shapes being infinite. Now, it rejects any of the shapes being infinite.

There's been some discussion (#102) about supporting degenerate parameters for distributions. For Beta specifically, almost every function (cdf, sf, pdf, mode, mean, ...) needs one or two special cases for infinite parameters, which doesn't seem sensible. For users needing a shape=+/-INF, it makes more sense to create their own struct and then implement the relevant statrs traits, performance- and complexity-wise.

This fixes skewness() returning an incorrect value for numeric limits (#136) and simplifies most Beta functions.

Also clarifies and fixes up some docs. Breaking because it removes an enum variant from BetaError, which is public.

This fixes `skewness()` returning an incorrect value
for numeric limits and simplifies some functions.

Also clarifies and fixes up some docs.
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.73%. Comparing base (1cbcc49) to head (c37f3b2).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #299      +/-   ##
==========================================
- Coverage   93.76%   93.73%   -0.03%     
==========================================
  Files          53       53              
  Lines       12088    12010      -78     
==========================================
- Hits        11334    11258      -76     
+ Misses        754      752       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@YeungOnion
Copy link
Contributor

Looks great, would support removing parameters that yield degenerate distributions for other constructors as well

@YeungOnion YeungOnion merged commit 993a4b5 into statrs-dev:master Sep 23, 2024
10 checks passed
@YeungOnion YeungOnion added this to the 0.18 milestone Sep 24, 2024
@FreezyLemon FreezyLemon deleted the forbid-degenerate-beta branch September 24, 2024 08:00
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.

2 participants