octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58697] ttest2 does not give the same result a


From: anonyme
Subject: [Octave-bug-tracker] [bug #58697] ttest2 does not give the same result as matlab when input contain nans
Date: Fri, 3 Jul 2020 15:03:02 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

URL:
  <https://savannah.gnu.org/bugs/?58697>

                 Summary: ttest2 does not give the same result as matlab when
input contain nans
                 Project: GNU Octave
            Submitted by: None
            Submitted on: ven. 03 juil. 2020 19:03:00 UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58697>

_______________________________________________
  Message posté via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]