bugGNU Octave - Bugs: bug #33541, corrcoef Matlab compatibility issue

 
 

bug #33541: corrcoef Matlab compatibility issue

Submitter:  Arnaud Delorme <arnodelorme>
Submitted:  Sat 11 Jun 2011 03:49:25 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.0 Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 17 Jul 2011 03:43:09 AM UTC, comment #8: 

I've deprecated both corrcoef() and cor(), and added the new function corr() which calculates the same concept as Matlab.  The changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/cad4cba03f19) is on the development branch and the reporter will need to build from source in order to see the change.

Rik <rik5>
Group administrator
Sun 17 Jul 2011 03:01:28 AM UTC, comment #7: 

Rik,

This seems correct to me.

Michael Godfrey <godfrey>
Group Member
Sun 17 Jul 2011 02:03:33 AM UTC, comment #6: 

Michael,

What do you think of simply renaming the current corrcoef to corr() since that seems to be the name Matlab uses for the output that Octave calculates?  The description for corr() is here <http://www.mathworks.com/help/toolbox/stats/corr.html>

Rik <rik5>
Group administrator
Mon 13 Jun 2011 03:55:40 PM UTC, comment #5: 

Note that the corr function of the Matlab statistics toolbox behave as the current corrcoef function of Octave.

Arnaud Delorme <arnodelorme>
Mon 13 Jun 2011 04:48:13 AM UTC, comment #4: 

 Besides compatability, can someone make a
compelling argument for why this behavior is better than the current Octave
behavior?

I agree that the Matlab behavior is weird at best.

It might make sense to explain this incompatibility
somewhere, and how to deal with it.

Somewhat more generally, few statisticians use Matlab,
because Matlab has never been serious about statistics.
So, matching their statistical functions should have low
priority.

For serious statistics R is the choice. 


Michael Godfrey <godfrey>
Group Member
Mon 13 Jun 2011 03:48:28 AM UTC, comment #3: 

I just took a look at the Matlab function as well and I dislike their interpretation of corrcoef(x,y) quite a bit.  The correlation coefficient between two vectors of observations is a single number.  Mathworks interprets corrcoef(x,y) as corrcoef ([x y]) which is a correlation coefficient matrix.  For a vector the elements on the diagonals are obviously 1 because each vector x,y correlates with itself and the off-diagonal element is what I would call the correlation coefficient.  Besides compatability, can someone make a compelling argument for why this behavior is better than the current Octave behavior?

If necessary, it is trivial to achieve compatibility manually by calling corrcoef ([x y]).  I would have users do this if they really want this behavior.

Rik <rik5>
Group administrator
Mon 13 Jun 2011 03:27:28 AM UTC, comment #2: 

I took a quick look at the Matlab function.
It is quite different from the Octave one.

So, it may be necessary to decide on a major
chance which will introduce incompatibility
for Octave.

The documentation is fairly clear for both Matlab
and Octave. Just different.

Michael Godfrey <godfrey>
Group Member
Mon 13 Jun 2011 03:16:12 AM UTC, comment #1: 

Can you explain why Matlab is different in this instance?  It seems to me that the correlation coefficient of two vectors SHOULD be a single number (1x1).

Rik <rik5>
Group administrator
Sat 11 Jun 2011 03:49:25 PM UTC, original submission:  

corrcoef(rand(5,1), rand(5,1)) 
% return 1x1 matrix Octave (2x2 Matlab with 1 in the diagonal)

Arnaud Delorme <arnodelorme>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by arnodelorme (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
    2011-07-17 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2011-06-29 jwe Item GroupIncorrect Result Matlab Compatibility
    2011-06-13 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code