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

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

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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).

[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



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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


Do you think this task is very important?
If so, you can add your encouragement to it.
This task has 0 encouragements so far.

Only project members can vote.




Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
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.5