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

The Binomial distribution does not draw its PDF for alpha = 0 #2605

Open
mbaudin47 opened this issue Apr 4, 2024 · 1 comment
Open

The Binomial distribution does not draw its PDF for alpha = 0 #2605

mbaudin47 opened this issue Apr 4, 2024 · 1 comment
Labels

Comments

@mbaudin47
Copy link
Collaborator

mbaudin47 commented Apr 4, 2024

What happened?

The Binomial distribution does not draw its PDF for n = 10 and alpha = 0. The script below generates the exception "The skewness is not defined for the Binomial distribution when p is 0 or 1".

How to reproduce the issue?

import openturns as ot
graph = ot.Binomial(10, 0).drawPDF()

A workaround is to use the Dirac(0) distribution, which draws the correct PDF.

import openturns as ot
graph = ot.Dirac(0).drawPDF()

Version

1.22

Operating System

unknown

Installation media

unknown

Additional Context

This bug was found by @adutfoy while working on quantiles of the Binomial distribution.

@mbaudin47 mbaudin47 added the bug label Apr 4, 2024
@regislebrun
Copy link
Member

The exception is triggered by the computation of the default plot range, based on 2 quantiles. It involves the call to Binomial::computeScalarQuantile, which uses the Cornish Fisher expansion to find a reasonable starting point for a sequential search of the quantile value. This expansion is based on higher order moments, not defined for a Dirac distribution. It should be fixed when the Binomial::computeScalarQuantile() is fixed, or at least you should get a different exception ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants