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

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

[Octave-bug-tracker] [bug #51927] [octave forge] (statistics) Failure in


From: Rafael Laboissiere
Subject: [Octave-bug-tracker] [bug #51927] [octave forge] (statistics) Failure in unit test of ttest function
Date: Sun, 3 Sep 2017 15:10:58 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?51927>

                 Summary: [octave forge] (statistics) Failure in unit test of
ttest function
                 Project: GNU Octave
            Submitted by: rlaboiss
            Submitted on: Sun 03 Sep 2017 07:10:57 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: other
        Operating System: GNU/Linux

    _______________________________________________________

Details:

One the unit tests for the ttest function of the statistics package fails on
my system (amd64 Debian with Octave 4.2, statistics 1.3.0):


octave:1> pkg load statistics
octave:2> test ("ttest")
***** test
 x = 8:0.1:12;
 [h, pval, ci] = ttest (x, 10);
 assert (h, 0)
 assert (pval, 1)
 assert (ci, [9.6219 10.3781], 1E-5)
 [h, pval, ci0] = ttest (x, 0);
 assert (h, 1)
 assert (pval, 0)
 assert (ci0, ci)
!!!!! test failed
ASSERT errors for:  assert (pval,1)

  Location  |  Observed  |  Expected  |  Reason
     ()           1            1         Abs err 2.2204e-16 exceeds tol 0


This happens due to a floating-point precision peculiarity, exposed by the
following code:


octave:1> x = 8:0.1:12;
octave:2> mean (x - 10)
ans =    5.4157e-17
octave:3> mean (x) - 10
ans = 0


The attached patch fixes the problem.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 03 Sep 2017 07:10:57 PM UTC  Name: pval-in-ttest-unit-test.patch 
Size: 481B   By: rlaboiss

<http://savannah.gnu.org/bugs/download.php?file_id=41722>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51927>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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