bugGNU Octave - Bugs: bug #66034, [statistics] finv results when...

 
 

bug #66034: [statistics] finv results when second value of degrees of freedom tends to infinity

Submitter:  José Luis García Pallero <jgpallero>
Submitted:  Sat 27 Jul 2024 09:23:55 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  jgpallero Open/Closed:  * Open
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 18 Aug 2024 08:45:03 AM UTC, comment #3: 

I pushed a commit (https://github.com/gnu-octave/statistics/commit/672db5206455b33c5edb0d048f593c18264969b5) to address both issues.

For very large DF2 values, I added a rule to limit them to 1e6. The reason for this threshold is that at this value finv returns the same value as when DF2 is Inf. This makes much more sense, since it is expected that the minimum is reached at Inf, rather than what MATLAB returns for DF2 more than 1e6.
 
For DF2 being Inf, used the chi2inv as suggested by José.

Thanks for the bug report. Please, keep in mind that it is much more convenient to report bugs related to the statistics package directly at GitHub (https://github.com/gnu-octave/statistics/issues), where the development repository for statistics is being hosted.

Unless further discussion is required, this bug report can be closed.




Andreas Bertsatos <pr0m1th3as>
Sun 28 Jul 2024 12:57:17 AM UTC, comment #2: 

It is from "statistics"
And, yes, I can reproduce all those results with
statistics-1.6.7

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 28 Jul 2024 12:51:10 AM UTC, comment #1: 

Is this a problem in core Octave or a package?  I tried


which finv


and I get no result.

Rik <rik5>
Group administrator
Sat 27 Jul 2024 09:23:55 PM UTC, original submission:  

Function

X = finv (P, DF1, DF2)

returns erratic values when DF2 adopts very big values:

>> finv(0.025,10,100000000000)
ans = 0.3908
>> finv(0.025,10,1000000000000)
ans = 0.3926
>> finv(0.025,10,10000000000000)
ans = 0.3697
>> finv(0.025,10,100000000000000)
ans = 0.1110
>> finv(0.025,10,1000000000000000)
ans = 1.4655
>> finv(0.025,10,10000000000000000)
ans = 0.2220
>> finv(0.025,10,100000000000000000)
ans = 1.4901e+07
>> finv(0.025,10,1000000000000000000)
ans = 1.4901e+08
>> finv(0.025,10,10000000000000000000)
ans = 1.4901e+09
>> finv(0.025,10,inf)
ans = NaN

If DF2 is assigned explicitly to infinity, the result is NaN

But in Matlab this problem is solved:

>> finv(0.025,10,100000000000)
ans =
    0.3223
>> finv(0.025,10,1000000000000)
ans =
    0.3223
>> finv(0.025,10,10000000000000)
ans =
    0.3223
>> finv(0.025,10,100000000000000)
ans =
    0.3223
>> finv(0.025,10,1000000000000000)
ans =
    0.3223
>> finv(0.025,10,10000000000000000)
ans =
    0.3223
>> finv(0.025,10,100000000000000000)
ans =
    0.3223
>> finv(0.025,10,1000000000000000000)
ans =
    0.3223
>> finv(0.025,10,10000000000000000000)
ans =
    0.3223
>> finv(0.025,10,inf)
ans =
    0.3247


The F-Snedecor with infinity degrees of freedom in the denominator tends to chi-square with DF1 divided by DF1:

>> chi2inv(0.025,10)/10
ans = 0.3247


I don't know the algorithm used in Octave, but at least it would be nice if infinity is used as DF2, it would be detected and internally use chi2inv (P,DF1)/DF1

José Luis García Pallero <jgpallero>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pr0m1th3as (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by jgpallero (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-07-28 rik5 Carbon-CopyRemoved 72865 -
    2024-07-28 rik5 StatusNeed Info Confirmed
    2024-07-28 rik5 CategoryOctave Function Octave Package
        Summaryfinv results when second value of degrees of freedom tends to infinity [statistics] finv results when second value of degrees of freedom tends to infinity
    2024-07-28 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.14-3b9d.
    Corresponding source code