Mercurial > octave-nkf
changeset 18990:ab5983dc0587 stable
statistics.m: Fix regression caused by change in skewness, kurtosis functions.
* statistics.m: Call skewness and kurtosis functions with an empty matrix
(use default) for the flag argument. Add %!test to check correct behavior.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 24 Jul 2014 11:11:57 -0700 |
parents | bcbd309bf272 |
children | 87cba451fd5e |
files | scripts/statistics/base/statistics.m |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/statistics/base/statistics.m Wed Jul 23 08:38:46 2014 -0700 +++ b/scripts/statistics/base/statistics.m Thu Jul 24 11:11:57 2014 -0700 @@ -61,7 +61,7 @@ emp_inv = quantile (x, [0.25; 0.5; 0.75], dim, 7); stats = cat (dim, min (x, [], dim), emp_inv, max (x, [], dim), mean (x, dim), - std (x, [], dim), skewness (x, dim), kurtosis (x, dim)); + std (x, [], dim), skewness (x, [], dim), kurtosis (x, [], dim)); endfunction @@ -77,6 +77,16 @@ %! assert (skewness (x), s(8,:), eps); %! assert (kurtosis (x), s(9,:), eps); +%! x = rand (7,5); +%! s = statistics (x, 2); +%! assert (min (x, [], 2), s(:,1), eps); +%! assert (median (x, 2), s(:,3), eps); +%! assert (max (x, [], 2), s(:,5), eps); +%! assert (mean (x, 2), s(:,6), eps); +%! assert (std (x, [], 2), s(:,7), eps); +%! assert (skewness (x, [], 2), s(:,8), eps); +%! assert (kurtosis (x, [], 2), s(:,9), eps); + %% Test input validation %!error statistics () %!error statistics (1, 2, 3)