[SciPy-User] [SciPy-dev] Bug/Error with chi-squared distribution and df<1

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Sep 22 15:58:50 EDT 2009


On Tue, Sep 22, 2009 at 3:47 PM, Pauli Virtanen <pav at iki.fi> wrote:
> ti, 2009-09-22 kello 14:27 -0400, josef.pktd at gmail.com kirjoitti:
> [clip]
>> Taking the hint with incomplete gamma, the following looks good. This
>> would mean until Pauli fixes scipy.special if it your fix works, we
>> could also use gammainc directly. I don't know the differences between
>> the various implementations well enough to see whether we buy some
>> other problems with this
>
> The C function `igam` called by `chdtr` is the same as what is exposed
> as `gammainc`.
>
> --
> Pauli Virtanen
>

Thanks, then it looks like that there is no reason to enforce the
df>=1 constraint.

instead we could restrict df>0, the value for df=0 is wrong (should be 1)
but convergence to zero looks reasonable, no idea about exact numbers

Josef

>>> df=1e-8;x=0.5;special.gammainc(df/2., x/2.)
0.99999999477858692
>>> df=1e-8;x=1e-6;special.gammainc(df/2., x/2.)
0.99999993034278956
>>> df=1e-8;x=1e-12;special.gammainc(df/2., x/2.)
0.99999986126524631
>>>
>>> df=0;x=1e-12;special.gammainc(df/2., x/2.)
0.0
>>> df=-1;x=1;special.gammainc(df/2., x/2.)
0.0


>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list