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

Underflow in logccdf for PGeneralizedGaussian #1916

Open
dschulman opened this issue Nov 14, 2024 · 0 comments · May be fixed by #1932
Open

Underflow in logccdf for PGeneralizedGaussian #1916

dschulman opened this issue Nov 14, 2024 · 0 comments · May be fixed by #1932

Comments

@dschulman
Copy link

On v0.25.113 of Distributions.

PGeneralizedGaussian uses the default implementation of logccdf, which is just log(ccdf), so it can easily underflow.
Since the distribution is symmetrical, these two should be equal:

julia> logcdf(PGeneralizedGaussian(2.5), -5.0)
-59.8161755398042

julia> logccdf(PGeneralizedGaussian(2.5), 5.0)
-Inf

There's an easy workaround by rewriting in terms of logcdf, but it took a while to figure out where the Infs were coming from when this was buried in a more complex computation.

julia> _logccdf(d::PGeneralizedGaussian, x) = logcdf(d, 2*d.μ - x)
_logccdf (generic function with 1 method)

julia> _logccdf(PGeneralizedGaussian(2.5), 5.0)
-59.8161755398042
@devmotion devmotion linked a pull request Dec 17, 2024 that will close this issue
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 a pull request may close this issue.

1 participant