bugGNU Octave - Bugs: bug #40751, cov(x, x) doesn't return the same...

 
 

bug #40751: cov(x, x) doesn't return the same result as in Matlab

Submitted by:  Julien Bect <jbect>
Submitted on:  Fri 29 Nov 2013 04:56:22 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Fri 03 Jan 2014 08:37:56 PM UTC, comment #7:

I added a note documenting the intentional Matlab incompatability to cov.m in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/48dafd739840). Closing report.

Rik <rik5>
Project Administrator
Mon 02 Dec 2013 01:46:08 PM UTC, comment #6:

PMFJI
cov's doc string (help cov) doesn't explicitly mention the Matlab incompatibility.

From my own experience, supported by the discussion in the mentioned thread, I think Octave's behavior is the preferred choice. I never used ML's cov, otherwise I would surely have hit this limitation.

Could this be fixed with a 4th input argument for cov turning ML compatible behavior on/off? (+ similar 3rd arg in corrcoef as well?), default value TBA?

Philip Nienhuis <philipnienhuis>
Project Member
Sun 01 Dec 2013 06:40:52 PM UTC, comment #5:

Yes, I think it should be documented. I thought the doc string for cov already mentioned this incompatibility.

It's also fine with me if we revisit whether we should remove this incompatibility. But whatever we do, we should NOT should make any change to cov on the stable branch for the 3.8 release.

John W. Eaton <jwe>
Project Administrator
Sun 01 Dec 2013 05:45:56 PM UTC, comment #4:

Ok, sorry about that, I hadn't found these threads.

Would it be acceptable to document this intentional incompatibility somewhere, e.g., in the help text of the function or at least as a comment in the code ?

Julien Bect <jbect>
Sun 01 Dec 2013 04:52:35 PM UTC, comment #3:

This has come up a number of times in the past and we have always decided to keep Octave's definition of cov.

Please take a look at:

http://octave.1599824.n4.nabble.com/Re-cov-m-patch-td4466691.html

and the thread that it references:

http://octave.1599824.n4.nabble.com/covariance-matrix-td1607376.html#a1607378

John W. Eaton <jwe>
Project Administrator
Sun 01 Dec 2013 08:12:36 AM UTC, comment #2:

As far as I can tell, Matlab's cov() has always behaved like this.

corr(), on the other hand, has a different behaviour. Perhaps because it is a function from the statistics toolbox, not a base Matlab function.

By the way, corrcoef() suffers from exactly the same problem. (Why is there currently a warning indicating that corrcoef will be removed in a future version of Octave ?)

So, it seems that both cov() and corrcoef() have to be fixed. In fact, corrcoef() should be fixed automatically once cov() is fixed, since it is based on it.

I will do this when I have time, if nobody does it before ;-)

Julien Bect <jbect>
Sun 01 Dec 2013 06:51:27 AM UTC, comment #1:

According to Matlab's documentation, cov (x,y) is equivalent to

and in Octave doing

I don't know if this is a recent change in Matlab's behavior or not, but the fix looks simple. The m-file can just be changed to use the new definition.

Rik <rik5>
Project Administrator
Fri 29 Nov 2013 04:56:22 PM UTC, original submission:

In Octave 3.7.7+ I get:

In Matlab R2012a:

Julien Bect <jbect>

 

(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 (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jbect (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
    Fri 03 Jan 2014 08:37:56 PM UTCrik5StatusNone=>Wont Fix
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1