bugGNU Octave - Bugs: bug #42975, [octave forge] (nan) corrcoef...

 
 

bug #42975: [octave forge] (nan) corrcoef function inaccurate

Submitted by:  Nir Krakauer <nir_krakauer>
Submitted on:  Wed 13 Aug 2014 02:46:44 PM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: NoneAssigned to: None
Originator Name: Nir KrakauerOpen/Closed: Open
Release: otherOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 13 Aug 2014 02:46:44 PM UTC, original submission:

The corrcoef function in the nan package uses a numerically unstable method to calculate the correlation coefficients, which can even result in the returned correlation coefficients being outside the range -1 to 1.

Examples:
A) i = 1E7; c = corrcoef(1E5 + (1:i)'/i, 1E5 + sin((1:i)'/i) .* cos((1:i)'/i)) returns 1.0518
B) i = 1E6; c = corrcoef(1E7+(1:i)'/i, 1E7 + sin((1:i)'/i)) returns -1.2129
C) i = 1E6; c = corrcoef(1E7+(1:i)'/i, 1E7 - sin((1:i)'/i)) returns 0.00000 - 0.43355i

By contrast, for the above cases the built-in corrcoef function returns reasonable results of 0.92305, 0.99743, -0.99743 respectively

Nir Krakauer <nir_krakauer>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by nir_krakauer (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 13 Aug 2017 01:31:55 PM UTCjweSummarynan: corrcoef function inaccurate=>[octave forge] (nan) corrcoef function inaccurate
    Mon 18 Jan 2016 06:27:17 PM UTCmtmillerRelease3.6.2=>other

    Back to the top


    Powered by Savane 3.1-cleanup1