Skip to content

Chi-square and F distributions when degrees of freedom tends to infinity #203

@jgpallero

Description

@jgpallero

A year ago I opened the bug https://savannah.gnu.org/bugs/?66034 about inconsistent results of finv() when the second degrees of freedom parameter tends to infinity. The bug was confirmed and solved. Now I can see that theproblem is present in other functions that finv() and also in chi-square distribution. I present here some example results

fpdf() in Matlab:

>> fpdf(2,4,Inf)
ans =
    0.1465
>> fpdf(2,Inf,4)
ans =
    0.1839
>> fpdf(2,Inf,Inf)
ans =
     0

fpdf() in Octave:

>> fpdf(2,4,Inf)
ans = NaN
>> fpdf(2,Inf,4)
ans = NaN
>> fpdf(2,Inf,Inf)
ans = NaN

fcdf() produces the same results in Octave and Matlab, as well as finv()

finv() works for Inf in DF2, but not for DF1 and DF1 and DF2 simultaneously. finv() in Matlab:

>> finv(0.35,Inf,4)
ans =
    0.9014
>> finv(0.35,Inf,Inf)
ans =
     1

finv() in Octave:

>> finv(0.35,Inf,4)
ans = NaN
>> finv(0.35,Inf,Inf)
ans = NaN

chi2pdf() in Matlab:

>> chi2pdf(2,Inf)
ans =
     0

chi2pdf() in Octave:

>> chi2pdf(2,Inf)
ans = NaN

chi2cdf() works well in both Octave and Matlab.

chi2inv() gets NaN for DF=Inf in both Octave and Matlab:

>> chi2inv(0.35,Inf)
ans =
   NaN

>> chi2inv(0.35,Inf)
ans = NaN

If we introduce a high value instead of Inf in Octave, the results are equal as in Matlab, but from a value onwards the behavior is erratic

>> fpdf(2,4,10000000000000000)
ans = 2.3515e-05
>> fpdf(2,4,1000000000000000)
ans = 1.4790
>> fpdf(2,4,100000000000000)
ans = 0.1349
>> fpdf(2,4,10000000000000)
ans = 0.1447
>> fpdf(2,4,1000000000000)
ans = 0.1467
>> fpdf(2,4,100000000000)
ans = 0.1465
>> fpdf(2,4,10000000000)
ans = 0.1465
>> fpdf(2,4,1000000000)
ans = 0.1465
>> fpdf(2,4,100000000)
ans = 0.1465
>> fpdf(2,4,10000000)
ans = 0.1465
>> fpdf(2,4,1000000)
ans = 0.1465
>> fpdf(2,4,100000)
ans = 0.1465
>> fpdf(2,4,10000)
ans = 0.1466

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions