[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #48690] basic statistics functions should retu
From: |
Nicholas Jankowski |
Subject: |
[Octave-bug-tracker] [bug #48690] basic statistics functions should return NaN on empty input |
Date: |
Wed, 18 Jan 2017 16:10:23 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 |
Follow-up Comment #18, bug #48690 (project octave):
hold off on the patch for cov. All others should be fine.
I missed its usage with multiple inputs, and that collides with previous
accepted matlab incompatibility for the function. in short, if with numbers
matlab would produce a matrix output, and octave's does not, should the
'matlab compatibility fix' for empty and nan inputs follow the matlab or
octave convention?
ex, normal inputs:
cov([1 2 3 4],[1 2 3 4])
Octave: ans = 1.6667
Matlab: ans = [1.6667,1.6667; 1.6667,1.6667]
ex, matlab outputs for this case:
cov ([]) = NaN
cov (NaN) = NaN
cov([],[]) = NaN(2,2)
cov(NaN(0,2)) = NaN(2,2)
cov(NaN(2,0)) = []
also, there are a couple tests/errors in the current implementation that are
problematic:
scalar 'y' treated only as an 'opt' for nargin==2 if it's ascalar, out of
bounds error if it's not 0 or 1. Matlab doesn't error, but output is a
matrix:
%!error cov (1, 3)
matlab output
>> cov(1,3)
ans =
0 0
0 0
last, there's a special codepath at line 97 (scalar 'x' outputs 0) that
shortcuts everything else, including code that should error out:
>> cov (5, [1 2])
ans = 0
matlab output:
>> cov (5,[1 2])
Error using cov (line 107)
The number of elements in x and y must match.
previous mailing list discussions on the accepted incompatibility:
http://octave.1599824.n4.nabble.com/covariance-matrix-td1607376.html
http://octave.1599824.n4.nabble.com/cov-x-y-matrix-or-number-td4465087.html
started a discussion on maintainers. no discussion but linking so nothing gets
lost:
http://octave.1599824.n4.nabble.com/compatibility-of-cov-past-discussions-and-how-to-interpret-for-current-bugfix-td4681490.html
I've also cc'd a couple people involved in the past cov compatibility
discussion.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?48690>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #48690] basic statistics functions should return NaN on empty input,
Nicholas Jankowski <=