bugGNU Octave - Bugs: bug #33542, corr only works on 2-D arrays

 
 

bug #33542: corr only works on 2-D arrays

Submitter:  Arnaud Delorme <arnodelorme>
Submitted:  Sat 11 Jun 2011 03:50:48 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 10 Feb 2016 10:05:00 PM UTC, comment #9: 

Marking as "Won't Fix" and closing report.

Rik <rik5>
Group administrator
Wed 10 Feb 2016 03:48:55 AM UTC, comment #8: 

Rik, thanks for checking.  Matlab now also fails on matrices greater than two dimensions.  (I mistakenly said "more than three" last time.)


>> corr (rand(2,2,3), rand(2,2,3))
Error using  '
Transpose on ND array is not defined. Use PERMUTE instead.

Error in corr>corrPearson (line 300)
        coef = xc' * yc; % 1/(n-1) doesn't matter, renormalizing anyway

Error in corr (line 210)
        [coef,pval] = corrFun(rows,tail,x,y);
>>
>> version

ans =

8.2.0.701 (R2013b)


This is no longer a compatibility issue.  I'll mark it as a feature request, but think it should be closed -- Matlab moved away from providing that feature.

Lachlan Andrew <lachlan>
Thu 08 Oct 2015 12:35:14 AM UTC, comment #7: 

I think this Matlab compatibility request is still present.  If I try the code from comment #4 in Octave dev (2015/10/07) I get


corr (rand(2,2,3), rand(2,2,3))
error: cov: X and Y must be 2-D matrices or vectors
error: called from
    cov at line 83 column 5
    corr at line 70 column 7



Rik <rik5>
Group administrator
Thu 17 Sep 2015 09:27:27 AM UTC, comment #6: 

I believe  corrcoef  has been removed from Octave 4.0.0.

Also, corr produces an error in both Matlab and Octave for arrays of more than 3 dimensions, and corrcoef does in Matlab.

Can this bug be closed now?

Lachlan Andrew <lachlan>
Sun 28 Jul 2013 03:44:55 PM UTC, comment #5: 

If I understand correctly where this left off, this is still a bug in the development version.

Mike Miller <mtmiller>
Group Member
Sun 17 Jul 2011 04:10:54 AM UTC, comment #4: 

Rik,

This looks like what you want:

>> corr (rand(2,2,3), rand(2,2,3))


ans =

   -1.0000   -1.0000
   -1.0000   -1.0000
    1.0000    1.0000
   -1.0000   -1.0000
   -1.0000   -1.0000
   -1.0000   -1.0000

>>


Michael Godfrey <godfrey>
Group Member
Sun 17 Jul 2011 03:46:54 AM UTC, comment #3: 

If corr only works on 2-D arrays then I think our current implementation is fine and I can close this report.

Perhaps, one could try


corr (rand(2,2,3), rand(2,2,3))


which would at least show if the NaN output in the previous example was caused by not having a true matrix in the first two dimensions.

Rik <rik5>
Group administrator
Sun 17 Jul 2011 03:14:55 AM UTC, comment #2: 


>> corr (rand(1,1,10), rand(1,1,10))


ans =

   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN

>>

As usual, this is Matlab r2009b.  I tried a few other things
with corr(), but I need to reread its Matlab decription...

Michael Godfrey <godfrey>
Group Member
Sun 17 Jul 2011 02:05:56 AM UTC, comment #1: 

Since the function corrcoef in Octave is more equivalent to the function corr() in Matlab, could you report whether the following code produces an error?


corr (rand(1,1,10), rand(1,1,10))


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

corrcoef(rand(1,1,10), rand(1,1,10)) 
% crashes under Octave but works in Matlab

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 lachlan (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-10 rik5 StatusConfirmed Wont Fix
        Open/ClosedOpen Closed
    2016-02-10 lachlan Item GroupMatlab Compatibility Feature Request
    2013-07-28 mtmiller CategoryNone Octave Function
        Item GroupNone Matlab Compatibility
        Release3.4.0 dev
        Operating SystemMac OS Any
    2011-07-27 rik5 StatusNone Confirmed
        Summarycorrcoef Matlab compatibility issue (multi-dim matrices) corr only works on 2-D arrays

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code