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

 
 

bug #51927: [octave forge] (statistics) Failure in unit test of ttest function

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Sun 03 Sep 2017 07:10:57 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  lostbard
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 08 May 2018 09:20:58 PM UTC, comment #2: 

closing as invalid since it was already done

John Donoghue <lostbard>
Group Member
Sun 03 Sep 2017 08:10:31 PM UTC, comment #1: 

I did not realize that the change that I proposed below was already committed:

https://sourceforge.net/p/octave/statistics/ci/195f3463961950877deded611c4e575d1b9794e5/

This bug report can be closed.

Rafael Laboissière <rlaboiss>
Sun 03 Sep 2017 07:10:57 PM UTC, original submission:  

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.

Rafael Laboissière <rlaboiss>

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by rlaboiss (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-08 lostbard StatusNone Invalid / Not an Octave Bug
        Assigned toNone lostbard
        Open/ClosedOpen Closed
    2017-09-03 rlaboiss Attached File- Added pval-in-ttest-unit-test.patch, #41722

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code