bugGNU Octave - Bugs: bug #58697, [octave forge] (statistics) ttest2...

 
 

bug #58697: [octave forge] (statistics) ttest2 does not give the same result as matlab when input contain nans

Submitter:  None
Submitted:  Fri 03 Jul 2020 07:03:00 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 5.2.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 26 Jul 2022 02:45:52 PM UTC, comment #1: 

Fixed the bug with commit 2ed86bb at https://github.com/gnu-octave/statistics/commit/2ed86bbe75d27af2aa12e673ef58409882c4972c
Added a BIST as well. Closed

Andreas Bertsatos <pr0m1th3as>
Fri 03 Jul 2020 07:03:00 PM UTC, original submission:  

As per the title, a small example showing that nans are propagated in octave, but not matlab, which ignores them in the computation (likely they use nanmean and such inside).
This could be very much intended, but it did not seem to follow (at least the default), matlab behavior, so here bug report. Also a very poor man example showcasing the outputs are different, this is likely also very true for a lot of other similar functions (hence why I can't believe nobody else could have not noticed yet). There is also a function t_test_2 which exibits the same behavior. I am trying here to write stuff in matlab which also works on octave, and so I am trying to avoid replicating functions to behave similarly if possible (I can probably manually work around it in the meantime).

a=1:5;
b=6:10;
b(5)=nan;
[h,p,ci,stats] = ttest2(a,b)

% on matlab I get

% h =

%      1


% p =

%     0.0025


% ci =

%    -6.8220   -2.1780


% stats =

%   struct with fields:

%     tstat: -4.5826
%        df: 7
%        sd: 1.4639




% on octave 5.2.0, statistics 1.4.2 I get
% h = 0
% p =  NaN
% ci =

%    NaN   NaN

% stats =

%   scalar structure containing the fields:

%     tstat =  NaN
%     df =  8
%     sd =  NaN

Anonymous

 

(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 nrjank (Updated the item)
  • -email is unavailable- added by pr0m1th3as (Posted a comment)
  •  

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-26 nrjank StatusNone Fixed
        Open/ClosedOpen Closed
    2020-07-09 mtmiller Summaryttest2 does not give the same result as matlab when input contain nans [octave forge] (statistics) ttest2 does not give the same result as matlab when input contain nans

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code