Hello community,
here is the log from the commit of package octave-forge-statistics for
openSUSE:Factory checked in at 2019-07-08 15:10:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-statistics (Old)
and /work/SRC/openSUSE:Factory/.octave-forge-statistics.new.4615 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "octave-forge-statistics"
Mon Jul 8 15:10:48 2019 rev:4 rq:713626 version:1.4.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/octave-forge-statistics/octave-forge-statistics.changes
2018-06-29 22:22:47.326646465 +0200
+++
/work/SRC/openSUSE:Factory/.octave-forge-statistics.new.4615/octave-forge-statistics.changes
2019-07-08 15:10:53.439337352 +0200
@@ -1,0 +2,18 @@
+Thu Jul 4 20:04:00 2019 UTC - [email protected]
+
+- Update to version 1.4.1:
+ * update install scripts for octave 5.0 depreciated functions
+
+ * bug fixes to the following functions:
+ - pdist2.m: use max in distEucSq (Bug #50377)
+ - normpdf: use eps tolerance in tests (Bug #51963)
+ - fitgmdist: fix an output bug in fitgmdist
+ - t_test: Set tolerance on t_test BISTS (Bug #54557)
+ - gpXXXXX: change order of inputs to match matlab (Bug #54009)
+ - bartlett_test: df = k-1 (Bug #45894)
+ - gppdf: apply scale factor (Bug #54009)
+ - gmdistribution: updates for bug #54278, ##54279
+ - wishrnd: Bug #55860
+ - Add
octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
+
+-------------------------------------------------------------------
Old:
----
statistics-1.4.0.tar.gz
New:
----
octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
statistics-1.4.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ octave-forge-statistics.spec ++++++
--- /var/tmp/diff_new_pack.t4jadD/_old 2019-07-08 15:10:54.375338250 +0200
+++ /var/tmp/diff_new_pack.t4jadD/_new 2019-07-08 15:10:54.379338254 +0200
@@ -1,7 +1,7 @@
#
# spec file for package octave-forge-statistics
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,19 +12,21 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define octpkg statistics
Name: octave-forge-%{octpkg}
-Version: 1.4.0
+Version: 1.4.1
Release: 0
Summary: Additional statistics functions for Octave
License: GPL-3.0-or-later AND SUSE-Public-Domain
Group: Productivity/Scientific/Math
Url: http://octave.sourceforge.net
Source0:
http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM
octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
https://savannah.gnu.org/bugs/?func=detailitem&item_id=50365
[email protected] -- fix bug #50365. Update distances and classes to best
replica
+Patch0:
octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
BuildArch: noarch
BuildRequires: octave-devel
Requires: octave-cli >= 4.0.0
@@ -37,6 +39,7 @@
%prep
%setup -q -c %{name}-%{version}
%octave_pkg_src
+%patch0 -p1
%build
%octave_pkg_build
++++++
octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
++++++
--- a/statistics-1.4.1/inst/kmeans.m
+++ b/statistics-1.4.1/inst/kmeans.m
@@ -143,9 +143,9 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
replicates_set_explicitly = false;
## Remove rows containing NaN / NA, but record which rows are used
- data_idx = ! any (isnan (data), 2);
+ data_idx = ! any (isnan (data), 2);
original_rows = rows (data);
- data = data(data_idx,:);
+ data = data(data_idx,:);
#used for getting the number of samples
n_rows = rows (data);
@@ -236,11 +236,14 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
if (isempty (k))
k = rows (start);
elseif (rows (start) != k)
- error ("kmeans: Number of initializers (%d) should match number of
centroids (%d)", rows (start), k);
+ error (["kmeans: Number of initializers (%d) " ...
+ "should match number of centroids (%d)"], rows (start), k);
endif
if (replicates_set_explicitly)
if (replicates != size (start, 3))
- error ("kmeans: The third dimension of the initializer (%d) should
match the number of replicates (%d)", size (start, 3), replicates);
+ error (["kmeans: The third dimension of the initializer (%d) " ...
+ "should match the number of replicates (%d)"], ...
+ size (start, 3), replicates);
endif
else
replicates = size (start, 3);
@@ -251,32 +254,32 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
## dist returns the distance btwn each row of matrix x and a row vector c
switch (lower (distance))
case "sqeuclidean"
- dist = @(x, c) (sumsq (bsxfun (@minus, x, c), 2));
- centroid = @(x) (mean (x,1));
+ dist = @(x, c) sumsq (bsxfun (@minus, x, c), 2);
+ centroid = @(x) mean (x, 1);
case "cityblock"
- dist = @(x, c) (sum (abs (bsxfun (@minus, x, c)), 2));
- centroid = @(x) (median (x,1));
+ dist = @(x, c) sum (abs (bsxfun (@minus, x, c)), 2);
+ centroid = @(x) median (x, 1);
case "cosine"
## Pre-normalize all data.
## (when Octave implements normr, will use data = normr (data) )
for i = 1:rows (data)
data(i,:) = data(i,:) / sqrt (sumsq (data(i,:)));
endfor
- dist = @(x, c) (1 - (x * c') ./ sqrt (sumsq (c)));
- centroid = @(x) (mean (x,1)); ## already normalized
+ dist = @(x, c) 1 - (x * c') ./ sqrt (sumsq (c));
+ centroid = @(x) mean (x, 1); ## already normalized
case "correlation"
- ## Pre-normalize all data.
+ ## Pre-normalize all data.
data = data - mean (data, 2);
- ## (when Octave implements normr, will use data = normr (data) )
+ ## (when Octave implements normr, will use data = normr (data) )
for i = 1:rows (data)
data(i,:) = data(i,:) / sqrt (sumsq (data(i,:)));
endfor
-
- dist = @(x, c) (1 - (x * (c-mean (c))') ./ sqrt (sumsq (c-mean (c))));
- centroid = @(x) (mean (x,1)); ## already normalized
+ dist = @(x, c) 1 - (x * (c - mean (c))') ...
+ ./ sqrt (sumsq (c - mean (c)));
+ centroid = @(x) mean (x, 1); ## already normalized
case "hamming"
- dist = @(x, c) (sum (bsxfun (@ne, x, c), 2));
- centroid = @(x) (median (x,1));
+ dist = @(x, c) sum (bsxfun (@ne, x, c), 2);
+ centroid = @(x) median (x, 1);
otherwise
error ("kmeans: unsupported distance parameter %s", distance);
endswitch
@@ -285,7 +288,6 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
########################################
## Now that k has been set (possibly by 'replicates' option), check/use it.
-
if (! isscalar (k))
error ("kmeans: second input argument must be a scalar");
endif
@@ -293,27 +295,27 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
## used to hold the distances from each sample to each class
D = zeros (n_rows, k);
- best = Inf;
+ best = Inf;
best_centers = [];
for rep = 1:replicates
## check for the 'start' property
switch (lower (start))
case "sample"
- idx = randperm (n_rows, k);
+ idx = randperm (n_rows, k);
centers = data(idx, :);
case "plus" # k-means++, by Arthur and Vassilios(?)
centers(1,:) = data(randi (n_rows),:);
- d = inf (n_rows, 1); # Distance to nearest centroid so far
- for i = 2:k
- d = min (d, dist (data, centers(i-1, :)));
- centers(i,:) = data(find (cumsum (d) > rand * sum (d), 1), :);
- endfor
+ d = inf (n_rows, 1); # Distance to nearest centroid so
far
+ for i = 2:k
+ d = min (d, dist (data, centers(i - 1, :)));
+ centers(i,:) = data(find (cumsum (d) > rand * sum (d), 1), :);
+ endfor
case "cluster"
- idx = randperm (n_rows, max (k, ceil (n_rows/10)));
- [~, centers] = kmeans (data(idx,:), k, "start", "sample",
+ idx = randperm (n_rows, max (k, ceil (n_rows / 10)));
+ [~, centers] = kmeans (data(idx,:), k, "start", "sample", ...
"distance", distance);
case "uniform"
- # vectorised 'min_data + range .* rand'
+ # vectorised 'min_data + range .* rand'
centers = bsxfun (@plus, min_data,
bsxfun (@times, range, rand (k, columns (data))));
otherwise
@@ -323,13 +325,9 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
## Run the algorithm
iter = 1;
- ## Classify once before the loop; to set sumd, and if max_iter == 0
+ ## Classify once before the loop; to set sumd, and if max_iter == 0
## Compute distances and classify
- for i = 1:k
- D (:, i) = dist (data, centers(i, :));
- endfor
- [~, classes] = min (D, [], 2);
- sumd = obj_cost (D, classes);
+ [D, classes, sumd] = update_dist (data, centers, D, k, dist);
while (err > 0.001 && iter++ <= max_iter)
## Calculate new centroids
@@ -345,18 +343,18 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
## farthest from any centroid (and not replacing an empty cluster
## from earlier in this pass) and add it to the empty cluster
case 'singleton'
- available = setdiff(1:n_rows, replaced_centroids);
- [~, idx] = max (min (D(available,:)'));
- idx = available(idx);
+ available = setdiff (1:n_rows, replaced_centroids);
+ [~, idx] = max (min (D(available,:)'));
+ idx = available(idx);
replaced_centroids = [replaced_centroids, idx];
- classes(idx) = i;
- membership(idx)=1;
+ classes(idx) = i;
+ membership(idx) = 1;
## if 'drop' then set C and D to NA
case 'drop'
centers(i,:) = NA;
- D(i,:) = NA;
+ D(i,:) = NA;
## if 'error' then throw the error
otherwise
@@ -370,16 +368,9 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
endif
endfor
- ## Compute distances
- for i = 1:k
- D (:, i) = dist (data, centers(i, :));
- endfor
-
- ## Classify
- [~, classes] = min (D, [], 2);
-
+ ## Compute distances, classes and sums
+ [D, classes, new_sumd] = update_dist (data, centers, D, k, dist);
## calculate the difference in the sum of distances
- new_sumd = obj_cost (D, classes);
err = sum (sumd - new_sumd);
## update the current sum of distances
sumd = new_sumd;
@@ -390,22 +381,30 @@ function [classes, centers, sumd, D] = kmeans (data, k,
varargin)
endif
endfor
centers = best_centers;
- sumd = best';
+ ## Compute final distances, classes and sums
+ [D, classes, sumd] = update_dist (data, centers, D, k, dist);
+
+ ## Return with equal size as inputs
+ if (original_rows != rows (data))
+ final = NA (original_rows,1);
+ final(data_idx) = classes; ## other positions already NaN / NA
+ classes = final;
+ endif
- final_classes = NA (original_rows,1);
- final_classes(data_idx) = classes; ## other positions already NaN / NA
- classes = final_classes;
endfunction
-## calculate the sum of within-class distances
-function obj = obj_cost (D, classes)
- obj = zeros (1,columns (D));
- for i = 1:columns (D)
- idx = (classes == i);
- obj(i) = sum (D(idx,i));
- end
+## Update distances, classes and sums
+function [D, classes, sumd] = update_dist (data, centers, D, k, dist)
+ for i = 1:k
+ D (:, i) = dist (data, centers(i, :));
+ endfor
+ [~, classes] = min (D, [], 2);
+ ## calculate the sum of within-class distances
+ sumd = zeros (k, 1);
+ for i = 1:k
+ sumd(i) = sum (D(classes == i,i));
+ endfor
endfunction
-
## Test input parsing
%!error kmeans (rand (3,2), 4);
++++++ statistics-1.4.0.tar.gz -> statistics-1.4.1.tar.gz ++++++
++++ 1623 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/DESCRIPTION new/statistics-1.4.1/DESCRIPTION
--- old/statistics-1.4.0/DESCRIPTION 2018-05-19 06:40:09.350499425 +0200
+++ new/statistics-1.4.1/DESCRIPTION 2019-03-17 14:45:17.000000000 +0100
@@ -1,6 +1,6 @@
Name: statistics
-Version: 1.4.0
-Date: 2018-05-11
+Version: 1.4.1
+Date: 2019-03-17
Author: various authors
Maintainer: Octave-Forge community <[email protected]>
Title: Statistics
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/Makefile new/statistics-1.4.1/Makefile
--- old/statistics-1.4.0/Makefile 2018-05-19 06:40:09.350499425 +0200
+++ new/statistics-1.4.1/Makefile 2019-03-17 14:45:17.000000000 +0100
@@ -2,11 +2,13 @@
## Copyright 2015-2016 Oliver Heimlich
## Copyright 2017 Julien Bect <[email protected]>
## Copyright 2017 Olaf Till <[email protected]>
+## Copyright 2018 John Donoghue <[email protected]>
##
## Copying and distribution of this file, with or without modification,
## are permitted in any medium without royalty provided the copyright
## notice and this notice are preserved. This file is offered as-is,
## without any warranty.
+TOPDIR := $(shell pwd)
## Some basic tools (can be overriden using environment variables)
SED ?= sed
@@ -218,8 +220,7 @@
else __run_test_suite__ (dirs, {}); endif '
octave_test_commands = \
' pkgs = pkg("list", "$(package)"); \
- cd ("$(target_dir)/"); \
- dirs = {sprintf(".installation/%s-%s", pkgs{1}.name, pkgs{1}.version)}; \
+ dirs = {pkgs{1}.dir}; \
__run_test_suite__ (dirs, {}); '
## the following works, too, but provides no overall summary output as
## __run_test_suite__ does:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/NEWS new/statistics-1.4.1/NEWS
--- old/statistics-1.4.0/NEWS 2018-05-19 06:40:09.354499405 +0200
+++ new/statistics-1.4.1/NEWS 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,18 @@
+Summary of important user-visible changes for statistics 1.4.1:
+-------------------------------------------------------------------
+ ** update install scripts for octave 5.0 depreciated functions
+
+ ** bug fixes to the following functions:
+ pdist2.m: use max in distEucSq (Bug #50377)
+ normpdf: use eps tolerance in tests (Bug #51963)
+ fitgmdist: fix an output bug in fitgmdist
+ t_test: Set tolerance on t_test BISTS (Bug #54557)
+ gpXXXXX: change order of inputs to match matlab (Bug #54009)
+ bartlett_test: df = k-1 (Bug #45894)
+ gppdf: apply scale factor (Bug #54009)
+ gmdistribution: updates for bug #54278, ##54279
+ wishrnd: Bug #55860
+
Summary of important user-visible changes for statistics 1.4.0:
-------------------------------------------------------------------
@@ -8,12 +23,12 @@
gmdistribution
sigma_pts
- ** The following functions have been moved from the statisctics package but
are
- condtionally installed:
+ ** The following functions have been moved from the statistics package but are
+ conditionally installed:
mad
- ** The following functions have been moved from octave to be condtionally
+ ** The following functions have been moved from octave to be conditionally
installed:
BASE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/PKG_ADD new/statistics-1.4.1/PKG_ADD
--- old/statistics-1.4.0/PKG_ADD 2018-05-19 06:40:09.354499405 +0200
+++ new/statistics-1.4.1/PKG_ADD 2019-03-17 14:45:17.000000000 +0100
@@ -6,7 +6,14 @@
## - PKG_ADD (and PKG_DEL?) is run during installation, too, from the
## root directory of the package, where no such subdirectories
## exist.
-if (isdir (fullfile (fileparts (mfilename ("fullpath")), "base")))
- addpath (fullfile (fileparts (mfilename ("fullpath")),
- {"base", "distributions", "models", "tests"}){:});
+if exist ("isfolder") == 0
+ if (isdir (fullfile (fileparts (mfilename ("fullpath")), "base")))
+ addpath (fullfile (fileparts (mfilename ("fullpath")),
+ {"base", "distributions", "models", "tests"}){:});
+ endif
+else
+ if (isfolder (fullfile (fileparts (mfilename ("fullpath")), "base")))
+ addpath (fullfile (fileparts (mfilename ("fullpath")),
+ {"base", "distributions", "models", "tests"}){:});
+ endif
endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/PKG_DEL new/statistics-1.4.1/PKG_DEL
--- old/statistics-1.4.0/PKG_DEL 2018-05-19 06:40:09.354499405 +0200
+++ new/statistics-1.4.1/PKG_DEL 2019-03-17 14:45:17.000000000 +0100
@@ -6,7 +6,14 @@
## - PKG_ADD (and PKG_DEL?) is run during installation, too, from the
## root directory of the package, where no such subdirectories
## exist.
-if (isdir (fullfile (fileparts (mfilename ("fullpath")), "base")))
- rmpath (fullfile (fileparts (mfilename ("fullpath")),
+if exist ("isfolder") == 0
+ if (isdir (fullfile (fileparts (mfilename ("fullpath")), "base")))
+ rmpath (fullfile (fileparts (mfilename ("fullpath")),
{"base", "distributions", "models", "tests"}){:});
+ endif
+else
+ if (isfolder (fullfile (fileparts (mfilename ("fullpath")), "base")))
+ rmpath (fullfile (fileparts (mfilename ("fullpath")),
+ {"base", "distributions", "models", "tests"}){:});
+ endif
endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/bbscdf.m new/statistics-1.4.1/inst/bbscdf.m
--- old/statistics-1.4.0/inst/bbscdf.m 2018-05-19 06:40:09.358499386 +0200
+++ new/statistics-1.4.1/inst/bbscdf.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2018 John Donoghue
## Copyright (C) 2016 Dag Lyberg
## Copyright (C) 1995-2015 Kurt Hornik
##
@@ -18,7 +19,7 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} bbscdf (@var{x}, @var{location}, @var{scale}, @var{shape})
+## @deftypefn {} {} bbscdf (@var{x}, @var{shape}, @var{scale}, @var{location})
## For each element of @var{x}, compute the cumulative distribution function
## (CDF) at @var{x} of the Birnbaum-Saunders distribution with parameters
## @var{location}, @var{scale} and @var{shape}.
@@ -27,7 +28,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: CDF of the Birnbaum-Saunders distribution
-function cdf = bbscdf (x, location, scale, shape)
+function cdf = bbscdf (x, shape, scale, location)
if (nargin != 4)
print_usage ();
@@ -74,21 +75,21 @@
%!shared x,y
%! x = [-1, 0, 1, 2, Inf];
%! y = [0, 0, 1/2, 0.76024993890652337, 1];
-%!assert (bbscdf (x, zeros (1,5), ones (1,5), ones (1,5)), y, eps)
-%!assert (bbscdf (x, zeros (1,5), 1, 1), y, eps)
-%!assert (bbscdf (x, 0, ones (1,5), 1), y, eps)
-%!assert (bbscdf (x, 0, 1, ones (1,5)), y, eps)
-%!assert (bbscdf (x, 0, 1, 1), y, eps)
-%!assert (bbscdf (x, [0, 0, NaN, 0, 0], 1, 1), [y(1:2), NaN, y(4:5)], eps)
-%!assert (bbscdf (x, 0, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)], eps)
-%!assert (bbscdf (x, 0, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)], eps)
-%!assert (bbscdf ([x, NaN], 0, 1, 1), [y, NaN], eps)
+%!assert (bbscdf (x, ones (1,5), ones (1,5), zeros (1,5)), y, eps)
+%!assert (bbscdf (x, 1, 1, zeros (1,5)), y, eps)
+%!assert (bbscdf (x, 1, ones (1,5), 0), y, eps)
+%!assert (bbscdf (x, ones (1,5), 1, 0), y, eps)
+%!assert (bbscdf (x, 1, 1, 0), y, eps)
+%!assert (bbscdf (x, 1, 1, [0, 0, NaN, 0, 0]), [y(1:2), NaN, y(4:5)], eps)
+%!assert (bbscdf (x, 1, [1, 1, NaN, 1, 1], 0), [y(1:2), NaN, y(4:5)], eps)
+%!assert (bbscdf (x, [1, 1, NaN, 1, 1], 1, 0), [y(1:2), NaN, y(4:5)], eps)
+%!assert (bbscdf ([x, NaN], 1, 1, 0), [y, NaN], eps)
## Test class of input preserved
-%!assert (bbscdf (single ([x, NaN]), 0, 1, 1), single ([y, NaN]),
eps('single'))
-%!assert (bbscdf ([x, NaN], single (0), 1, 1), single ([y, NaN]),
eps('single'))
-%!assert (bbscdf ([x, NaN], 0, single (1), 1), single ([y, NaN]),
eps('single'))
-%!assert (bbscdf ([x, NaN], 0, 1, single (1)), single ([y, NaN]),
eps('single'))
+%!assert (bbscdf (single ([x, NaN]), 1, 1, 0), single ([y, NaN]),
eps('single'))
+%!assert (bbscdf ([x, NaN], 1, 1, single (0)), single ([y, NaN]),
eps('single'))
+%!assert (bbscdf ([x, NaN], 1, single (1), 0), single ([y, NaN]),
eps('single'))
+%!assert (bbscdf ([x, NaN], single (1), 1, 0), single ([y, NaN]),
eps('single'))
## Test input validation
%!error bbscdf ()
@@ -99,8 +100,8 @@
%!error bbscdf (ones (2), ones (3), ones(2), ones(2))
%!error bbscdf (ones (2), ones (2), ones(3), ones(2))
%!error bbscdf (ones (2), ones (2), ones(2), ones(3))
-%!error bbscdf (i, 2, 3, 4)
-%!error bbscdf (1, i, 3, 4)
-%!error bbscdf (1, 2, i, 4)
-%!error bbscdf (1, 2, 3, i)
+%!error bbscdf (i, 4, 3, 2)
+%!error bbscdf (1, i, 3, 2)
+%!error bbscdf (1, 4, i, 2)
+%!error bbscdf (1, 4, 3, i)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/bbsinv.m new/statistics-1.4.1/inst/bbsinv.m
--- old/statistics-1.4.0/inst/bbsinv.m 2018-05-19 06:40:09.358499386 +0200
+++ new/statistics-1.4.1/inst/bbsinv.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2018 John Donoghue
## Copyright (C) 2016 Dag Lyberg
## Copyright (C) 1995-2015 Kurt Hornik
##
@@ -18,7 +19,7 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} bbsinv (@var{x}, @var{location}, @var{scale}, @var{shape})
+## @deftypefn {} {} bbsinv (@var{x}, @var{shape}, @var{scale}, @var{location})
## For each element of @var{x}, compute the quantile (the inverse of the CDF)
## at @var{x} of the Birnbaum-Saunders distribution with parameters
## @var{location}, @var{scale}, and @var{shape}.
@@ -27,7 +28,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: Quantile function of the Birnbaum-Saunders distribution
-function inv = bbsinv (x, location, scale, shape)
+function inv = bbsinv (x, shape, scale, location)
if (nargin != 4)
print_usage ();
@@ -82,21 +83,21 @@
%! f = @(x,a,b,c) (a + b * (c * norminv (x) + sqrt (4 + (c *
norminv(x))^2))^2) / 4;
%! x = [-1, 0, 1/4, 1/2, 1, 2];
%! y = [0, 0, f(1/4, 0, 1, 1), 1, Inf, NaN];
-%!assert (bbsinv (x, zeros (1,6), ones (1,6), ones (1,6)), y)
-%!assert (bbsinv (x, zeros (1,6), 1, 1), y)
-%!assert (bbsinv (x, 0, ones (1,6), 1), y)
-%!assert (bbsinv (x, 0, 1, ones (1,6)), y)
-%!assert (bbsinv (x, 0, 1, 1), y)
-%!assert (bbsinv (x, [0, 0, 0, NaN, 0, 0], 1, 1), [y(1:3), NaN, y(5:6)])
-%!assert (bbsinv (x, 0, [1, 1, 1, NaN, 1, 1], 1), [y(1:3), NaN, y(5:6)])
-%!assert (bbsinv (x, 0, 1, [1, 1, 1, NaN, 1, 1]), [y(1:3), NaN, y(5:6)])
-%!assert (bbsinv ([x, NaN], 0, 1, 1), [y, NaN])
+%!assert (bbsinv (x, ones (1,6), ones (1,6), zeros (1,6)), y)
+%!assert (bbsinv (x, 1, 1, zeros (1,6)), y)
+%!assert (bbsinv (x, 1, ones (1,6), 0), y)
+%!assert (bbsinv (x, ones (1,6), 1, 0), y)
+%!assert (bbsinv (x, 1, 1, 0), y)
+%!assert (bbsinv (x, 1, 1, [0, 0, 0, NaN, 0, 0]), [y(1:3), NaN, y(5:6)])
+%!assert (bbsinv (x, 1, [1, 1, 1, NaN, 1, 1], 0), [y(1:3), NaN, y(5:6)])
+%!assert (bbsinv (x, [1, 1, 1, NaN, 1, 1], 1, 0), [y(1:3), NaN, y(5:6)])
+%!assert (bbsinv ([x, NaN], 1, 1, 0), [y, NaN])
## Test class of input preserved
-%!assert (bbsinv (single ([x, NaN]), 0, 1, 1), single ([y, NaN]))
-%!assert (bbsinv ([x, NaN], single (0), 1, 1), single ([y, NaN]))
-%!assert (bbsinv ([x, NaN], 0, single (1), 1), single ([y, NaN]))
-%!assert (bbsinv ([x, NaN], 0, 1, single (1)), single ([y, NaN]))
+%!assert (bbsinv (single ([x, NaN]), 1, 1, 0), single ([y, NaN]))
+%!assert (bbsinv ([x, NaN], 1, 1, single (0)), single ([y, NaN]))
+%!assert (bbsinv ([x, NaN], 1, single (1), 0), single ([y, NaN]))
+%!assert (bbsinv ([x, NaN], single (1), 1, 0), single ([y, NaN]))
## Test input validation
%!error bbsinv ()
@@ -107,8 +108,8 @@
%!error bbsinv (ones (2), ones (3), ones(2), ones(2))
%!error bbsinv (ones (2), ones (2), ones(3), ones(2))
%!error bbsinv (ones (2), ones (2), ones(2), ones(3))
-%!error bbsinv (i, 2, 3, 4)
-%!error bbsinv (1, i, 3, 4)
-%!error bbsinv (1, 2, i, 4)
-%!error bbsinv (1, 2, 3, i)
+%!error bbsinv (i, 4, 3, 2)
+%!error bbsinv (1, i, 3, 2)
+%!error bbsinv (1, 4, i, 2)
+%!error bbsinv (1, 4, 3, i)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/bbspdf.m new/statistics-1.4.1/inst/bbspdf.m
--- old/statistics-1.4.0/inst/bbspdf.m 2018-05-19 06:40:09.358499386 +0200
+++ new/statistics-1.4.1/inst/bbspdf.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2018 John Donoghue
## Copyright (C) 2016 Dag Lyberg
## Copyright (C) 1995-2015 Kurt Hornik
##
@@ -18,7 +19,7 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} bbspdf (@var{x}, @var{location}, @var{scale}, @var{shape})
+## @deftypefn {} {} bbspdf (@var{x}, @var{shape}, @var{scale}, @var{location})
## For each element of @var{x}, compute the probability density function (PDF)
## at @var{x} of the Birnbaum-Saunders distribution with parameters
## @var{location}, @var{scale} and @var{shape}.
@@ -27,7 +28,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: PDF of the Birnbaum-Saunders distribution
-function pdf = bbspdf (x, location, scale, shape)
+function pdf = bbspdf (x, shape, scale, location)
if (nargin != 4)
print_usage ();
@@ -80,21 +81,21 @@
%!shared x,y
%! x = [-1, 0, 1, 2, Inf];
%! y = [0, 0, 0.3989422804014327, 0.1647717335503959, 0];
-%!assert (bbspdf (x, zeros (1,5), ones (1,5), ones (1,5)), y, eps)
-%!assert (bbspdf (x, zeros (1,5), 1, 1), y, eps)
-%!assert (bbspdf (x, 0, ones (1,5), 1), y, eps)
-%!assert (bbspdf (x, 0, 1, ones (1,5)), y, eps)
-%!assert (bbspdf (x, 0, 1, 1), y, eps)
-%!assert (bbspdf (x, [0, 0, NaN, 0, 0], 1, 1), [y(1:2), NaN, y(4:5)], eps)
-%!assert (bbspdf (x, 0, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)], eps)
-%!assert (bbspdf (x, 0, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)], eps)
-%!assert (bbspdf ([x, NaN], 0, 1, 1), [y, NaN], eps)
+%!assert (bbspdf (x, ones (1,5), ones (1,5), zeros (1,5)), y, eps)
+%!assert (bbspdf (x, 1, 1, zeros (1,5)), y, eps)
+%!assert (bbspdf (x, 1, ones (1,5), 0), y, eps)
+%!assert (bbspdf (x, ones (1,5), 1, 0), y, eps)
+%!assert (bbspdf (x, 1, 1, 0), y, eps)
+%!assert (bbspdf (x, 1, 1, [0, 0, NaN, 0, 0]), [y(1:2), NaN, y(4:5)], eps)
+%!assert (bbspdf (x, 1, [1, 1, NaN, 1, 1], 0), [y(1:2), NaN, y(4:5)], eps)
+%!assert (bbspdf (x, [1, 1, NaN, 1, 1], 1, 0), [y(1:2), NaN, y(4:5)], eps)
+%!assert (bbspdf ([x, NaN], 1, 1, 0), [y, NaN], eps)
## Test class of input preserved
-%!assert (bbspdf (single ([x, NaN]), 0, 1, 1), single ([y, NaN]),
eps('single'))
-%!assert (bbspdf ([x, NaN], single (0), 1, 1), single ([y, NaN]),
eps('single'))
-%!assert (bbspdf ([x, NaN], 0, single (1), 1), single ([y, NaN]),
eps('single'))
-%!assert (bbspdf ([x, NaN], 0, 1, single (1)), single ([y, NaN]),
eps('single'))
+%!assert (bbspdf (single ([x, NaN]), 1, 1, 0), single ([y, NaN]),
eps('single'))
+%!assert (bbspdf ([x, NaN], 1, 1, single (0)), single ([y, NaN]),
eps('single'))
+%!assert (bbspdf ([x, NaN], 1, single (1), 0), single ([y, NaN]),
eps('single'))
+%!assert (bbspdf ([x, NaN], single (1), 1, 0), single ([y, NaN]),
eps('single'))
## Test input validation
%!error bbspdf ()
@@ -105,8 +106,8 @@
%!error bbspdf (ones (2), ones (3), ones(2), ones(2))
%!error bbspdf (ones (2), ones (2), ones(3), ones(2))
%!error bbspdf (ones (2), ones (2), ones(2), ones(3))
-%!error bbspdf (i, 2, 3, 4)
-%!error bbspdf (1, i, 3, 4)
-%!error bbspdf (1, 2, i, 4)
-%!error bbspdf (1, 2, 3, i)
+%!error bbspdf (i, 4, 3, 2)
+%!error bbspdf (1, i, 3, 2)
+%!error bbspdf (1, 4, i, 2)
+%!error bbspdf (1, 4, 3, i)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/bbsrnd.m new/statistics-1.4.1/inst/bbsrnd.m
--- old/statistics-1.4.0/inst/bbsrnd.m 2018-05-19 06:40:09.358499386 +0200
+++ new/statistics-1.4.1/inst/bbsrnd.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2018 John Donoghue
## Copyright (C) 2016 Dag Lyberg
## Copyright (C) 1995-2015 Kurt Hornik
##
@@ -18,10 +19,10 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} bbsrnd (@var{location}, @var{scale}, @var{shape})
-## @deftypefnx {} {} bbsrnd (@var{location}, @var{scale}, @var{shape}, @var{r})
-## @deftypefnx {} {} bbsrnd (@var{location}, @var{scale}, @var{shape},
@var{r}, @var{c}, @dots{})
-## @deftypefnx {} {} bbsrnd (@var{location}, @var{scale}, @var{shape},
[@var{sz}])
+## @deftypefn {} {} bbsrnd (@var{shape}, @var{scale}, @var{location})
+## @deftypefnx {} {} bbsrnd (@var{shape}, @var{scale}, @var{location}, @var{r})
+## @deftypefnx {} {} bbsrnd (@var{shape}, @var{scale}, @var{location},
@var{r}, @var{c}, @dots{})
+## @deftypefnx {} {} bbsrnd (@var{shape}, @var{scale}, @var{location},
[@var{sz}])
## Return a matrix of random samples from the Birnbaum-Saunders
## distribution with parameters @var{location}, @var{scale} and @var{shape}.
##
@@ -38,7 +39,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: Random deviates from the Birnbaum-Saunders distribution
-function rnd = bbsrnd (location, scale, shape, varargin)
+function rnd = bbsrnd (shape, scale, location, varargin)
if (nargin < 3)
print_usage ();
@@ -105,25 +106,25 @@
endfunction
-%!assert (size (bbsrnd (0, 1, 1)), [1 1])
-%!assert (size (bbsrnd (zeros (2,1), 1, 1)), [2, 1])
-%!assert (size (bbsrnd (zeros (2,2), 1, 1)), [2, 2])
-%!assert (size (bbsrnd (0, ones (2,1), 1)), [2, 1])
-%!assert (size (bbsrnd (0, ones (2,2), 1)), [2, 2])
-%!assert (size (bbsrnd (0, 1, ones (2,1))), [2, 1])
-%!assert (size (bbsrnd (0, 1, ones (2,2))), [2, 2])
-%!assert (size (bbsrnd (0, 1, 1, 3)), [3, 3])
-%!assert (size (bbsrnd (0, 1, 1, [4 1])), [4, 1])
-%!assert (size (bbsrnd (0, 1, 1, 4, 1)), [4, 1])
+%!assert (size (bbsrnd (1, 1, 0)), [1 1])
+%!assert (size (bbsrnd (1, 1, zeros (2,1))), [2, 1])
+%!assert (size (bbsrnd (1, 1, zeros (2,2))), [2, 2])
+%!assert (size (bbsrnd (1, ones (2,1), 0)), [2, 1])
+%!assert (size (bbsrnd (1, ones (2,2), 0)), [2, 2])
+%!assert (size (bbsrnd (ones (2,1), 1, 0)), [2, 1])
+%!assert (size (bbsrnd (ones (2,2), 1, 0)), [2, 2])
+%!assert (size (bbsrnd (1, 1, 0, 3)), [3, 3])
+%!assert (size (bbsrnd (1, 1, 0, [4 1])), [4, 1])
+%!assert (size (bbsrnd (1, 1, 0, 4, 1)), [4, 1])
## Test class of input preserved
-%!assert (class (bbsrnd (0,1,1)), "double")
-%!assert (class (bbsrnd (single (0),1,1)), "single")
-%!assert (class (bbsrnd (single ([0 0]),1,1)), "single")
-%!assert (class (bbsrnd (0,single (1),1)), "single")
-%!assert (class (bbsrnd (0,single ([1 1]),1)), "single")
-%!assert (class (bbsrnd (0,1,single (1))), "single")
-%!assert (class (bbsrnd (0,1,single ([1 1]))), "single")
+%!assert (class (bbsrnd (1,1,0)), "double")
+%!assert (class (bbsrnd (1, 1, single (0))), "single")
+%!assert (class (bbsrnd (1, 1, single ([0 0]))), "single")
+%!assert (class (bbsrnd (1, single (1), 0)), "single")
+%!assert (class (bbsrnd (1, single ([1 1]), 0)), "single")
+%!assert (class (bbsrnd (single (1), 1, 0)), "single")
+%!assert (class (bbsrnd (single ([1 1]), 1, 0)), "single")
## Test input validation
%!error bbsrnd ()
@@ -138,7 +139,7 @@
%!error bbsrnd (1,2,3, -1)
%!error bbsrnd (1,2,3, ones (2))
%!error bbsrnd (1,2,3, [2 -1 2])
-%!error bbsrnd (ones (2),1,2, 3)
-%!error bbsrnd (ones (2),1,2, [3, 2])
-%!error bbsrnd (ones (2),1,2, 3, 2)
+%!error bbsrnd (2, 1, ones (2), 3)
+%!error bbsrnd (2, 1, ones (2), [3, 2])
+%!error bbsrnd (2, 1, ones (2), 3, 2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/fitgmdist.m new/statistics-1.4.1/inst/fitgmdist.m
--- old/statistics-1.4.0/inst/fitgmdist.m 2018-05-19 06:40:09.370499328
+0200
+++ new/statistics-1.4.1/inst/fitgmdist.m 2019-03-17 14:45:17.000000000
+0100
@@ -511,7 +511,7 @@
obj = gmdistribution (best_params.mu, best_params.Sigma, best_params.p');
if (Display == 1)
fprintf (" %d iterations log-likelihood = %g\n", ...
- -extra.NegativeLogLikelihood, extra.NumIterations);
+ extra.NumIterations, -extra.NegativeLogLikelihood);
endif
endfunction
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/gmdistribution.m
new/statistics-1.4.1/inst/gmdistribution.m
--- old/statistics-1.4.0/inst/gmdistribution.m 2018-05-19 06:40:09.374499307
+0200
+++ new/statistics-1.4.1/inst/gmdistribution.m 2019-03-17 14:45:17.000000000
+0100
@@ -1,4 +1,5 @@
## Copyright (C) 2015 Lachlan Andrew <[email protected]>
+## Copyright (C) 2018 John Donoghue <[email protected]>
##
## This program is free software; you can redistribute it and/or modify it
under
## the terms of the GNU General Public License as published by the Free
Software
@@ -229,8 +230,11 @@
########################################
## Random numbers from Gaussian mixture distribution
function c = random (obj,n)
+ if nargin == 1
+ n = 1;
+ endif
c = zeros (n, obj.NumVariables);
- classes = randsample (obj.NumVariables, n, true,
obj.ComponentProportion);
+ classes = randsample (obj.NumComponents, n, true,
obj.ComponentProportion);
if (obj.SharedCovariance)
if (obj.DiagonalCovariance)
sig = diag (obj.Sigma);
@@ -262,7 +266,7 @@
methods (Static)
## Gaussian mixture parameter estimates
function c = fit (X,k,varargin)
- c = fitgmdist (X,k,varargin);
+ c = fitgmdist (X,k,varargin{:});
endfunction
endmethods
@@ -338,4 +342,7 @@
%!
%! R = GM.random(20);
%! assert (size(R), [20, 2]);
+%!
+%! R = GM.random();
+%! assert (size(R), [1, 2]);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/gpcdf.m new/statistics-1.4.1/inst/gpcdf.m
--- old/statistics-1.4.0/inst/gpcdf.m 2018-05-19 06:40:09.374499307 +0200
+++ new/statistics-1.4.1/inst/gpcdf.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2018 John Donoghue
## Copyright (C) 2016 Dag Lyberg
## Copyright (C) 1997-2015 Kurt Hornik
##
@@ -18,7 +19,7 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} gpcdf (@var{x}, @var{location}, @var{scale}, @var{shape})
+## @deftypefn {} {} gpcdf (@var{x}, @var{shape}, @var{scale}, @var{location})
## Compute the cumulative distribution function (CDF) at @var{x} of the
## generalized Pareto distribution with parameters @var{location}, @var{scale},
## and @var{shape}.
@@ -27,7 +28,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: PDF of the generalized Pareto distribution
-function cdf = gpcdf (x, location, scale, shape)
+function cdf = gpcdf (x, shape, scale, location)
if (nargin != 4)
print_usage ();
@@ -113,50 +114,50 @@
%! y3 = [0, 0, 0, 1/2, 1, 1];
%! seps = eps('single')*5;
%!assert (gpcdf (x, zeros (1,6), ones (1,6), zeros (1,6)), y1, eps)
-%!assert (gpcdf (x, zeros (1,6), 1, 0), y1, eps)
-%!assert (gpcdf (x, 0, ones (1,6), 0), y1, eps)
%!assert (gpcdf (x, 0, 1, zeros (1,6)), y1, eps)
+%!assert (gpcdf (x, 0, ones (1,6), 0), y1, eps)
+%!assert (gpcdf (x, zeros (1,6), 1, 0), y1, eps)
%!assert (gpcdf (x, 0, 1, 0), y1, eps)
-%!assert (gpcdf (x, [0, 0, 0, NaN, 0, 0], 1, 0), [y1(1:3), NaN, y1(5:6)], eps)
-%!assert (gpcdf (x, 0, [1, 1, 1, NaN, 1, 1], 0), [y1(1:3), NaN, y1(5:6)], eps)
%!assert (gpcdf (x, 0, 1, [0, 0, 0, NaN, 0, 0]), [y1(1:3), NaN, y1(5:6)], eps)
+%!assert (gpcdf (x, 0, [1, 1, 1, NaN, 1, 1], 0), [y1(1:3), NaN, y1(5:6)], eps)
+%!assert (gpcdf (x, [0, 0, 0, NaN, 0, 0], 1, 0), [y1(1:3), NaN, y1(5:6)], eps)
%!assert (gpcdf ([x(1:3), NaN, x(5:6)], 0, 1, 0), [y1(1:3), NaN, y1(5:6)], eps)
-%!assert (gpcdf (x, zeros (1,6), ones (1,6), ones (1,6)), y2, eps)
-%!assert (gpcdf (x, zeros (1,6), 1, 1), y2, eps)
-%!assert (gpcdf (x, 0, ones (1,6), 1), y2, eps)
-%!assert (gpcdf (x, 0, 1, ones (1,6)), y2, eps)
-%!assert (gpcdf (x, 0, 1, 1), y2, eps)
-%!assert (gpcdf (x, [0, 0, 0, NaN, 0, 0], 1, 1), [y2(1:3), NaN, y2(5:6)], eps)
-%!assert (gpcdf (x, 0, [1, 1, 1, NaN, 1, 1], 1), [y2(1:3), NaN, y2(5:6)], eps)
-%!assert (gpcdf (x, 0, 1, [1, 1, 1, NaN, 1, 1]), [y2(1:3), NaN, y2(5:6)], eps)
-%!assert (gpcdf ([x(1:3), NaN, x(5:6)], 0, 1, 1), [y2(1:3), NaN, y2(5:6)], eps)
-
-%!assert (gpcdf (x, zeros (1,6), ones (1,6), -ones (1,6)), y3, eps)
-%!assert (gpcdf (x, zeros (1,6), 1, -1), y3, eps)
-%!assert (gpcdf (x, 0, ones (1,6), -1), y3, eps)
-%!assert (gpcdf (x, 0, 1, -ones (1,6)), y3, eps)
-%!assert (gpcdf (x, 0, 1, -1), y3, eps)
-%!assert (gpcdf (x, [0, 0, 0, NaN, 0, 0], 1, -1), [y1(1:3), NaN, y3(5:6)], eps)
-%!assert (gpcdf (x, 0, [1, 1, 1, NaN, 1, 1], -1), [y1(1:3), NaN, y3(5:6)], eps)
-%!assert (gpcdf (x, 0, 1, [-1, -1, -1, NaN, -1, -1]), [y1(1:3), NaN, y3(5:6)],
eps)
-%!assert (gpcdf ([x(1:3), NaN, x(5:6)], 0, 1, -1), [y1(1:3), NaN, y3(5:6)],
eps)
+%!assert (gpcdf (x, ones (1,6), ones (1,6), zeros (1,6)), y2, eps)
+%!assert (gpcdf (x, 1, 1, zeros (1,6)), y2, eps)
+%!assert (gpcdf (x, 1, ones (1,6), 0), y2, eps)
+%!assert (gpcdf (x, ones (1,6), 1, 0), y2, eps)
+%!assert (gpcdf (x, 1, 1, 0), y2, eps)
+%!assert (gpcdf (x, 1, 1, [0, 0, 0, NaN, 0, 0]), [y2(1:3), NaN, y2(5:6)], eps)
+%!assert (gpcdf (x, 1, [1, 1, 1, NaN, 1, 1], 0), [y2(1:3), NaN, y2(5:6)], eps)
+%!assert (gpcdf (x, [1, 1, 1, NaN, 1, 1], 1, 0), [y2(1:3), NaN, y2(5:6)], eps)
+%!assert (gpcdf ([x(1:3), NaN, x(5:6)], 1, 1, 0), [y2(1:3), NaN, y2(5:6)], eps)
+
+%!assert (gpcdf (x, -ones (1,6), ones (1,6), zeros (1,6)), y3, eps)
+%!assert (gpcdf (x, -1, 1, zeros (1,6)), y3, eps)
+%!assert (gpcdf (x, -1, ones (1,6), 0), y3, eps)
+%!assert (gpcdf (x, -ones (1,6), 1, 0), y3, eps)
+%!assert (gpcdf (x, -1, 1, 0), y3, eps)
+%!assert (gpcdf (x, -1, 1, [0, 0, 0, NaN, 0, 0]), [y1(1:3), NaN, y3(5:6)], eps)
+%!assert (gpcdf (x, -1, [1, 1, 1, NaN, 1, 1], 0), [y1(1:3), NaN, y3(5:6)], eps)
+%!assert (gpcdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0), [y1(1:3), NaN, y3(5:6)],
eps)
+%!assert (gpcdf ([x(1:3), NaN, x(5:6)], -1, 1, 0), [y1(1:3), NaN, y3(5:6)],
eps)
## Test class of input preserved
%!assert (gpcdf (single ([x, NaN]), 0, 1, 0), single ([y1, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], single (0), 1, 0), single ([y1, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], 0, single (1), 0), single ([y1, NaN]),
eps('single'))
%!assert (gpcdf ([x, NaN], 0, 1, single (0)), single ([y1, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], 0, single (1), 0), single ([y1, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], single (0), 1, 0), single ([y1, NaN]),
eps('single'))
-%!assert (gpcdf (single ([x, NaN]), 0, 1, 1), single ([y2, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], single (0), 1, 1), single ([y2, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], 0, single (1), 1), single ([y2, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], 0, 1, single (1)), single ([y2, NaN]),
eps('single'))
-
-%!assert (gpcdf (single ([x, NaN]), 0, 1, -1), single ([y3, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], single (0), 1, -1), single ([y3, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], 0, single (1), -1), single ([y3, NaN]),
eps('single'))
-%!assert (gpcdf ([x, NaN], 0, 1, single (-1)), single ([y3, NaN]),
eps('single'))
+%!assert (gpcdf (single ([x, NaN]), 1, 1, 0), single ([y2, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], 1, 1, single (0)), single ([y2, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], 1, single (1), 0), single ([y2, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], single (1), 1, 0), single ([y2, NaN]),
eps('single'))
+
+%!assert (gpcdf (single ([x, NaN]), -1, 1, 0), single ([y3, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], -1, 1, single (0)), single ([y3, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], -1, single (1), 0), single ([y3, NaN]),
eps('single'))
+%!assert (gpcdf ([x, NaN], single (-1), 1, 0), single ([y3, NaN]),
eps('single'))
## Test input validation
%!error gpcdf ()
@@ -165,9 +166,9 @@
%!error gpcdf (1,2,3)
%!error gpcdf (1,2,3,4,5)
%!error gpcdf (ones (3), ones (2), ones (2), ones (2))
-%!error gpcdf (ones (2), ones (3), ones (2), ones (2))
-%!error gpcdf (ones (2), ones (2), ones (3), ones (2))
%!error gpcdf (ones (2), ones (2), ones (2), ones (3))
+%!error gpcdf (ones (2), ones (2), ones (3), ones (2))
+%!error gpcdf (ones (2), ones (3), ones (2), ones (2))
%!error gpcdf (i, 2, 2, 2)
%!error gpcdf (2, i, 2, 2)
%!error gpcdf (2, 2, i, 2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/gpinv.m new/statistics-1.4.1/inst/gpinv.m
--- old/statistics-1.4.0/inst/gpinv.m 2018-05-19 06:40:09.374499307 +0200
+++ new/statistics-1.4.1/inst/gpinv.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2018 John Donoghue
## Copyright (C) 2016 Dag Lyberg
## Copyright (C) 1997-2015 Kurt Hornik
##
@@ -18,7 +19,7 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} gpinv (@var{x}, @var{location}, @var{scale}, @var{shape})
+## @deftypefn {} {} gpinv (@var{x}, @var{shape}, @var{scale}, @var{location})
## For each element of @var{x}, compute the quantile (the inverse of the CDF)
## at @var{x} of the generalized Pareto distribution with parameters
## @var{location}, @var{scale}, and @var{shape}.
@@ -27,7 +28,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: Quantile function of the generalized Pareto distribution
-function inv = gpinv (x, location, scale, shape)
+function inv = gpinv (x, shape, scale, location)
if (nargin != 4)
print_usage ();
endif
@@ -99,50 +100,50 @@
%! y2 = [NaN, 0, 1, Inf, NaN];
%! y3 = [NaN, 0, 1/2, 1, NaN];
%!assert (gpinv (x, zeros (1,5), ones (1,5), zeros (1,5)), y1)
-%!assert (gpinv (x, zeros (1,5), 1, 0), y1)
-%!assert (gpinv (x, 0, ones (1,5), 0), y1)
%!assert (gpinv (x, 0, 1, zeros (1,5)), y1)
+%!assert (gpinv (x, 0, ones (1,5), 0), y1)
+%!assert (gpinv (x, zeros (1,5), 1, 0), y1)
%!assert (gpinv (x, 0, 1, 0), y1)
-%!assert (gpinv (x, [0, 0, NaN, 0, 0], 1, 0), [y1(1:2), NaN, y1(4:5)])
-%!assert (gpinv (x, 0, [1, 1, NaN, 1, 1], 0), [y1(1:2), NaN, y1(4:5)])
%!assert (gpinv (x, 0, 1, [0, 0, NaN, 0, 0]), [y1(1:2), NaN, y1(4:5)])
+%!assert (gpinv (x, 0, [1, 1, NaN, 1, 1], 0), [y1(1:2), NaN, y1(4:5)])
+%!assert (gpinv (x, [0, 0, NaN, 0, 0], 1, 0), [y1(1:2), NaN, y1(4:5)])
%!assert (gpinv ([x(1:2), NaN, x(4:5)], 0, 1, 0), [y1(1:2), NaN, y1(4:5)])
-%!assert (gpinv (x, zeros (1,5), ones (1,5), ones (1,5)), y2)
-%!assert (gpinv (x, zeros (1,5), 1, 1), y2)
-%!assert (gpinv (x, 0, ones (1,5), 1), y2)
-%!assert (gpinv (x, 0, 1, ones (1,5)), y2)
-%!assert (gpinv (x, 0, 1, 1), y2)
-%!assert (gpinv (x, [0, 0, NaN, 0, 0], 1, 1), [y2(1:2), NaN, y2(4:5)])
-%!assert (gpinv (x, 0, [1, 1, NaN, 1, 1], 1), [y2(1:2), NaN, y2(4:5)])
-%!assert (gpinv (x, 0, 1, [1, 1, NaN, 1, 1]), [y2(1:2), NaN, y2(4:5)])
-%!assert (gpinv ([x(1:2), NaN, x(4:5)], 0, 1, 1), [y2(1:2), NaN, y2(4:5)])
-
-%!assert (gpinv (x, zeros (1,5), ones (1,5), -ones (1,5)), y3)
-%!assert (gpinv (x, zeros (1,5), 1, -1), y3)
-%!assert (gpinv (x, 0, ones (1,5), -1), y3)
-%!assert (gpinv (x, 0, 1, -ones (1,5)), y3)
-%!assert (gpinv (x, 0, 1, -1), y3)
-%!assert (gpinv (x, [0, 0, NaN, 0, 0], 1, -1), [y3(1:2), NaN, y3(4:5)])
-%!assert (gpinv (x, 0, [1, 1, NaN, 1, 1], -1), [y3(1:2), NaN, y3(4:5)])
-%!assert (gpinv (x, 0, 1, -[1, 1, NaN, 1, 1]), [y3(1:2), NaN, y3(4:5)])
-%!assert (gpinv ([x(1:2), NaN, x(4:5)], 0, 1, -1), [y3(1:2), NaN, y3(4:5)])
+%!assert (gpinv (x, ones (1,5), ones (1,5), zeros (1,5)), y2)
+%!assert (gpinv (x, 1, 1, zeros (1,5)), y2)
+%!assert (gpinv (x, 1, ones (1,5), 0), y2)
+%!assert (gpinv (x, ones (1,5), 1, 0), y2)
+%!assert (gpinv (x, 1, 1, 0), y2)
+%!assert (gpinv (x, 1, 1, [0, 0, NaN, 0, 0]), [y2(1:2), NaN, y2(4:5)])
+%!assert (gpinv (x, 1, [1, 1, NaN, 1, 1], 0), [y2(1:2), NaN, y2(4:5)])
+%!assert (gpinv (x, [1, 1, NaN, 1, 1], 1, 0), [y2(1:2), NaN, y2(4:5)])
+%!assert (gpinv ([x(1:2), NaN, x(4:5)], 1, 1, 0), [y2(1:2), NaN, y2(4:5)])
+
+%!assert (gpinv (x, -ones (1,5), ones (1,5), zeros (1,5)), y3)
+%!assert (gpinv (x, -1, 1, zeros (1,5)), y3)
+%!assert (gpinv (x, -1, ones (1,5), 0), y3)
+%!assert (gpinv (x, -ones (1,5), 1, 0), y3)
+%!assert (gpinv (x, -1, 1, 0), y3)
+%!assert (gpinv (x, -1, 1, [0, 0, NaN, 0, 0]), [y3(1:2), NaN, y3(4:5)])
+%!assert (gpinv (x, -1, [1, 1, NaN, 1, 1], 0), [y3(1:2), NaN, y3(4:5)])
+%!assert (gpinv (x, -[1, 1, NaN, 1, 1], 1, 0), [y3(1:2), NaN, y3(4:5)])
+%!assert (gpinv ([x(1:2), NaN, x(4:5)], -1, 1, 0), [y3(1:2), NaN, y3(4:5)])
## Test class of input preserved
%!assert (gpinv (single ([x, NaN]), 0, 1, 0), single ([y1, NaN]))
-%!assert (gpinv ([x, NaN], single (0), 1, 0), single ([y1, NaN]))
-%!assert (gpinv ([x, NaN], 0, single (1), 0), single ([y1, NaN]))
%!assert (gpinv ([x, NaN], 0, 1, single (0)), single ([y1, NaN]))
+%!assert (gpinv ([x, NaN], 0, single (1), 0), single ([y1, NaN]))
+%!assert (gpinv ([x, NaN], single (0), 1, 0), single ([y1, NaN]))
-%!assert (gpinv (single ([x, NaN]), 0, 1, 1), single ([y2, NaN]))
-%!assert (gpinv ([x, NaN], single (0), 1, 1), single ([y2, NaN]))
-%!assert (gpinv ([x, NaN], 0, single (1), 1), single ([y2, NaN]))
-%!assert (gpinv ([x, NaN], 0, 1, single (1)), single ([y2, NaN]))
-
-%!assert (gpinv (single ([x, NaN]), 0, 1, -1), single ([y3, NaN]))
-%!assert (gpinv ([x, NaN], single (0), 1, -1), single ([y3, NaN]))
-%!assert (gpinv ([x, NaN], 0, single (1), -1), single ([y3, NaN]))
-%!assert (gpinv ([x, NaN], 0, 1, single (-1)), single ([y3, NaN]))
+%!assert (gpinv (single ([x, NaN]), 1, 1, 0), single ([y2, NaN]))
+%!assert (gpinv ([x, NaN], 1, 1, single (0)), single ([y2, NaN]))
+%!assert (gpinv ([x, NaN], 1, single (1), 0), single ([y2, NaN]))
+%!assert (gpinv ([x, NaN], single (1), 1, 0), single ([y2, NaN]))
+
+%!assert (gpinv (single ([x, NaN]), -1, 1, 0), single ([y3, NaN]))
+%!assert (gpinv ([x, NaN], -1, 1, single (0)), single ([y3, NaN]))
+%!assert (gpinv ([x, NaN], -1, single (1), 0), single ([y3, NaN]))
+%!assert (gpinv ([x, NaN], single (-1), 1, 0), single ([y3, NaN]))
## Test input validation
%!error gpinv ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/gppdf.m new/statistics-1.4.1/inst/gppdf.m
--- old/statistics-1.4.0/inst/gppdf.m 2018-05-19 06:40:09.374499307 +0200
+++ new/statistics-1.4.1/inst/gppdf.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,3 +1,4 @@
+## Copyright (C) 2018 John Donoghue
## Copyright (C) 2016 Dag Lyberg
## Copyright (C) 1997-2015 Kurt Hornik
##
@@ -18,7 +19,7 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} gppdf (@var{x}, @var{location}, @var{scale}, @var{shape})
+## @deftypefn {} {} gppdf (@var{x}, @var{shape}, @var{scale}, @var{location})
## Compute the probability density function (PDF) at @var{x} of the
## generalized Pareto distribution with parameters @var{location}, @var{scale},
## and @var{shape}.
@@ -27,7 +28,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: PDF of the generalized Pareto distribution
-function pdf = gppdf (x, location, scale, shape)
+function pdf = gppdf (x, shape, scale, location)
if (nargin != 4)
print_usage ();
@@ -69,13 +70,13 @@
j = k & (shape > 0) & (z >= 0);
if (any (j))
- pdf(j) = (shape * z(j) + 1).^(-(shape + 1) / shape);
+ pdf(j) = (shape * z(j) + 1).^(-(shape + 1) / shape) ./ scale;
endif
if (shape < 0)
j = k & (shape < 0) & (0 <= z) & (z <= -1. / shape);
if (any (j))
- pdf(j) = (shape * z(j) + 1).^(-(shape + 1) / shape);
+ pdf(j) = (shape * z(j) + 1).^(-(shape + 1) / shape) ./ scale;
endif
endif
else
@@ -88,13 +89,13 @@
j = k & (shape > 0) & (z >= 0);
if (any (j))
- pdf(j) = (shape(j) .* z(j) + 1).^(-(shape(j) + 1) ./ shape(j));
+ pdf(j) = (shape(j) .* z(j) + 1).^(-(shape(j) + 1) ./ shape(j)) ./
scale(j);
endif
if (any (shape < 0))
j = k & (shape < 0) & (0 <= z) & (z <= -1 ./ shape);
if (any (j))
- pdf(j) = (shape(j) .* z(j) + 1).^(-(shape(j) + 1) ./ shape(j));
+ pdf(j) = (shape(j) .* z(j) + 1).^(-(shape(j) + 1) ./ shape(j)) ./
scale(j);
endif
endif
endif
@@ -108,50 +109,50 @@
%! y2 = [0, 0, 1, 4/9, 1/4, 0];
%! y3 = [0, 0, 1, 1, 1, 0];
%!assert (gppdf (x, zeros (1,6), ones (1,6), zeros (1,6)), y1, eps)
-%!assert (gppdf (x, zeros (1,6), 1, 0), y1, eps)
-%!assert (gppdf (x, 0, ones (1,6), 0), y1, eps)
%!assert (gppdf (x, 0, 1, zeros (1,6)), y1, eps)
+%!assert (gppdf (x, 0, ones (1,6), 0), y1, eps)
+%!assert (gppdf (x, zeros (1,6), 1, 0), y1, eps)
%!assert (gppdf (x, 0, 1, 0), y1, eps)
-%!assert (gppdf (x, [0, 0, 0, NaN, 0, 0], 1, 0), [y1(1:3), NaN, y1(5:6)])
-%!assert (gppdf (x, 0, [1, 1, 1, NaN, 1, 1], 0), [y1(1:3), NaN, y1(5:6)])
%!assert (gppdf (x, 0, 1, [0, 0, 0, NaN, 0, 0]), [y1(1:3), NaN, y1(5:6)])
+%!assert (gppdf (x, 0, [1, 1, 1, NaN, 1, 1], 0), [y1(1:3), NaN, y1(5:6)])
+%!assert (gppdf (x, [0, 0, 0, NaN, 0, 0], 1, 0), [y1(1:3), NaN, y1(5:6)])
%!assert (gppdf ([x(1:3), NaN, x(5:6)], 0, 1, 0), [y1(1:3), NaN, y1(5:6)])
-%!assert (gppdf (x, zeros (1,6), ones (1,6), ones (1,6)), y2, eps)
-%!assert (gppdf (x, zeros (1,6), 1, 1), y2, eps)
-%!assert (gppdf (x, 0, ones (1,6), 1), y2, eps)
-%!assert (gppdf (x, 0, 1, ones (1,6)), y2, eps)
-%!assert (gppdf (x, 0, 1, 1), y2, eps)
-%!assert (gppdf (x, [0, 0, 0, NaN, 0, 0], 1, 1), [y2(1:3), NaN, y2(5:6)])
-%!assert (gppdf (x, 0, [1, 1, 1, NaN, 1, 1], 1), [y2(1:3), NaN, y2(5:6)])
-%!assert (gppdf (x, 0, 1, [1, 1, 1, NaN, 1, 1]), [y2(1:3), NaN, y2(5:6)])
-%!assert (gppdf ([x(1:3), NaN, x(5:6)], 0, 1, 1), [y2(1:3), NaN, y2(5:6)])
-
-%!assert (gppdf (x, zeros (1,6), ones (1,6), -ones (1,6)), y3, eps)
-%!assert (gppdf (x, zeros (1,6), 1, -1), y3, eps)
-%!assert (gppdf (x, 0, ones (1,6), -1), y3, eps)
-%!assert (gppdf (x, 0, 1, -ones (1,6)), y3, eps)
-%!assert (gppdf (x, 0, 1, -1), y3, eps)
-%!assert (gppdf (x, [0, 0, 0, NaN, 0, 0], 1, -1), [y3(1:3), NaN, y3(5:6)])
-%!assert (gppdf (x, 0, [1, 1, 1, NaN, 1, 1], -1), [y3(1:3), NaN, y3(5:6)])
-%!assert (gppdf (x, 0, 1, [-1, -1, -1, NaN, -1, -1]), [y3(1:3), NaN, y3(5:6)])
-%!assert (gppdf ([x(1:3), NaN, x(5:6)], 0, 1, -1), [y3(1:3), NaN, y3(5:6)])
+%!assert (gppdf (x, ones (1,6), ones (1,6), zeros (1,6)), y2, eps)
+%!assert (gppdf (x, 1, 1, zeros (1,6)), y2, eps)
+%!assert (gppdf (x, 1, ones (1,6), 0), y2, eps)
+%!assert (gppdf (x, ones (1,6), 1, 0), y2, eps)
+%!assert (gppdf (x, 1, 1, 0), y2, eps)
+%!assert (gppdf (x, 1, 1, [0, 0, 0, NaN, 0, 0]), [y2(1:3), NaN, y2(5:6)])
+%!assert (gppdf (x, 1, [1, 1, 1, NaN, 1, 1], 0), [y2(1:3), NaN, y2(5:6)])
+%!assert (gppdf (x, [1, 1, 1, NaN, 1, 1], 1, 0), [y2(1:3), NaN, y2(5:6)])
+%!assert (gppdf ([x(1:3), NaN, x(5:6)], 1, 1, 0), [y2(1:3), NaN, y2(5:6)])
+
+%!assert (gppdf (x, -ones (1,6), ones (1,6), zeros (1,6)), y3, eps)
+%!assert (gppdf (x, -1, 1, zeros (1,6)), y3, eps)
+%!assert (gppdf (x, -1, ones (1,6), 0), y3, eps)
+%!assert (gppdf (x, -ones (1,6), 1, 0), y3, eps)
+%!assert (gppdf (x, -1, 1, 0), y3, eps)
+%!assert (gppdf (x, -1, 1, [0, 0, 0, NaN, 0, 0]), [y3(1:3), NaN, y3(5:6)])
+%!assert (gppdf (x, -1, [1, 1, 1, NaN, 1, 1], 0), [y3(1:3), NaN, y3(5:6)])
+%!assert (gppdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0), [y3(1:3), NaN, y3(5:6)])
+%!assert (gppdf ([x(1:3), NaN, x(5:6)], -1, 1, 0), [y3(1:3), NaN, y3(5:6)])
## Test class of input preserved
%!assert (gppdf (single ([x, NaN]), 0, 1, 0), single ([y1, NaN]))
-%!assert (gppdf ([x, NaN], single (0), 1, 0), single ([y1, NaN]))
-%!assert (gppdf ([x, NaN], 0, single (1), 0), single ([y1, NaN]))
%!assert (gppdf ([x, NaN], 0, 1, single (0)), single ([y1, NaN]))
+%!assert (gppdf ([x, NaN], 0, single (1), 0), single ([y1, NaN]))
+%!assert (gppdf ([x, NaN], single (0), 1, 0), single ([y1, NaN]))
-%!assert (gppdf (single ([x, NaN]), 0, 1, 1), single ([y2, NaN]))
-%!assert (gppdf ([x, NaN], single (0), 1, 1), single ([y2, NaN]))
-%!assert (gppdf ([x, NaN], 0, single (1), 1), single ([y2, NaN]))
-%!assert (gppdf ([x, NaN], 0, 1, single (1)), single ([y2, NaN]))
-
-%!assert (gppdf (single ([x, NaN]), 0, 1, -1), single ([y3, NaN]))
-%!assert (gppdf ([x, NaN], single (0), 1, -1), single ([y3, NaN]))
-%!assert (gppdf ([x, NaN], 0, single (1), -1), single ([y3, NaN]))
-%!assert (gppdf ([x, NaN], 0, 1, single (-1)), single ([y3, NaN]))
+%!assert (gppdf (single ([x, NaN]), 1, 1, 0), single ([y2, NaN]))
+%!assert (gppdf ([x, NaN], 1, 1, single (0)), single ([y2, NaN]))
+%!assert (gppdf ([x, NaN], 1, single (1), 0), single ([y2, NaN]))
+%!assert (gppdf ([x, NaN], single (1), 1, 0), single ([y2, NaN]))
+
+%!assert (gppdf (single ([x, NaN]), -1, 1, 0), single ([y3, NaN]))
+%!assert (gppdf ([x, NaN], -1, 1, single (0)), single ([y3, NaN]))
+%!assert (gppdf ([x, NaN], -1, single (1), 0), single ([y3, NaN]))
+%!assert (gppdf ([x, NaN], single (-1), 1, 0), single ([y3, NaN]))
## Test input validation
%!error gppdf ()
@@ -159,9 +160,9 @@
%!error gppdf (1,2)
%!error gppdf (1,2,3)
%!error gppdf (1,2,3,4,5)
-%!error gppdf (1, ones (3), ones (2), ones (2))
-%!error gppdf (1, ones (2), ones (3), ones (2))
%!error gppdf (1, ones (2), ones (2), ones (3))
+%!error gppdf (1, ones (2), ones (3), ones (2))
+%!error gppdf (1, ones (3), ones (2), ones (2))
%!error gppdf (i, 2, 2, 2)
%!error gppdf (2, i, 2, 2)
%!error gppdf (2, 2, i, 2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/gprnd.m new/statistics-1.4.1/inst/gprnd.m
--- old/statistics-1.4.0/inst/gprnd.m 2018-05-19 06:40:09.374499307 +0200
+++ new/statistics-1.4.1/inst/gprnd.m 2019-03-17 14:45:17.000000000 +0100
@@ -18,10 +18,10 @@
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {} {} gprnd (@var{location}, @var{scale}, @var{shape})
-## @deftypefnx {} {} gprnd (@var{location}, @var{scale}, @var{shape}, @var{r})
-## @deftypefnx {} {} gprnd (@var{location}, @var{scale}, @var{shape}, @var{r},
@var{c}, @dots{})
-## @deftypefnx {} {} gprnd (@var{location}, @var{scale}, @var{shape},
[@var{sz}])
+## @deftypefn {} {} gprnd (@var{shape}, @var{scale}, @var{location})
+## @deftypefnx {} {} gprnd (@var{shape}, @var{scale}, @var{location}, @var{r})
+## @deftypefnx {} {} gprnd (@var{shape}, @var{scale}, @var{location}, @var{r},
@var{c}, @dots{})
+## @deftypefnx {} {} gprnd (@var{shape}, @var{scale}, @var{location},
[@var{sz}])
## Return a matrix of random samples from the generalized Pareto distribution
## with parameters @var{location}, @var{scale} and @var{shape}.
##
@@ -38,7 +38,7 @@
## Author: Dag Lyberg <[email protected]>
## Description: Random deviates from the generalized Pareto distribution
-function rnd = gprnd (location, scale, shape, varargin)
+function rnd = gprnd (shape, scale, location, varargin)
if (nargin < 3)
print_usage ();
@@ -114,61 +114,61 @@
%!assert (size (gprnd (0,1,0)), [1, 1])
-%!assert (size (gprnd (zeros (2,1), 1,0)), [2, 1])
-%!assert (size (gprnd (zeros (2,2), 1,0)), [2, 2])
+%!assert (size (gprnd (0, 1, zeros (2,1))), [2, 1])
+%!assert (size (gprnd (0, 1, zeros (2,2))), [2, 2])
%!assert (size (gprnd (0, ones (2,1), 0)), [2, 1])
%!assert (size (gprnd (0, ones (2,2), 0)), [2, 2])
-%!assert (size (gprnd (0,1, zeros (2,1))), [2, 1])
-%!assert (size (gprnd (0,1, zeros (2,2))), [2, 2])
-%!assert (size (gprnd (0,1, 0, 3)), [3, 3])
-%!assert (size (gprnd (0,1, 0, [4 1])), [4, 1])
-%!assert (size (gprnd (0,1, 0, 4, 1)), [4, 1])
-
-%!assert (size (gprnd (0,1,1)), [1, 1])
-%!assert (size (gprnd (zeros (2,1), 1,1)), [2, 1])
-%!assert (size (gprnd (zeros (2,2), 1,1)), [2, 2])
-%!assert (size (gprnd (0, ones (2,1), 1)), [2, 1])
-%!assert (size (gprnd (0, ones (2,2), 1)), [2, 2])
-%!assert (size (gprnd (0,1, ones (2,1))), [2, 1])
-%!assert (size (gprnd (0,1, ones (2,2))), [2, 2])
-%!assert (size (gprnd (0,1, 1, 3)), [3, 3])
-%!assert (size (gprnd (0,1, 1, [4 1])), [4, 1])
-%!assert (size (gprnd (0,1, 1, 4, 1)), [4, 1])
-
-%!assert (size (gprnd (0,1,-1)), [1, 1])
-%!assert (size (gprnd (zeros (2,1), -1,1)), [2, 1])
-%!assert (size (gprnd (zeros (2,2), -1,1)), [2, 2])
-%!assert (size (gprnd (0, ones (2,1), -1)), [2, 1])
-%!assert (size (gprnd (0, ones (2,2), -1)), [2, 2])
-%!assert (size (gprnd (0,1, -ones (2,1))), [2, 1])
-%!assert (size (gprnd (0,1, -ones (2,2))), [2, 2])
-%!assert (size (gprnd (0,1, -1, 3)), [3, 3])
-%!assert (size (gprnd (0,1, -1, [4 1])), [4, 1])
-%!assert (size (gprnd (0,1, -1, 4, 1)), [4, 1])
+%!assert (size (gprnd (zeros (2,1), 1, 0)), [2, 1])
+%!assert (size (gprnd (zeros (2,2), 1, 0)), [2, 2])
+%!assert (size (gprnd (0, 1, 0, 3)), [3, 3])
+%!assert (size (gprnd (0, 1, 0, [4 1])), [4, 1])
+%!assert (size (gprnd (0, 1, 0, 4, 1)), [4, 1])
+
+%!assert (size (gprnd (1,1,0)), [1, 1])
+%!assert (size (gprnd (1, 1, zeros (2,1))), [2, 1])
+%!assert (size (gprnd (1, 1, zeros (2,2))), [2, 2])
+%!assert (size (gprnd (1, ones (2,1), 0)), [2, 1])
+%!assert (size (gprnd (1, ones (2,2), 0)), [2, 2])
+%!assert (size (gprnd (ones (2,1), 1, 0)), [2, 1])
+%!assert (size (gprnd (ones (2,2), 1, 0)), [2, 2])
+%!assert (size (gprnd (1, 1, 0, 3)), [3, 3])
+%!assert (size (gprnd (1, 1, 0, [4 1])), [4, 1])
+%!assert (size (gprnd (1, 1, 0, 4, 1)), [4, 1])
+
+%!assert (size (gprnd (-1, 1, 0)), [1, 1])
+%!assert (size (gprnd (-1, 1, zeros (2,1))), [2, 1])
+%!assert (size (gprnd (1, -1, zeros (2,2))), [2, 2])
+%!assert (size (gprnd (-1, ones (2,1), 0)), [2, 1])
+%!assert (size (gprnd (-1, ones (2,2), 0)), [2, 2])
+%!assert (size (gprnd (-ones (2,1), 1, 0)), [2, 1])
+%!assert (size (gprnd (-ones (2,2), 1, 0)), [2, 2])
+%!assert (size (gprnd (-1, 1, 0, 3)), [3, 3])
+%!assert (size (gprnd (-1, 1, 0, [4 1])), [4, 1])
+%!assert (size (gprnd (-1, 1, 0, 4, 1)), [4, 1])
## Test class of input preserved
%!assert (class (gprnd (0,1,0)), "double")
-%!assert (class (gprnd (single (0),1,0)), "single")
-%!assert (class (gprnd (single ([0 0]),1,0)), "single")
+%!assert (class (gprnd (0, 1, single (0))), "single")
+%!assert (class (gprnd (0, 1, single ([0 0]))), "single")
%!assert (class (gprnd (0,single (1),0)), "single")
%!assert (class (gprnd (0,single ([1 1]),0)), "single")
-%!assert (class (gprnd (0,1,single (0))), "single")
-%!assert (class (gprnd (0,1,single ([0 0]))), "single")
+%!assert (class (gprnd (single (0), 1, 0)), "single")
+%!assert (class (gprnd (single ([0 0]), 1, 0)), "single")
## Test input validation
%!error gprnd ()
%!error gprnd (1)
%!error gprnd (1,2)
-%!error gprnd (zeros (3), ones (2), zeros (2))
-%!error gprnd (zeros (2), ones (3), zeros (2))
%!error gprnd (zeros (2), ones (2), zeros (3))
+%!error gprnd (zeros (2), ones (3), zeros (2))
+%!error gprnd (zeros (3), ones (2), zeros (2))
%!error gprnd (i, 1, 0)
%!error gprnd (0, i, 0)
%!error gprnd (0, 1, i)
%!error gprnd (0,1,0, -1)
%!error gprnd (0,1,0, ones (2))
%!error gprnd (0,1,0, [2 -1 2])
-%!error gprnd (zeros (2),1,0, 3)
-%!error gprnd (zeros (2),1,0, [3, 2])
-%!error gprnd (zeros (2),1,0, 3, 2)
+%!error gprnd (0,1, zeros (2), 3)
+%!error gprnd (0,1, zeros (2), [3, 2])
+%!error gprnd (0,1, zeros (2), 3, 2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/monotone_smooth.m
new/statistics-1.4.1/inst/monotone_smooth.m
--- old/statistics-1.4.0/inst/monotone_smooth.m 2018-05-19 06:40:09.382499268
+0200
+++ new/statistics-1.4.1/inst/monotone_smooth.m 2019-03-17 14:45:17.000000000
+0100
@@ -17,7 +17,9 @@
## -*- texinfo -*-
## @deftypefn {Function File} {@var{yy} =} monotone_smooth (@var{x}, @var{y},
@var{h})
## Produce a smooth monotone increasing approximation to a sampled functional
-## dependence y(x) using a kernel method (an Epanechnikov smoothing kernel is
+## dependence
+##
+## A kernel method is used (an Epanechnikov smoothing kernel is
## applied to y(x); this is integrated to yield the monotone increasing form.
## See Reference 1 for details.)
##
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/pcacov.m new/statistics-1.4.1/inst/pcacov.m
--- old/statistics-1.4.0/inst/pcacov.m 2018-05-19 06:40:09.390499229 +0200
+++ new/statistics-1.4.1/inst/pcacov.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2013 Fernando Damian Nieuwveldt <[email protected]>
+## Copyright (C) 2013-2019 Fernando Damian Nieuwveldt <[email protected]>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
@@ -16,10 +16,10 @@
## @deftypefn {Function File} {[@var{COEFF}]} = pcacov(@var{X})
## @deftypefnx {Function File} {[@var{COEFF},@var{latent}]} = pcacov(@var{X})
## @deftypefnx {Function File} {[@var{COEFF},@var{latent},@var{explained}]} =
pcacov(@var{X})
+## Perform principal component analysis on the nxn covariance matrix X
+##
## @itemize @bullet
## @item
-## pcacov performs principal component analysis on the nxn covariance matrix X
-## @item
## @var{COEFF} : a nxn matrix with columns containing the principal component
coefficients
## @item
## @var{latent} : a vector containing the principal component variances
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/pcares.m new/statistics-1.4.1/inst/pcares.m
--- old/statistics-1.4.0/inst/pcares.m 2018-05-19 06:40:09.390499229 +0200
+++ new/statistics-1.4.1/inst/pcares.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2013 Fernando Damian Nieuwveldt <[email protected]>
+## Copyright (C) 2013-2019 Fernando Damian Nieuwveldt <[email protected]>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
@@ -14,6 +14,8 @@
## -*- texinfo -*-
## @deftypefn {Function File}
{[@var{residuals},@var{reconstructed}]}=pcares(@var{X}, @var{NDIM})
+## Calulate residuals from principal component analysis
+##
## @itemize @bullet
## @item
## @var{X} : N x P Matrix with N observations and P variables, the variables
will be mean centered
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/pdist2.m new/statistics-1.4.1/inst/pdist2.m
--- old/statistics-1.4.0/inst/pdist2.m 2018-05-19 06:40:09.390499229 +0200
+++ new/statistics-1.4.1/inst/pdist2.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2014 Piotr Dollar <[email protected]>
+## Copyright (C) 2014-2019 Piotr Dollar <[email protected]>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
@@ -152,7 +152,7 @@
function dists = distEucSq (x, y)
xx = sumsq (x, 2);
yy = sumsq (y, 2)';
- dists = bsxfun (@plus, xx, yy) - 2 * x * (y');
+ dists = max (0, bsxfun (@plus, xx, yy) - 2 * x * (y'));
endfunction
## euclidean distance as loop for testing purposes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/plsregress.m new/statistics-1.4.1/inst/plsregress.m
--- old/statistics-1.4.0/inst/plsregress.m 2018-05-19 06:40:09.390499229
+0200
+++ new/statistics-1.4.1/inst/plsregress.m 2019-03-17 14:45:17.000000000
+0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2012 Fernando Damian Nieuwveldt <[email protected]>
+## Copyright (C) 2012-2019 Fernando Damian Nieuwveldt <[email protected]>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
@@ -13,8 +13,9 @@
## this program; if not, see <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {Function File}
{[@var{XLOADINGS},@var{YLOADINGS},@var{XSCORES},@var{YSCORES},@var{coefficients},@var{fitted}]
=} ...
-## plsregress(@var{X}, @var{Y}, @var{NCOMP})
+## @deftypefn {Function File}
{[@var{XLOADINGS},@var{YLOADINGS},@var{XSCORES},@var{YSCORES},@var{coefficients},@var{fitted}]
=} plsregress(@var{X}, @var{Y}, @var{NCOMP})
+## Calculate partial least squares regression
+##
## @itemize @bullet
## @item
## @var{X}: Matrix of observations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/princomp.m new/statistics-1.4.1/inst/princomp.m
--- old/statistics-1.4.0/inst/princomp.m 2018-05-19 06:40:09.390499229
+0200
+++ new/statistics-1.4.1/inst/princomp.m 2019-03-17 14:45:17.000000000
+0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2013 Fernando Damian Nieuwveldt <[email protected]>
+## Copyright (C) 2013-2019 Fernando Damian Nieuwveldt <[email protected]>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
@@ -18,10 +18,10 @@
## @deftypefnx {Function File} {[@var{COEFF},@var{SCORE},@var{latent}]} =
princomp(@var{X})
## @deftypefnx {Function File}
{[@var{COEFF},@var{SCORE},@var{latent},@var{tsquare}]} = princomp(@var{X})
## @deftypefnx {Function File} {[...]} = princomp(@var{X},'econ')
+## Performs a principal component analysis on a NxP data matrix X
+##
## @itemize @bullet
## @item
-## princomp performs principal component analysis on a NxP data matrix X
-## @item
## @var{COEFF} : returns the principal component coefficients
## @item
## @var{SCORE} : returns the principal component scores, the representation of
X
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/ttest.m new/statistics-1.4.1/inst/ttest.m
--- old/statistics-1.4.0/inst/ttest.m 2018-05-19 06:40:09.402499170 +0200
+++ new/statistics-1.4.1/inst/ttest.m 2019-03-17 14:45:17.000000000 +0100
@@ -154,7 +154,7 @@
%! [h, pval, ci0] = ttest (x, 0);
%! assert (h, 1)
%! assert (pval, 0)
-%! assert (ci0, ci)
+%! assert (ci0, ci, 2e-15)
%! [h, pval, ci] = ttest (x, 10, "tail", "right", "dim", 2, "alpha", 0.05);
%! assert (h, 0)
%! assert (pval, 0.5, 10*eps)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/inst/wishrnd.m new/statistics-1.4.1/inst/wishrnd.m
--- old/statistics-1.4.0/inst/wishrnd.m 2018-05-19 06:40:09.406499150 +0200
+++ new/statistics-1.4.1/inst/wishrnd.m 2019-03-17 14:45:17.000000000 +0100
@@ -1,4 +1,4 @@
-## Copyright (C) 2013 Nir Krakauer <[email protected]>
+## Copyright (C) 2013-2019 Nir Krakauer <[email protected]>
##
## This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option) any
later version.
##
@@ -10,10 +10,10 @@
## @deftypefn {Function File} {} [@var{W}[, @var{D}]] = wishrnd (@var{Sigma},
@var{df}[, @var{D}][, @var{n}=1])
## Return a random matrix sampled from the Wishart distribution with given
parameters
##
-## Inputs: the @var{p} x @var{p} positive definite matrix @var{Sigma} and
scalar degrees of freedom parameter @var{df} (and optionally the Cholesky
factor @var{D} of @var{Sigma}).
+## Inputs: the @var{p} x @var{p} positive definite matrix @var{Sigma} (or the
lower-triangular Cholesky factor @var{D} of @var{Sigma}) and scalar degrees of
freedom parameter @var{df}.
## @var{df} can be non-integer as long as @var{df} > @var{p}
##
-## Output: a random @var{p} x @var{p} matrix @var{W} from the
Wishart(@var{Sigma}, @var{df}) distribution. If @var{n} > 1, then @var{W} is
@var{p} x @var{p} x @var{n} and holds @var{n} such random matrices.
(Optionally, the Cholesky factor @var{D} of @var{Sigma} is also returned.)
+## Output: a random @var{p} x @var{p} matrix @var{W} from the
Wishart(@var{Sigma}, @var{df}) distribution. If @var{n} > 1, then @var{W} is
@var{p} x @var{p} x @var{n} and holds @var{n} such random matrices.
(Optionally, the lower-triangular Cholesky factor @var{D} of @var{Sigma} is
also returned.)
##
## Averaged across many samples, the mean of @var{W} should approach
@var{df}*@var{Sigma}, and the variance of each element @var{W}_ij should
approach @var{df}*(@var{Sigma}_ij^2 + @var{Sigma}_ii*@var{Sigma}_jj)
##
@@ -22,8 +22,8 @@
## @seealso{iwishrnd, wishpdf}
## @end deftypefn
-## Author: Nir Krakauer <[email protected]>
-## Description: Compute the probability density function of the Wishart
distribution
+## Author: Nir Krakauer <[email protected]>
+## Description: Sample from the Wishart distribution
function [W, D] = wishrnd(Sigma, df, D, n=1)
@@ -33,7 +33,7 @@
if nargin < 3 || isempty(D)
try
- D = chol(Sigma);
+ D = chol(Sigma, 'lower');
catch
error('wishrnd: Cholesky decomposition failed; Sigma probably not positive
definite')
end_try_catch
@@ -59,23 +59,21 @@
for i = 1:n
if df_isint
- Z = randn(df, p) * D;
- W(:, :, i) = Z'*Z;
+ Z = D * randn(p, df);
else
Z = diag(sqrt(chi2rnd(df - (0:(p-1))))); #fill diagonal
#note: chi2rnd(x) is equivalent to 2*randg(x/2), but the latter seems to
offer no performance advantage
Z(ii > jj) = randn(p*(p-1)/2, 1); #fill lower triangle with normally
distributed variates
Z = D * Z;
- W(:, :, i) = Z*Z';
endif
-
-
+ W(:, :, i) = Z*Z';
endfor
endfunction
-
+%!assert(size (wishrnd (1,2)), [1, 1]);
+%!assert(size (wishrnd (1,2,[])), [1, 1]);
%!assert(size (wishrnd (1,2,1)), [1, 1]);
%!assert(size (wishrnd ([],2,1)), [1, 1]);
%!assert(size (wishrnd ([3 1; 1 3], 2.00001, [], 1)), [2, 2]);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/install-conditionally/distributions/normpdf.m
new/statistics-1.4.1/install-conditionally/distributions/normpdf.m
--- old/statistics-1.4.0/install-conditionally/distributions/normpdf.m
2018-05-19 06:40:09.434499012 +0200
+++ new/statistics-1.4.1/install-conditionally/distributions/normpdf.m
2019-03-17 14:45:17.000000000 +0100
@@ -71,12 +71,12 @@
%!shared x,y
%! x = [-Inf 1 2 Inf];
%! y = 1/sqrt(2*pi)*exp (-(x-1).^2/2);
-%!assert (normpdf (x, ones (1,4), ones (1,4)), y)
-%!assert (normpdf (x, 1, ones (1,4)), y)
-%!assert (normpdf (x, ones (1,4), 1), y)
-%!assert (normpdf (x, [0 -Inf NaN Inf], 1), [y(1) NaN NaN NaN])
-%!assert (normpdf (x, 1, [Inf NaN -1 0]), [NaN NaN NaN NaN])
-%!assert (normpdf ([x, NaN], 1, 1), [y, NaN])
+%!assert (normpdf (x, ones (1,4), ones (1,4)), y, eps)
+%!assert (normpdf (x, 1, ones (1,4)), y, eps)
+%!assert (normpdf (x, ones (1,4), 1), y, eps)
+%!assert (normpdf (x, [0 -Inf NaN Inf], 1), [y(1) NaN NaN NaN], eps)
+%!assert (normpdf (x, 1, [Inf NaN -1 0]), [NaN NaN NaN NaN], eps)
+%!assert (normpdf ([x, NaN], 1, 1), [y, NaN], eps)
## Test class of input preserved
%!assert (normpdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single"))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/install-conditionally/tests/bartlett_test.m
new/statistics-1.4.1/install-conditionally/tests/bartlett_test.m
--- old/statistics-1.4.0/install-conditionally/tests/bartlett_test.m
2018-05-19 06:40:09.446498953 +0200
+++ new/statistics-1.4.1/install-conditionally/tests/bartlett_test.m
2019-03-17 14:45:17.000000000 +0100
@@ -55,7 +55,7 @@
v_tot = sum (f .* v) / f_tot;
c = 1 + (sum (1 ./ f) - 1 / f_tot) / (3 * (k - 1));
chisq = (f_tot * log (v_tot) - sum (f .* log (v))) / c;
- df = k;
+ df = k - 1;
pval = 1 - chi2cdf (chisq, df);
if (nargout == 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/install-conditionally/tests/t_test.m
new/statistics-1.4.1/install-conditionally/tests/t_test.m
--- old/statistics-1.4.0/install-conditionally/tests/t_test.m 2018-05-19
06:40:09.450498934 +0200
+++ new/statistics-1.4.1/install-conditionally/tests/t_test.m 2019-03-17
14:45:17.000000000 +0100
@@ -93,7 +93,7 @@
%! tval = -abs (tinv (0.5*pval, n-1));
%! endif
%! unew = tval * std(x)/sqrt(n) + u0;
-%! assert (xbar, unew, 1000*eps);
+%! assert (xbar, unew, 1e6*eps);
%!test
%! x = rand (10,1); n = length (x);
@@ -101,7 +101,7 @@
%! pval = t_test (x, u0, ">");
%! tval = tinv (1-pval, n-1);
%! unew = tval * std(x)/sqrt(n) + u0;
-%! assert (mean (x), unew, 1000*eps);
+%! assert (mean (x), unew, 1e6*eps);
%!test
%! x = rand (10,1); n = length (x);
@@ -109,4 +109,4 @@
%! pval = t_test (x, u0, "<");
%! tval = tinv (pval, n-1);
%! unew = tval * std(x)/sqrt(n) + u0;
-%! assert (mean (x), unew, 1000*eps);
+%! assert (mean (x), unew, 1e6*eps);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/src/configure.ac new/statistics-1.4.1/src/configure.ac
--- old/statistics-1.4.0/src/configure.ac 2018-05-19 06:40:09.454498915
+0200
+++ new/statistics-1.4.1/src/configure.ac 2019-03-17 14:45:17.000000000
+0100
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([statistics], [1.4.0])
+AC_INIT([statistics], [1.4.1])
AC_CANONICAL_TARGET
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/utils/conditional_installation.m
new/statistics-1.4.1/utils/conditional_installation.m
--- old/statistics-1.4.0/utils/conditional_installation.m 2018-05-19
06:40:09.454498915 +0200
+++ new/statistics-1.4.1/utils/conditional_installation.m 2019-03-17
14:45:17.000000000 +0100
@@ -35,6 +35,10 @@
## "functions_to_install")); # defines variable
## # 'install_functions'
+ if exist ("isfolder") == 0
+ isfolder = @(n) isdir(n);
+ endif
+
installed_functions = {};
subdirs = {"base", "distributions", "models", "tests"};
@@ -51,7 +55,7 @@
assert_dir (fullfile (destdir, subdir));
- if (isdir (private_dir = fullfile (srcdir, subdir, "private"))
+ if (isfolder (private_dir = fullfile (srcdir, subdir, "private"))
&& ! ([status, msg] = ...
copyfile (private_dir, fullfile (destdir, subdir))))
@@ -131,7 +135,11 @@
function assert_dir (directory)
- if (! isdir (directory))
+ if exist ("isfolder") == 0
+ isfolder = @(n) isdir(n);
+ endif
+
+ if (! isfolder (directory))
if (! ([succ, msg] = mkdir (directory)))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh
old/statistics-1.4.0/utils/functions_to_install
new/statistics-1.4.1/utils/functions_to_install
--- old/statistics-1.4.0/utils/functions_to_install 2018-05-19
06:40:09.454498915 +0200
+++ new/statistics-1.4.1/utils/functions_to_install 2019-03-17
14:45:17.000000000 +0100
@@ -15,6 +15,7 @@
## "base/corr.m", ...
## "base/corrcoef.m", ...
## "base/cov.m", ...
+## "base/crosstab.m", ...
## "base/gls.m", ...
## "base/histc.m", ...
## "base/iqr.m", ...
@@ -22,6 +23,7 @@
## "base/kurtosis.m", ...
## "base/logit.m", ...
## "base/lscov.m", ...
+## "base/mad.m", ...
## "base/mean.m", ...
## "base/meansq.m", ...
## "base/median.m", ...
@@ -41,112 +43,125 @@
## "base/spearman.m", ...
## "base/statistics.m", ...
## "base/std.m", ...
-## "base/table.m", ...
## "base/var.m", ...
## "base/zscore.m", ...
## ...
-## "distributions/center.m", ...
-## "distributions/cloglog.m", ...
-## "distributions/corr.m", ...
-## "distributions/corrcoef.m", ...
-## "distributions/cov.m", ...
-## "distributions/gls.m", ...
-## "distributions/histc.m", ...
-## "distributions/iqr.m", ...
-## "distributions/kendall.m", ...
-## "distributions/kurtosis.m", ...
-## "distributions/logit.m", ...
-## "distributions/lscov.m", ...
-## "distributions/mean.m", ...
-## "distributions/meansq.m", ...
-## "distributions/median.m", ...
-## "distributions/mode.m", ...
-## "distributions/moment.m", ...
-## "distributions/ols.m", ...
-## "distributions/ppplot.m", ...
-## "distributions/prctile.m", ...
-## "distributions/probit.m", ...
-## "distributions/qqplot.m", ...
-## "distributions/quantile.m", ...
-## "distributions/range.m", ...
-## "distributions/ranks.m", ...
-## "distributions/run_count.m", ...
-## "distributions/runlength.m", ...
-## "distributions/skewness.m", ...
-## "distributions/spearman.m", ...
-## "distributions/statistics.m", ...
-## "distributions/std.m", ...
-## "distributions/table.m", ...
-## "distributions/var.m", ...
-## "distributions/zscore.m", ...
+## "distributions/betacdf.m", ...
+## "distributions/betainv.m", ...
+## "distributions/betapdf.m", ...
+## "distributions/betarnd.m", ...
+## "distributions/binocdf.m", ...
+## "distributions/binoinv.m", ...
+## "distributions/binopdf.m", ...
+## "distributions/binornd.m", ...
+## "distributions/cauchy_cdf.m", ...
+## "distributions/cauchy_inv.m", ...
+## "distributions/cauchy_pdf.m", ...
+## "distributions/cauchy_rnd.m", ...
+## "distributions/chi2cdf.m", ...
+## "distributions/chi2inv.m", ...
+## "distributions/chi2pdf.m", ...
+## "distributions/chi2rnd.m", ...
+## "distributions/discrete_cdf.m", ...
+## "distributions/discrete_inv.m", ...
+## "distributions/discrete_pdf.m", ...
+## "distributions/discrete_rnd.m", ...
+## "distributions/empirical_cdf.m", ...
+## "distributions/empirical_inv.m", ...
+## "distributions/empirical_pdf.m", ...
+## "distributions/empirical_rnd.m", ...
+## "distributions/expcdf.m", ...
+## "distributions/expinv.m", ...
+## "distributions/exppdf.m", ...
+## "distributions/exprnd.m", ...
+## "distributions/fcdf.m", ...
+## "distributions/finv.m", ...
+## "distributions/fpdf.m", ...
+## "distributions/frnd.m", ...
+## "distributions/gamcdf.m", ...
+## "distributions/gaminv.m", ...
+## "distributions/gampdf.m", ...
+## "distributions/gamrnd.m", ...
+## "distributions/geocdf.m", ...
+## "distributions/geoinv.m", ...
+## "distributions/geopdf.m", ...
+## "distributions/geornd.m", ...
+## "distributions/hygecdf.m", ...
+## "distributions/hygeinv.m", ...
+## "distributions/hygepdf.m", ...
+## "distributions/hygernd.m", ...
+## "distributions/kolmogorov_smirnov_cdf.m", ...
+## "distributions/laplace_cdf.m", ...
+## "distributions/laplace_inv.m", ...
+## "distributions/laplace_pdf.m", ...
+## "distributions/laplace_rnd.m", ...
+## "distributions/logistic_cdf.m", ...
+## "distributions/logistic_inv.m", ...
+## "distributions/logistic_pdf.m", ...
+## "distributions/logistic_rnd.m", ...
+## "distributions/logncdf.m", ...
+## "distributions/logninv.m", ...
+## "distributions/lognpdf.m", ...
+## "distributions/lognrnd.m", ...
+## "distributions/nbincdf.m", ...
+## "distributions/nbininv.m", ...
+## "distributions/nbinpdf.m", ...
+## "distributions/nbinrnd.m", ...
+## "distributions/normcdf.m", ...
+## "distributions/norminv.m", ...
+## "distributions/normpdf.m", ...
+## "distributions/normrnd.m", ...
+## "distributions/poisscdf.m", ...
+## "distributions/poissinv.m", ...
+## "distributions/poisspdf.m", ...
+## "distributions/poissrnd.m", ...
+## "distributions/stdnormal_cdf.m", ...
+## "distributions/stdnormal_inv.m", ...
+## "distributions/stdnormal_pdf.m", ...
+## "distributions/stdnormal_rnd.m", ...
+## "distributions/tcdf.m", ...
+## "distributions/tinv.m", ...
+## "distributions/tpdf.m", ...
+## "distributions/trnd.m", ...
+## "distributions/unidcdf.m", ...
+## "distributions/unidinv.m", ...
+## "distributions/unidpdf.m", ...
+## "distributions/unidrnd.m", ...
+## "distributions/unifcdf.m", ...
+## "distributions/unifinv.m", ...
+## "distributions/unifpdf.m", ...
+## "distributions/unifrnd.m", ...
+## "distributions/wblcdf.m", ...
+## "distributions/wblinv.m", ...
+## "distributions/wblpdf.m", ...
+## "distributions/wblrnd.m", ...
+## "distributions/wienrnd.m", ...
## ...
-## "models/center.m", ...
-## "models/cloglog.m", ...
-## "models/corr.m", ...
-## "models/corrcoef.m", ...
-## "models/cov.m", ...
-## "models/gls.m", ...
-## "models/histc.m", ...
-## "models/iqr.m", ...
-## "models/kendall.m", ...
-## "models/kurtosis.m", ...
-## "models/logit.m", ...
-## "models/lscov.m", ...
-## "models/mean.m", ...
-## "models/meansq.m", ...
-## "models/median.m", ...
-## "models/mode.m", ...
-## "models/moment.m", ...
-## "models/ols.m", ...
-## "models/ppplot.m", ...
-## "models/prctile.m", ...
-## "models/probit.m", ...
-## "models/qqplot.m", ...
-## "models/quantile.m", ...
-## "models/range.m", ...
-## "models/ranks.m", ...
-## "models/run_count.m", ...
-## "models/runlength.m", ...
-## "models/skewness.m", ...
-## "models/spearman.m", ...
-## "models/statistics.m", ...
-## "models/std.m", ...
-## "models/table.m", ...
-## "models/var.m", ...
-## "models/zscore.m", ...
+## "models/logistic_regression.m", ...
## ...
-## "tests/center.m", ...
-## "tests/cloglog.m", ...
-## "tests/corr.m", ...
-## "tests/corrcoef.m", ...
-## "tests/cov.m", ...
-## "tests/gls.m", ...
-## "tests/histc.m", ...
-## "tests/iqr.m", ...
-## "tests/kendall.m", ...
-## "tests/kurtosis.m", ...
-## "tests/logit.m", ...
-## "tests/lscov.m", ...
-## "tests/mean.m", ...
-## "tests/meansq.m", ...
-## "tests/median.m", ...
-## "tests/mode.m", ...
-## "tests/moment.m", ...
-## "tests/ols.m", ...
-## "tests/ppplot.m", ...
-## "tests/prctile.m", ...
-## "tests/probit.m", ...
-## "tests/qqplot.m", ...
-## "tests/quantile.m", ...
-## "tests/range.m", ...
-## "tests/ranks.m", ...
-## "tests/run_count.m", ...
-## "tests/runlength.m", ...
-## "tests/skewness.m", ...
-## "tests/spearman.m", ...
-## "tests/statistics.m", ...
-## "tests/std.m", ...
-## "tests/table.m", ...
-## "tests/var.m", ...
-## "tests/zscore.m" ...
+## "tests/anova.m", ...
+## "tests/bartlett_test.m", ...
+## "tests/chisquare_test_homogeneity.m", ...
+## "tests/chisquare_test_independence.m", ...
+## "tests/cor_test.m", ...
+## "tests/f_test_regression.m", ...
+## "tests/hotelling_test_2.m", ...
+## "tests/hotelling_test.m", ...
+## "tests/kolmogorov_smirnov_test_2.m", ...
+## "tests/kolmogorov_smirnov_test.m", ...
+## "tests/kruskal_wallis_test.m", ...
+## "tests/manova.m", ...
+## "tests/mcnemar_test.m", ...
+## "tests/prop_test_2.m", ...
+## "tests/run_test.m", ...
+## "tests/sign_test.m", ...
+## "tests/t_test_2.m", ...
+## "tests/t_test.m", ...
+## "tests/t_test_regression.m", ...
+## "tests/u_test.m", ...
+## "tests/var_test.m", ...
+## "tests/welch_test.m", ...
+## "tests/wilcoxon_test.m", ...
+## "tests/z_test_2.m", ...
+## "tests/z_test.m" ...
};