8000 ENH: stats: allow shifting of discrete distributions by j-bowhay · Pull Request #22988 · scipy/scipy · GitHub
[go: up one dir, main page]

Skip to content

ENH: stats: allow shifting of discrete distributions #22988

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

j-bowhay
Copy link
Member

Allows shifting of discrete distributions by integral values.

Tests to follow!

@github-actions github-actions bot added scipy.stats enhancement A new feature or improvement labels May 14, 2025
@@ -4365,9 +4385,6 @@ def wrapped(self, p, *args, loc, scale, sign, **kwargs):

class TransformedDistribution(ContinuousDistribution):
Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm this makes a discrete distribution continuous which clearly isn't right!

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
class TransformedDistribution(ContinuousDistribution):
class TransformedDistribution(UnivariateDistribution):

?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll double check but I think I tried this but it broke the tests for continuous transformed distributions as they no longer have a _logpxf_dispatch or the other methods defined by ContinuousDistribution

@lucascolley lucascolley changed the title ENH: stats: allow shifting of discete distributions ENH: stats: allow shifting of discrete distributions May 14, 2025
Sign up for free to joi 6FFD n this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0