bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error in evaluating Poisson CDF


From: Peter Johansson
Subject: Re: Error in evaluating Poisson CDF
Date: Mon, 8 Feb 2021 22:15:16 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Sebastiano,

On 8/2/21 9:00 am, Sebastiano Vigna wrote:
This program

#include <gsl/gsl_cdf.h>
#include <stdio.h>
int main() {
         printf("%f\n", gsl_cdf_poisson_Q(7165697, 7168929.393553));
}

As a workaround you could use the fact that for large m, Poisson(x, m) is approximately Gaussian(x, m, sigma=sqrt(m)), so something like gsl_cdf_gaussian_Q( 7168929.393553 - 7165697, sqrt(7165697))

hope that helps,


Peter


prints

gsl: gamma_inc.c:181: ERROR: error in large x asymptotic
Default GSL error handler invoked.
Aborted (core dumped)

on gsl 2.6 (Fedora Linux). scipy, for instance, has no problem in evaluating it:

scipy.stats.poisson.sf(7165697, 7168929.393553);
0.8863015162515768

This kind of error is reported a bit randomly with certain large parameters 
(I'm running a large number of collision tests for PRNGs, and the distribution 
of collisions is approximated by a Poisson distribution, so I'm evaluating a 
lot of those with different parameters). I can provide more examples if this is 
useful in understanding the problem.

Ciao,

                                        seba





reply via email to

[Prev in Thread] Current Thread [Next in Thread]