Diff of the two buildlogs: -- --- b1/build.log 2023-08-15 09:00:52.668559161 +0000 +++ b2/build.log 2023-08-15 09:22:30.928934575 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Mon Aug 14 20:35:22 -12 2023 -I: pbuilder-time-stamp: 1692088522 +I: Current time: Tue Aug 15 23:01:02 +14 2023 +I: pbuilder-time-stamp: 1692090062 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/bullseye-reproducible-base.tgz] I: copying local configuration @@ -17,8 +17,8 @@ I: copying [./octave-statistics_1.4.2-2.debian.tar.xz] I: Extracting source gpgv: unknown type of key resource 'trustedkeys.kbx' -gpgv: keyblock resource '/tmp/dpkg-verify-sig.FBr1vkgZ/trustedkeys.kbx': General error -gpgv: Signature made Thu Jul 30 08:41:55 2020 -12 +gpgv: keyblock resource '/tmp/dpkg-verify-sig.qf9nr_SN/trustedkeys.kbx': General error +gpgv: Signature made Fri Jul 31 10:41:55 2020 +14 gpgv: using RSA key 3F464391498FE874BDB5D98F2124AA1983785C90 gpgv: Can't check signature: No public key dpkg-source: warning: failed to verify signature on ./octave-statistics_1.4.2-2.dsc @@ -31,135 +31,166 @@ dpkg-source: info: applying t_test-skip.patch I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/22006/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/D01_modify_environment starting +debug: Running on virt32c. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +'/bin/sh' -> '/bin/bash' +lrwxrwxrwx 1 root root 9 Aug 15 23:01 /bin/sh -> /bin/bash +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='armhf' - DEBIAN_FRONTEND='noninteractive' - DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all,-fixfilepath parallel=3 ' - DISTRIBUTION='bullseye' - HOME='/root' - HOST_ARCH='armhf' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="1" [2]="4" [3]="1" [4]="release" [5]="arm-unknown-linux-gnueabihf") + BASH_VERSION='5.1.4(1)-release' + BUILDDIR=/build + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=armhf + DEBIAN_FRONTEND=noninteractive + DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all,-fixfilepath parallel=4 ' + DIRSTACK=() + DISTRIBUTION=bullseye + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=arm + HOST_ARCH=armhf IFS=' ' - INVOCATION_ID='0ccec88ed51a46bead43177778dc1a1a' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='22006' - PS1='# ' - PS2='> ' + INVOCATION_ID=61f7b2643f194ef2bb667466d3665499 + LANG=C + LANGUAGE=it_CH:it + LC_ALL=C + MACHTYPE=arm-unknown-linux-gnueabihf + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnueabihf + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=13458 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.9wDp2ZRQ/pbuilderrc_0U6s --distribution bullseye --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/bullseye-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.9wDp2ZRQ/b1 --logfile b1/build.log octave-statistics_1.4.2-2.dsc' - SUDO_GID='114' - SUDO_UID='108' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' - http_proxy='http://10.0.0.15:3142/' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.9wDp2ZRQ/pbuilderrc_FfTl --distribution bullseye --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/bullseye-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.9wDp2ZRQ/b2 --logfile b2/build.log octave-statistics_1.4.2-2.dsc' + SUDO_GID=113 + SUDO_UID=107 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' + http_proxy=http://10.0.0.15:3142/ I: uname -a - Linux jtx1c 5.10.0-24-arm64 #1 SMP Debian 5.10.179-5 (2023-08-08) aarch64 GNU/Linux + Linux i-capture-the-hostname 6.1.0-11-armmp-lpae #1 SMP Debian 6.1.38-4 (2023-08-08) armv7l GNU/Linux I: ls -l /bin total 3580 - -rwxr-xr-x 1 root root 816764 Mar 27 2022 bash - -rwxr-xr-x 3 root root 26052 Jul 20 2020 bunzip2 - -rwxr-xr-x 3 root root 26052 Jul 20 2020 bzcat - lrwxrwxrwx 1 root root 6 Jul 20 2020 bzcmp -> bzdiff - -rwxr-xr-x 1 root root 2225 Jul 20 2020 bzdiff - lrwxrwxrwx 1 root root 6 Jul 20 2020 bzegrep -> bzgrep - -rwxr-xr-x 1 root root 4877 Sep 4 2019 bzexe - lrwxrwxrwx 1 root root 6 Jul 20 2020 bzfgrep -> bzgrep - -rwxr-xr-x 1 root root 3775 Jul 20 2020 bzgrep - -rwxr-xr-x 3 root root 26052 Jul 20 2020 bzip2 - -rwxr-xr-x 1 root root 9636 Jul 20 2020 bzip2recover - lrwxrwxrwx 1 root root 6 Jul 20 2020 bzless -> bzmore - -rwxr-xr-x 1 root root 1297 Jul 20 2020 bzmore - -rwxr-xr-x 1 root root 26668 Sep 22 2020 cat - -rwxr-xr-x 1 root root 43104 Sep 22 2020 chgrp - -rwxr-xr-x 1 root root 38984 Sep 22 2020 chmod - -rwxr-xr-x 1 root root 43112 Sep 22 2020 chown - -rwxr-xr-x 1 root root 92616 Sep 22 2020 cp - -rwxr-xr-x 1 root root 75524 Dec 10 2020 dash - -rwxr-xr-x 1 root root 75880 Sep 22 2020 date - -rwxr-xr-x 1 root root 55436 Sep 22 2020 dd - -rwxr-xr-x 1 root root 59912 Sep 22 2020 df - -rwxr-xr-x 1 root root 96764 Sep 22 2020 dir - -rwxr-xr-x 1 root root 55012 Jan 20 2022 dmesg - lrwxrwxrwx 1 root root 8 Nov 6 2019 dnsdomainname -> hostname - lrwxrwxrwx 1 root root 8 Nov 6 2019 domainname -> hostname - -rwxr-xr-x 1 root root 22508 Sep 22 2020 echo - -rwxr-xr-x 1 root root 28 Jan 24 2023 egrep - -rwxr-xr-x 1 root root 22496 Sep 22 2020 false - -rwxr-xr-x 1 root root 28 Jan 24 2023 fgrep - -rwxr-xr-x 1 root root 47492 Jan 20 2022 findmnt - -rwsr-xr-x 1 root root 26076 Feb 26 2021 fusermount - -rwxr-xr-x 1 root root 124508 Jan 24 2023 grep - -rwxr-xr-x 2 root root 2346 Apr 9 2022 gunzip - -rwxr-xr-x 1 root root 6447 Apr 9 2022 gzexe - -rwxr-xr-x 1 root root 64212 Apr 9 2022 gzip - -rwxr-xr-x 1 root root 13784 Nov 6 2019 hostname - -rwxr-xr-x 1 root root 43180 Sep 22 2020 ln - -rwxr-xr-x 1 root root 35068 Feb 7 2020 login - -rwxr-xr-x 1 root root 96764 Sep 22 2020 ls - -rwxr-xr-x 1 root root 99940 Jan 20 2022 lsblk - -rwxr-xr-x 1 root root 51408 Sep 22 2020 mkdir - -rwxr-xr-x 1 root root 43184 Sep 22 2020 mknod - -rwxr-xr-x 1 root root 30780 Sep 22 2020 mktemp - -rwxr-xr-x 1 root root 34408 Jan 20 2022 more - -rwsr-xr-x 1 root root 34400 Jan 20 2022 mount - -rwxr-xr-x 1 root root 9824 Jan 20 2022 mountpoint - -rwxr-xr-x 1 root root 88524 Sep 22 2020 mv - lrwxrwxrwx 1 root root 8 Nov 6 2019 nisdomainname -> hostname - lrwxrwxrwx 1 root root 14 Dec 16 2021 pidof -> /sbin/killall5 - -rwxr-xr-x 1 root root 26652 Sep 22 2020 pwd - lrwxrwxrwx 1 root root 4 Mar 27 2022 rbash -> bash - -rwxr-xr-x 1 root root 30740 Sep 22 2020 readlink - -rwxr-xr-x 1 root root 43104 Sep 22 2020 rm - -rwxr-xr-x 1 root root 30732 Sep 22 2020 rmdir - -rwxr-xr-x 1 root root 14144 Sep 27 2020 run-parts - -rwxr-xr-x 1 root root 76012 Dec 22 2018 sed - lrwxrwxrwx 1 root root 4 Aug 6 21:26 sh -> dash - -rwxr-xr-x 1 root root 22532 Sep 22 2020 sleep - -rwxr-xr-x 1 root root 55360 Sep 22 2020 stty - -rwsr-xr-x 1 root root 46704 Jan 20 2022 su - -rwxr-xr-x 1 root root 22532 Sep 22 2020 sync - -rwxr-xr-x 1 root root 340872 Feb 16 2021 tar - -rwxr-xr-x 1 root root 9808 Sep 27 2020 tempfile - -rwxr-xr-x 1 root root 67696 Sep 22 2020 touch - -rwxr-xr-x 1 root root 22496 Sep 22 2020 true - -rwxr-xr-x 1 root root 9636 Feb 26 2021 ulockmgr_server - -rwsr-xr-x 1 root root 22108 Jan 20 2022 umount - -rwxr-xr-x 1 root root 22520 Sep 22 2020 uname - -rwxr-xr-x 2 root root 2346 Apr 9 2022 uncompress - -rwxr-xr-x 1 root root 96764 Sep 22 2020 vdir - -rwxr-xr-x 1 root root 38512 Jan 20 2022 wdctl - lrwxrwxrwx 1 root root 8 Nov 6 2019 ypdomainname -> hostname - -rwxr-xr-x 1 root root 1984 Apr 9 2022 zcat - -rwxr-xr-x 1 root root 1678 Apr 9 2022 zcmp - -rwxr-xr-x 1 root root 5898 Apr 9 2022 zdiff - -rwxr-xr-x 1 root root 29 Apr 9 2022 zegrep - -rwxr-xr-x 1 root root 29 Apr 9 2022 zfgrep - -rwxr-xr-x 1 root root 2081 Apr 9 2022 zforce - -rwxr-xr-x 1 root root 8049 Apr 9 2022 zgrep - -rwxr-xr-x 1 root root 2206 Apr 9 2022 zless - -rwxr-xr-x 1 root root 1842 Apr 9 2022 zmore - -rwxr-xr-x 1 root root 4577 Apr 9 2022 znew -I: user script /srv/workspace/pbuilder/22006/tmp/hooks/D02_print_environment finished + -rwxr-xr-x 1 root root 816764 Mar 28 2022 bash + -rwxr-xr-x 3 root root 26052 Jul 21 2020 bunzip2 + -rwxr-xr-x 3 root root 26052 Jul 21 2020 bzcat + lrwxrwxrwx 1 root root 6 Jul 21 2020 bzcmp -> bzdiff + -rwxr-xr-x 1 root root 2225 Jul 21 2020 bzdiff + lrwxrwxrwx 1 root root 6 Jul 21 2020 bzegrep -> bzgrep + -rwxr-xr-x 1 root root 4877 Sep 5 2019 bzexe + lrwxrwxrwx 1 root root 6 Jul 21 2020 bzfgrep -> bzgrep + -rwxr-xr-x 1 root root 3775 Jul 21 2020 bzgrep + -rwxr-xr-x 3 root root 26052 Jul 21 2020 bzip2 + -rwxr-xr-x 1 root root 9636 Jul 21 2020 bzip2recover + lrwxrwxrwx 1 root root 6 Jul 21 2020 bzless -> bzmore + -rwxr-xr-x 1 root root 1297 Jul 21 2020 bzmore + -rwxr-xr-x 1 root root 26668 Sep 23 2020 cat + -rwxr-xr-x 1 root root 43104 Sep 23 2020 chgrp + -rwxr-xr-x 1 root root 38984 Sep 23 2020 chmod + -rwxr-xr-x 1 root root 43112 Sep 23 2020 chown + -rwxr-xr-x 1 root root 92616 Sep 23 2020 cp + -rwxr-xr-x 1 root root 75524 Dec 11 2020 dash + -rwxr-xr-x 1 root root 75880 Sep 23 2020 date + -rwxr-xr-x 1 root root 55436 Sep 23 2020 dd + -rwxr-xr-x 1 root root 59912 Sep 23 2020 df + -rwxr-xr-x 1 root root 96764 Sep 23 2020 dir + -rwxr-xr-x 1 root root 55012 Jan 21 2022 dmesg + lrwxrwxrwx 1 root root 8 Nov 8 2019 dnsdomainname -> hostname + lrwxrwxrwx 1 root root 8 Nov 8 2019 domainname -> hostname + -rwxr-xr-x 1 root root 22508 Sep 23 2020 echo + -rwxr-xr-x 1 root root 28 Jan 25 2023 egrep + -rwxr-xr-x 1 root root 22496 Sep 23 2020 false + -rwxr-xr-x 1 root root 28 Jan 25 2023 fgrep + -rwxr-xr-x 1 root root 47492 Jan 21 2022 findmnt + -rwsr-xr-x 1 root root 26076 Feb 27 2021 fusermount + -rwxr-xr-x 1 root root 124508 Jan 25 2023 grep + -rwxr-xr-x 2 root root 2346 Apr 10 2022 gunzip + -rwxr-xr-x 1 root root 6447 Apr 10 2022 gzexe + -rwxr-xr-x 1 root root 64212 Apr 10 2022 gzip + -rwxr-xr-x 1 root root 13784 Nov 8 2019 hostname + -rwxr-xr-x 1 root root 43180 Sep 23 2020 ln + -rwxr-xr-x 1 root root 35068 Feb 8 2020 login + -rwxr-xr-x 1 root root 96764 Sep 23 2020 ls + -rwxr-xr-x 1 root root 99940 Jan 21 2022 lsblk + -rwxr-xr-x 1 root root 51408 Sep 23 2020 mkdir + -rwxr-xr-x 1 root root 43184 Sep 23 2020 mknod + -rwxr-xr-x 1 root root 30780 Sep 23 2020 mktemp + -rwxr-xr-x 1 root root 34408 Jan 21 2022 more + -rwsr-xr-x 1 root root 34400 Jan 21 2022 mount + -rwxr-xr-x 1 root root 9824 Jan 21 2022 mountpoint + -rwxr-xr-x 1 root root 88524 Sep 23 2020 mv + lrwxrwxrwx 1 root root 8 Nov 8 2019 nisdomainname -> hostname + lrwxrwxrwx 1 root root 14 Dec 17 2021 pidof -> /sbin/killall5 + -rwxr-xr-x 1 root root 26652 Sep 23 2020 pwd + lrwxrwxrwx 1 root root 4 Mar 28 2022 rbash -> bash + -rwxr-xr-x 1 root root 30740 Sep 23 2020 readlink + -rwxr-xr-x 1 root root 43104 Sep 23 2020 rm + -rwxr-xr-x 1 root root 30732 Sep 23 2020 rmdir + -rwxr-xr-x 1 root root 14144 Sep 28 2020 run-parts + -rwxr-xr-x 1 root root 76012 Dec 23 2018 sed + lrwxrwxrwx 1 root root 9 Aug 15 23:01 sh -> /bin/bash + -rwxr-xr-x 1 root root 22532 Sep 23 2020 sleep + -rwxr-xr-x 1 root root 55360 Sep 23 2020 stty + -rwsr-xr-x 1 root root 46704 Jan 21 2022 su + -rwxr-xr-x 1 root root 22532 Sep 23 2020 sync + -rwxr-xr-x 1 root root 340872 Feb 17 2021 tar + -rwxr-xr-x 1 root root 9808 Sep 28 2020 tempfile + -rwxr-xr-x 1 root root 67696 Sep 23 2020 touch + -rwxr-xr-x 1 root root 22496 Sep 23 2020 true + -rwxr-xr-x 1 root root 9636 Feb 27 2021 ulockmgr_server + -rwsr-xr-x 1 root root 22108 Jan 21 2022 umount + -rwxr-xr-x 1 root root 22520 Sep 23 2020 uname + -rwxr-xr-x 2 root root 2346 Apr 10 2022 uncompress + -rwxr-xr-x 1 root root 96764 Sep 23 2020 vdir + -rwxr-xr-x 1 root root 38512 Jan 21 2022 wdctl + lrwxrwxrwx 1 root root 8 Nov 8 2019 ypdomainname -> hostname + -rwxr-xr-x 1 root root 1984 Apr 10 2022 zcat + -rwxr-xr-x 1 root root 1678 Apr 10 2022 zcmp + -rwxr-xr-x 1 root root 5898 Apr 10 2022 zdiff + -rwxr-xr-x 1 root root 29 Apr 10 2022 zegrep + -rwxr-xr-x 1 root root 29 Apr 10 2022 zfgrep + -rwxr-xr-x 1 root root 2081 Apr 10 2022 zforce + -rwxr-xr-x 1 root root 8049 Apr 10 2022 zgrep + -rwxr-xr-x 1 root root 2206 Apr 10 2022 zless + -rwxr-xr-x 1 root root 1842 Apr 10 2022 zmore + -rwxr-xr-x 1 root root 4577 Apr 10 2022 znew +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -644,7 +675,7 @@ Get: 440 http://deb.debian.org/debian bullseye/main armhf dh-octave-autopkgtest all 1.0.3 [9376 B] Get: 441 http://deb.debian.org/debian bullseye/main armhf dh-octave all 1.0.3 [21.9 kB] Get: 442 http://deb.debian.org/debian bullseye/main armhf octave-io armhf 2.6.3-1+b1 [200 kB] -Fetched 133 MB in 18s (7263 kB/s) +Fetched 133 MB in 6s (23.2 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package bsdextrautils. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19450 files and directories currently installed.) @@ -2459,7 +2490,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/octave-statistics-1.4.2/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../octave-statistics_1.4.2-2_source.changes +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for bullseye +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/octave-statistics-1.4.2/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-genchanges -S > ../octave-statistics_1.4.2-2_source.changes dpkg-buildpackage: info: source package octave-statistics dpkg-buildpackage: info: source version 1.4.2-2 dpkg-buildpackage: info: source distribution unstable @@ -2495,9 +2530,9 @@ pkg at line 568 column 9 /usr/share/dh-octave/install-pkg.m at line 43 column 1 -checking build system type... aarch64-unknown-linux-gnu -checking host system type... aarch64-unknown-linux-gnu -checking target system type... aarch64-unknown-linux-gnu +checking build system type... armv7l-unknown-linux-gnueabihf +checking host system type... armv7l-unknown-linux-gnueabihf +checking target system type... armv7l-unknown-linux-gnueabihf checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out @@ -2539,89 +2574,541 @@ dh_octave_check -O--buildsystem=octave Checking package... Checking m files ... -[inst/kmeans.m] ->>>>> /build/octave-statistics-1.4.2/inst/kmeans.m -***** error kmeans (rand (3,2), 4); +[inst/squareform.m] +>>>>> /build/octave-statistics-1.4.2/inst/squareform.m +***** shared v, m + v = 1:6; + m = [0 1 2 3;1 0 4 5;2 4 0 6;3 5 6 0]; +***** assert (squareform (v), m) +***** assert (squareform (squareform (v)), v) +***** assert (squareform (m), v) +***** assert (squareform (v'), m) +***** assert (squareform (1), [0 1;1 0]) +***** assert (squareform (1, "tomatrix"), [0 1; 1 0]) +***** assert (squareform (0, "tovector"), zeros (1, 0)) +***** warning squareform ([0 1 2; 3 0 4; 5 6 0]); ***** test - samples = 4; - dims = 3; - k = 2; - [cls, c, d, z] = kmeans (rand (samples,dims), k, "start", rand (k,dims, 5), - "emptyAction", "singleton"); - assert (size (cls), [samples, 1]); - assert (size (c), [k, dims]); - assert (size (d), [k, 1]); - assert (size (z), [samples, k]); + for c = {@single, @double, @uint8, @uint32, @uint64} + f = c{1}; + assert (squareform (f (v)), f (m)) + assert (squareform (f (m)), f (v)) + endfor +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/gamstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/gamstat.m ***** test - samples = 4; - dims = 3; - k = 2; - [cls, c, d, z] = kmeans (rand (samples,dims), [], "start", rand (k,dims, 5), - "emptyAction", "singleton"); - assert (size (cls), [samples, 1]); - assert (size (c), [k, dims]); - assert (size (d), [k, 1]); - assert (size (z), [samples, k]); + a = 1:6; + b = 1:0.2:2; + [m, v] = gamstat (a, b); + expected_m = [1.00, 2.40, 4.20, 6.40, 9.00, 12.00]; + expected_v = [1.00, 2.88, 5.88, 10.24, 16.20, 24.00]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); ***** test - kmeans (rand (4,3), 2, "start", rand (2,3, 5), "replicates", 5, - "emptyAction", "singleton"); -***** error kmeans (rand (4,3), 2, "start", rand (2,3, 5), "replicates", 1); -***** error kmeans (rand (4,3), 2, "start", rand (2,2)); + a = 1:6; + [m, v] = gamstat (a, 1.5); + expected_m = [1.50, 3.00, 4.50, 6.00, 7.50, 9.00]; + expected_v = [2.25, 4.50, 6.75, 9.00, 11.25, 13.50]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/mvtrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/mvtrnd.m ***** test - kmeans (rand (3,4), 2, "start", "sample", "emptyAction", "singleton"); + sigma = [1, 0.5; 0.5, 1]; + nu = 3; + n = 10; + x = mvtrnd (sigma, nu, n); + assert (size (x), [10, 2]); ***** test - kmeans (rand (3,4), 2, "start", "plus", "emptyAction", "singleton"); + sigma = [1, 0.5; 0.5, 1]; + nu = [2; 3]; + n = 2; + x = mvtrnd (sigma, nu, 2); + assert (size (x), [2, 2]); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/gevrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/gevrnd.m +***** assert(size (gevrnd (1,2,1)), [1, 1]); +***** assert(size (gevrnd (ones(2,1), 2, 1)), [2, 1]); +***** assert(size (gevrnd (ones(2,2), 2, 1)), [2, 2]); +***** assert(size (gevrnd (1, 2*ones(2,1), 1)), [2, 1]); +***** assert(size (gevrnd (1, 2*ones(2,2), 1)), [2, 2]); +***** assert(size (gevrnd (1, 2, 1, 3)), [3, 3]); +***** assert(size (gevrnd (1, 2, 1, [4 1])), [4, 1]); +***** assert(size (gevrnd (1, 2, 1, 4, 1)), [4, 1]); +***** error gevrnd () +***** error gevrnd (1, 2) +***** error gevrnd (ones(3),ones(2),1) +***** error gevrnd (ones(2),ones(3),1) +***** error gevrnd (i, 2, 1) +***** error gevrnd (2, i, 1) +***** error gevrnd (2, 0, 1) +***** error gevrnd (1,2, 1, -1) +***** error gevrnd (1,2, 1, ones(2)) +***** error gevrnd (1,2, 1, [2 -1 2]) +***** error gevrnd (1,2, 1, 1, ones(2)) +***** error gevrnd (1,2, 1, 1, -1) +***** error gevrnd (ones(2,2), 2, 1, 3) +***** error gevrnd (ones(2,2), 2, 1, [3, 2]) +***** error gevrnd (ones(2,2), 2, 1, 2, 3) +23 tests, 23 passed, 0 known failure, 0 skipped +[inst/nakacdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/nakacdf.m +***** shared x,y + x = [-1, 0, 1, 2, Inf]; + y = [0, 0, 0.63212055882855778, 0.98168436111126578, 1]; +***** assert (nakacdf (x, ones (1,5), ones (1,5)), y, eps) +***** assert (nakacdf (x, 1, 1), y, eps) +***** assert (nakacdf (x, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)]) +***** assert (nakacdf (x, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)]) +***** assert (nakacdf ([x, NaN], 1, 1), [y, NaN], eps) +***** assert (nakacdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps('single')) +***** assert (nakacdf ([x, NaN], single (1), 1), single ([y, NaN]), eps('single')) +***** assert (nakacdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps('single')) +***** error nakacdf () +***** error nakacdf (1) +***** error nakacdf (1,2) +***** error nakacdf (1,2,3,4) +***** error nakacdf (ones (3), ones (2), ones(2)) +***** error nakacdf (ones (2), ones (3), ones(2)) +***** error nakacdf (ones (2), ones (2), ones(3)) +***** error nakacdf (i, 2, 2) +***** error nakacdf (2, i, 2) +***** error nakacdf (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/tricdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/tricdf.m +***** shared x,y + x = [-1, 0, 0.1, 0.5, 0.9, 1, 2] + 1; + y = [0, 0, 0.02, 0.5, 0.98, 1 1]; +***** assert (tricdf (x, ones (1,7), 2*ones (1,7), 1.5*ones (1,7)), y, eps) +***** assert (tricdf (x, 1*ones (1,7), 2, 1.5), y, eps) +***** assert (tricdf (x, 1, 2*ones (1,7), 1.5), y, eps) +***** assert (tricdf (x, 1, 2, 1.5*ones (1,7)), y, eps) +***** assert (tricdf (x, 1, 2, 1.5), y, eps) +***** assert (tricdf (x, [1, 1, NaN, 1, 1, 1, 1], 2, 1.5), [y(1:2), NaN, y(4:7)], eps) +***** assert (tricdf (x, 1, 2*[1, 1, NaN, 1, 1, 1, 1], 1.5), [y(1:2), NaN, y(4:7)], eps) +***** assert (tricdf (x, 1, 2, 1.5*[1, 1, NaN, 1, 1, 1, 1]), [y(1:2), NaN, y(4:7)], eps) +***** assert (tricdf ([x, NaN], 1, 2, 1.5), [y, NaN], eps) +***** assert (tricdf (single ([x, NaN]), 1, 2, 1.5), single ([y, NaN]), eps('single')) +***** assert (tricdf ([x, NaN], single (1), 2, 1.5), single ([y, NaN]), eps('single')) +***** assert (tricdf ([x, NaN], 1, single (2), 1.5), single ([y, NaN]), eps('single')) +***** assert (tricdf ([x, NaN], 1, 2, single (1.5)), single ([y, NaN]), eps('single')) +***** error tricdf () +***** error tricdf (1) +***** error tricdf (1,2) +***** error tricdf (1,2,3) +***** error tricdf (1,2,3,4,5) +***** error tricdf (1, ones (3), ones (2), ones (2)) +***** error tricdf (1, ones (2), ones (3), ones (2)) +***** error tricdf (1, ones (2), ones (2), ones (3)) +***** error tricdf (i, 2, 2, 2) +***** error tricdf (2, i, 2, 2) +***** error tricdf (2, 2, i, 2) +***** error tricdf (2, 2, 2, i) +25 tests, 25 passed, 0 known failure, 0 skipped +[inst/nanvar.m] +>>>>> /build/octave-statistics-1.4.2/inst/nanvar.m +***** shared x + x = [1 2 nan 3 4 5]; +***** assert (nanvar (x), var (x(! isnan (x))), 10*eps) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/wblstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/wblstat.m ***** test - kmeans (rand (3,4), 2, "start", "cluster", "emptyAction", "singleton"); + scale = 3:8; + shape = 1:6; + [m, v] = wblstat (scale, shape); + expected_m = [3.0000, 3.5449, 4.4649, 5.4384, 6.4272, 7.4218]; + expected_v = [9.0000, 3.4336, 2.6333, 2.3278, 2.1673, 2.0682]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); ***** test - kmeans (rand (3,4), 2, "start", "uniform", "emptyAction", "singleton"); -***** error kmeans (rand (3,4), 2, "start", "normal"); -***** error kmeans (rand (4,3), 2, "replicates", i); -***** error kmeans (rand (4,3), 2, "replicates", -1); -***** error kmeans (rand (4,3), 2, "replicates", []); -***** error kmeans (rand (4,3), 2, "replicates", [1 2]); -***** error kmeans (rand (4,3), 2, "replicates", "one"); -***** error kmeans (rand (4,3), 2, "MAXITER", i); -***** error kmeans (rand (4,3), 2, "MaxIter", -1); -***** error kmeans (rand (4,3), 2, "maxiter", []); -***** error kmeans (rand (4,3), 2, "maxiter", [1 2]); -***** error kmeans (rand (4,3), 2, "maxiter", "one"); + shape = 1:6; + [m, v] = wblstat (6, shape); + expected_m = [ 6.0000, 5.3174, 5.3579, 5.4384, 5.5090, 5.5663]; + expected_v = [36.0000, 7.7257, 3.7920, 2.3278, 1.5923, 1.1634]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/cmdscale.m] +>>>>> /build/octave-statistics-1.4.2/inst/cmdscale.m +***** shared m, n, X, D + m = randi(100) + 1; n = randi(100) + 1; X = rand(m, n); D = pdist(X); +***** assert(norm(pdist(cmdscale(D))), norm(D), sqrt(eps)) +***** assert(norm(pdist(cmdscale(squareform(D)))), norm(D), sqrt(eps)) +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/mnpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/mnpdf.m ***** test - kmeans (rand (4,3), 2, "distance", "sqeuclidean", "emptyAction", "singleton"); + x = [1, 4, 2]; + p = [0.2, 0.5, 0.3]; + y = mnpdf (x, p); + assert (y, 0.11812, 0.001); ***** test - kmeans (rand (4,3), 2, "distance", "cityblock", "emptyAction", "singleton"); + x = [1, 4, 2; 1, 0, 9]; + p = [0.2, 0.5, 0.3; 0.1, 0.1, 0.8]; + y = mnpdf (x, p); + assert (y, [0.11812; 0.13422], 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/hist3.m] +>>>>> /build/octave-statistics-1.4.2/inst/hist3.m +***** demo + X = [ + 1 1 + 1 1 + 1 10 + 1 10 + 5 5 + 5 5 + 5 5 + 5 5 + 5 5 + 7 3 + 7 3 + 7 3 + 10 10 + 10 10]; + hist3 (X) ***** test - kmeans (rand (4,3), 2, "distance", "cosine", "emptyAction", "singleton"); + N_exp = [ 0 0 0 5 20 + 0 0 10 15 0 + 0 15 10 0 0 + 20 5 0 0 0]; + + n = 100; + x = [1:n]'; + y = [n:-1:1]'; + D = [x y]; + N = hist3 (D, [4 5]); + assert (N, N_exp); ***** test - kmeans (rand (4,3), 2, "distance", "correlation", "emptyAction", "singleton"); + N_exp = [0 0 0 0 1 + 0 0 0 0 1 + 0 0 0 0 1 + 1 1 1 1 93]; + + n = 100; + x = [1:n]'; + y = [n:-1:1]'; + D = [x y]; + C{1} = [1 1.7 3 4]; + C{2} = [1:5]; + N = hist3 (D, C); + assert (N, N_exp); ***** test - kmeans (rand (4,3), 2, "distance", "hamming", "emptyAction", "singleton"); -***** error kmeans (rand (4,3), 2, "distance", "manhattan"); -***** error kmeans ([1 0; 1.1 0], 2, "start", eye(2), "emptyaction", "error"); + D = [1 1; 3 1; 3 3; 3 1]; + [c, nn] = hist3 (D, {0:4, 0:4}); + exp_c = zeros (5); + exp_c([7 9 19]) = [1 2 1]; + assert (c, exp_c); + assert (nn, {0:4, 0:4}); ***** test - kmeans ([1 0; 1.1 0], 2, "start", eye(2), "emptyaction", "singleton"); + for i = 10 + assert (size (hist3 (rand (9, 2), "Edges", {[0:.2:1]; [0:.2:1]})), [6 6]) + endfor ***** test - [cls, c] = kmeans ([1 0; 2 0], 2, "start", [8,0;0,8], "emptyaction", "drop"); - assert (cls, [1; 1]); - assert (c, [1.5, 0; NA, NA]); -***** error kmeans ([1 0; 1.1 0], 2, "start", eye(2), "emptyaction", "panic"); -***** demo - ## Generate a two-cluster problem - C1 = randn (100, 2) + 1; - C2 = randn (100, 2) - 1; - data = [C1; C2]; + edge_1 = linspace (0, 10, 10); + edge_2 = linspace (0, 50, 10); + [c, nn] = hist3 ([1:10; 1:5:50]', "Edges", {edge_1, edge_2}); + exp_c = zeros (10, 10); + exp_c([1 12 13 24 35 46 57 68 79 90]) = 1; + assert (c, exp_c); - ## Perform clustering - [idx, centers] = kmeans (data, 2); + assert (nn{1}, edge_1 + edge_1(2)/2, eps*10^4) + assert (nn{2}, edge_2 + edge_2(2)/2, eps*10^4) +***** shared X + X = [ + 5 2 + 5 3 + 1 4 + 5 3 + 4 4 + 1 2 + 2 3 + 3 3 + 5 4 + 5 3]; +***** test + N = zeros (10); + N([1 10 53 56 60 91 98 100]) = [1 1 1 1 3 1 1 1]; + C = {(1.2:0.4:4.8), (2.1:0.2:3.9)}; + assert (nthargout ([1 2], @hist3, X), {N C}, eps*10^3) +***** test + N = zeros (5, 7); + N([1 5 17 18 20 31 34 35]) = [1 1 1 1 3 1 1 1]; + C = {(1.4:0.8:4.6), ((2+(1/7)):(2/7):(4-(1/7)))}; + assert (nthargout ([1 2], @hist3, X, [5 7]), {N C}, eps*10^3) + assert (nthargout ([1 2], @hist3, X, "Nbins", [5 7]), {N C}, eps*10^3) +***** test + N = [0 1 0; 0 1 0; 0 0 1; 0 0 0]; + C = {(2:5), (2.5:1:4.5)}; + assert (nthargout ([1 2], @hist3, X, "Edges", {(1.5:4.5), (2:4)}), {N C}) +***** test + N = [0 0 1 0 1 0; 0 0 0 1 0 0; 0 0 1 4 2 0]; + C = {(1.2:3.2), (0:5)}; + assert (nthargout ([1 2], @hist3, X, "Ctrs", C), {N C}) + assert (nthargout ([1 2], @hist3, X, C), {N C}) +***** test + [~, C] = hist3 (rand (10, 2), "Edges", {[0 .05 .15 .35 .55 .95], + [-1 .05 .07 .2 .3 .5 .89 1.2]}); + C_exp = {[ 0.025 0.1 0.25 0.45 0.75 1.15], ... + [-0.475 0.06 0.135 0.25 0.4 0.695 1.045 1.355]}; + assert (C, C_exp, eps*10^2) +***** test + Xv = repmat ([1:10]', [1 2]); - ## Plot the result - figure; - plot (data (idx==1, 1), data (idx==1, 2), 'ro'); - hold on; - plot (data (idx==2, 1), data (idx==2, 2), 'bs'); - plot (centers (:, 1), centers (:, 2), 'kv', 'markersize', 10); - hold off; -31 tests, 31 passed, 0 known failure, 0 skipped + ## Test Centers + assert (hist3 (Xv, "Ctrs", {1:10, 1:10}), eye (10)) + + N_exp = eye (6); + N_exp([1 end]) = 3; + assert (hist3 (Xv, "Ctrs", {3:8, 3:8}), N_exp) + + N_exp = zeros (8, 6); + N_exp([1 2 11 20 29 38 47 48]) = [2 1 1 1 1 1 1 2]; + assert (hist3 (Xv, "Ctrs", {2:9, 3:8}), N_exp) + + ## Test Edges + assert (hist3 (Xv, "Edges", {1:10, 1:10}), eye (10)) + assert (hist3 (Xv, "Edges", {3:8, 3:8}), eye (6)) + assert (hist3 (Xv, "Edges", {2:9, 3:8}), [zeros(1, 6); eye(6); zeros(1, 6)]) + + N_exp = zeros (14); + N_exp(3:12, 3:12) = eye (10); + assert (hist3 (Xv, "Edges", {-1:12, -1:12}), N_exp) + + ## Test for Nbins + assert (hist3 (Xv), eye (10)) + assert (hist3 (Xv, [10 10]), eye (10)) + assert (hist3 (Xv, "nbins", [10 10]), eye (10)) + assert (hist3 (Xv, [5 5]), eye (5) * 2) + + N_exp = zeros (7, 5); + N_exp([1 9 10 18 26 27 35]) = [2 1 1 2 1 1 2]; + assert (hist3 (Xv, [7 5]), N_exp) +***** test # bug #51059 + D = [1 1; NaN 2; 3 1; 3 3; 1 NaN; 3 1]; + [c, nn] = hist3 (D, {0:4, 0:4}); + exp_c = zeros (5); + exp_c([7 9 19]) = [1 2 1]; + assert (c, exp_c) + assert (nn, {0:4, 0:4}) +***** test + [c, nn] = hist3 ([1 8]); + exp_c = zeros (10, 10); + exp_c(6, 6) = 1; + exp_nn = {-4:5, 3:12}; + assert (c, exp_c) + assert (nn, exp_nn, eps) + + [c, nn] = hist3 ([1 8], [10 11]); + exp_c = zeros (10, 11); + exp_c(6, 6) = 1; + exp_nn = {-4:5, 3:13}; + assert (c, exp_c) + assert (nn, exp_nn, eps) +***** test + [c, nn] = hist3 ([1 NaN; 2 3; 6 9; 8 NaN]); + exp_c = zeros (10, 10); + exp_c(2, 1) = 1; + exp_c(8, 10) = 1; + exp_nn = {linspace(1.35, 7.65, 10) linspace(3.3, 8.7, 10)}; + assert (c, exp_c) + assert (nn, exp_nn, eps*100) +***** test + [c, nn] = hist3 ([1 NaN; 2 NaN; 6 NaN; 8 NaN]); + exp_c = zeros (10, 10); + exp_nn = {linspace(1.35, 7.65, 10) NaN(1, 10)}; + assert (c, exp_c) + assert (nn, exp_nn, eps*100) +***** test + [c, nn] = hist3 ([1 NaN; NaN 3; NaN 9; 8 NaN]); + exp_c = zeros (10, 10); + exp_nn = {linspace(1.35, 7.65, 10) linspace(3.3, 8.7, 10)}; + assert (c, exp_c) + assert (nn, exp_nn, eps*100) +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/raylstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/raylstat.m +***** test + sigma = 1:6; + [m, v] = raylstat (sigma); + expected_m = [1.2533, 2.5066, 3.7599, 5.0133, 6.2666, 7.5199]; + expected_v = [0.4292, 1.7168, 3.8628, 6.8673, 10.7301, 15.4513]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/tblread.m] +>>>>> /build/octave-statistics-1.4.2/inst/tblread.m +***** shared d, v, c, tblreadspacefile, tblreadtabfile + d = [1 2;3 4]; + v = ["a ";"bc"]; + c = ["de";"f "]; + tblreadspacefile = file_in_loadpath("test/tblread-space.dat"); + tblreadtabfile = file_in_loadpath("test/tblread-tab.dat"); +***** test + [dt vt ct] = tblread (tblreadspacefile); + assert (dt, d); + assert (vt, v); + assert (ct, c); +***** test + [dt vt ct] = tblread (tblreadspacefile, " "); + assert (dt, d); + assert (vt, v); + assert (ct, c); +***** test + [dt vt ct] = tblread (tblreadspacefile, "space"); + assert (dt, d); + assert (vt, v); + assert (ct, c); +***** test + [dt vt ct] = tblread (tblreadtabfile, "tab"); + assert (dt, d); + assert (vt, v); + assert (ct, c); +***** test + [dt vt ct] = tblread (tblreadtabfile, "\t"); + assert (dt, d); + assert (vt, v); + assert (ct, c); +***** test + [dt vt ct] = tblread (tblreadtabfile, '\t'); + assert (dt, d); + assert (vt, v); + assert (ct, c); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/lognstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/lognstat.m +***** test + mu = 0:0.2:1; + sigma = 0.2:0.2:1.2; + [m, v] = lognstat (mu, sigma); + expected_m = [1.0202, 1.3231, 1.7860, 2.5093, 3.6693, 5.5845]; + expected_v = [0.0425, 0.3038, 1.3823, 5.6447, 23.1345, 100.4437]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +***** test + sigma = 0.2:0.2:1.2; + [m, v] = lognstat (0, sigma); + expected_m = [1.0202, 1.0833, 1.1972, 1.3771, 1.6487, 2.0544]; + expected_v = [0.0425, 0.2036, 0.6211, 1.7002, 4.6708, 13.5936]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/gmdistribution.m] +>>>>> /build/octave-statistics-1.4.2/inst/gmdistribution.m +***** test + mu = eye(2); + Sigma = eye(2); + GM = gmdistribution (mu, Sigma); + density = GM.pdf ([0 0; 1 1]); + assert (density(1) - density(2), 0, 1e-6); + + [idx, nlogl, P, logpdf,M] = cluster (GM, eye(2)); + assert (idx, [1; 2]); + [idx2,nlogl2,P2,logpdf2] = GM.cluster (eye(2)); + assert (nlogl - nlogl2, 0, 1e-6); + [idx3,nlogl3,P3] = cluster (GM, eye(2)); + assert (P - P3, zeros (2), 1e-6); + [idx4,nlogl4] = cluster (GM, eye(2)); + assert (size (nlogl4), [1 1]); + idx5 = cluster (GM, eye(2)); + assert (idx - idx5, zeros (2,1)); + + D = GM.mahal ([1;0]); + assert (D - M(1,:), zeros (1,2), 1e-6); + + P = GM.posterior ([0 1]); + assert (P - P2(2,:), zeros (1,2), 1e-6); + + R = GM.random(20); + assert (size(R), [20, 2]); + + R = GM.random(); + assert (size(R), [1, 2]); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/gamfit.m] +>>>>> /build/octave-statistics-1.4.2/inst/gamfit.m +***** shared v, res + v = [1.2 1.6 1.7 1.8 1.9 2.0 2.2 2.6 3.0 3.5 4.0 4.8 5.6 6.6 7.6]; + res = gamfit(v); +***** assert (res(1), 3.425, 1E-3); +***** assert (res(2), 0.975, 1E-3); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/casewrite.m] +>>>>> /build/octave-statistics-1.4.2/inst/casewrite.m +***** test + fname = [tempname() ".dat"]; + unwind_protect + s = ["a ";"bcd";"ef "]; + casewrite (s, fname) + names = caseread (fname); + unwind_protect_cleanup + unlink (fname); + end_unwind_protect + assert(names, s); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/runstest.m] +>>>>> /build/octave-statistics-1.4.2/inst/runstest.m +***** test + data = [-213 -564 -35 -15 141 115 -420 -360 203 -338 -431 194 -220 -513 154 -125 -559 92 -21 -579 -52 99 -543 -175 162 -457 -346 204 -300 -474 164 -107 -572 -8 83 -541 -224 180 -420 -374 201 -236 -531 83 27 -564 -112 131 -507 -254 199 -311 -495 143 -46 -579 -90 136 -472 -338 202 -287 -477 169 -124 -568 17 48 -568 -135 162 -430 -422 172 -74 -577 -13 92 -534 -243 194 -355 -465 156 -81 -578 -64 139 -449 -384 193 -198 -538 110 -44 -577 -6 66 -552 -164 161 -460 -344 205 -281 -504 134 -28 -576 -118 156 -437 -381 200 -220 -540 83 11 -568 -160 172 -414 -408 188 -125 -572 -32 139 -492 -321 205 -262 -504 142 -83 -574 0 48 -571 -106 137 -501 -266 190 -391 -406 194 -186 -553 83 -13 -577 -49 103 -515 -280 201 300 -506 131 -45 -578 -80 138 -462 -361 201 -211 -554 32 74 -533 -235 187 -372 -442 182 -147 -566 25 68 -535 -244 194 -351 -463 174 -125 -570 15 72 -550 -190 172 -424 -385 198 -218 -536 96]; #NIST beam deflection data, http://www.itl.nist.gov/div898/handbook/eda/section4/eda425.htm + [h, p, stats] = runstest (data); + expected_h = true; + expected_p = 0.0070646; + expected_z = 2.6938; + assert (h, expected_h); + assert (p, expected_p, 1E-6); + assert (stats.z, expected_z, 1E-4); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/burrinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/burrinv.m +***** shared x,y + x = [-Inf, -1, 0, 1/2, 1, 2, Inf]; + y = [NaN, NaN, 0, 1 , Inf, NaN, NaN]; +***** assert (burrinv (x, ones (1,7), ones (1,7), ones(1,7)), y, eps) +***** assert (burrinv (x, 1, 1, 1), y, eps) +***** assert (burrinv (x, [1, 1, 1, NaN, 1, 1, 1], 1, 1), [y(1:3), NaN, y(5:7)], eps) +***** assert (burrinv (x, 1, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) +***** assert (burrinv (x, 1, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) +***** assert (burrinv ([x, NaN], 1, 1, 1), [y, NaN], eps) +***** assert (burrinv (single ([x, NaN]), 1, 1, 1), single ([y, NaN]), eps('single')) +***** assert (burrinv ([x, NaN], single (1), 1, 1), single ([y, NaN]), eps('single')) +***** assert (burrinv ([x, NaN], 1, single (1), 1), single ([y, NaN]), eps('single')) +***** assert (burrinv ([x, NaN], 1, 1, single (1)), single ([y, NaN]), eps('single')) +***** error burrinv () +***** error burrinv (1) +***** error burrinv (1,2) +***** error burrinv (1,2,3) +***** error burrinv (1,2,3,4,5) +***** error burrinv (ones (3), ones (2), ones(2), ones(2)) +***** error burrinv (ones (2), ones (3), ones(2), ones(2)) +***** error burrinv (ones (2), ones (2), ones(3), ones(2)) +***** error burrinv (ones (2), ones (2), ones(2), ones(3)) +***** error burrinv (i, 2, 2, 2) +***** error burrinv (2, i, 2, 2) +***** error burrinv (2, 2, i, 2) +***** error burrinv (2, 2, 2, i) +23 tests, 23 passed, 0 known failure, 0 skipped +[inst/unifstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/unifstat.m +***** test + a = 1:6; + b = 2:2:12; + [m, v] = unifstat (a, b); + expected_m = [1.5000, 3.0000, 4.5000, 6.0000, 7.5000, 9.0000]; + expected_v = [0.0833, 0.3333, 0.7500, 1.3333, 2.0833, 3.0000]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +***** test + a = 1:6; + [m, v] = unifstat (a, 10); + expected_m = [5.5000, 6.0000, 6.5000, 7.0000, 7.5000, 8.0000]; + expected_v = [6.7500, 5.3333, 4.0833, 3.0000, 2.0833, 1.3333]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped [inst/iwishpdf.m] >>>>> /build/octave-statistics-1.4.2/inst/iwishpdf.m ***** assert(iwishpdf(4, 3, 3.1), 0.04226595, 1E-7); @@ -2632,134 +3119,582 @@ ***** error iwishpdf (1, 2, 0) ***** error wishpdf (1, 2) 7 tests, 7 passed, 0 known failure, 0 skipped -[inst/distributions/lognrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/lognrnd.m -***** assert (size (lognrnd (1,2)), [1, 1]) -***** assert (size (lognrnd (ones (2,1), 2)), [2, 1]) -***** assert (size (lognrnd (ones (2,2), 2)), [2, 2]) -***** assert (size (lognrnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (lognrnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (lognrnd (1, 2, 3)), [3, 3]) -***** assert (size (lognrnd (1, 2, [4 1])), [4, 1]) -***** assert (size (lognrnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (lognrnd (1, 2)), "double") -***** assert (class (lognrnd (single (1), 2)), "single") -***** assert (class (lognrnd (single ([1 1]), 2)), "single") -***** assert (class (lognrnd (1, single (2))), "single") -***** assert (class (lognrnd (1, single ([2 2]))), "single") -***** error lognrnd () -***** error lognrnd (1) -***** error lognrnd (ones (3), ones (2)) -***** error lognrnd (ones (2), ones (3)) -***** error lognrnd (i, 2) -***** error lognrnd (2, i) -***** error lognrnd (1,2, -1) -***** error lognrnd (1,2, ones (2)) -***** error lognrnd (1, 2, [2 -1 2]) -***** error lognrnd (1,2, 1, ones (2)) -***** error lognrnd (1,2, 1, -1) -***** error lognrnd (ones (2,2), 2, 3) -***** error lognrnd (ones (2,2), 2, [3, 2]) -***** error lognrnd (ones (2,2), 2, 2, 3) -27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/gaminv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/gaminv.m +[inst/gevstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/gevstat.m +***** test + k = [-1 -0.5 0 0.2 0.4 0.5 1]; + sigma = 2; + mu = 1; + [m, v] = gevstat (k, sigma, mu); + expected_m = [1 1.4551 2.1544 2.6423 3.4460 4.0898 Inf]; + expected_v = [4 3.4336 6.5797 13.3761 59.3288 Inf Inf]; + assert (m, expected_m, -0.001); + assert (v, expected_v, -0.001); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/normstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/normstat.m +***** test + m = 1:6; + s = 0.2:0.2:1.2; + [mn, v] = normstat (m, s); + expected_v = [0.0400, 0.1600, 0.3600, 0.6400, 1.0000, 1.4400]; + assert (mn, m); + assert (v, expected_v, 0.001); +***** test + s = 0.2:0.2:1.2; + [mn, v] = normstat (0, s); + expected_mn = [0, 0, 0, 0, 0, 0]; + expected_v = [0.0400, 0.1600, 0.3600, 0.6400, 1.0000, 1.4400]; + assert (mn, expected_mn, 0.001); + assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/nakainv.m] +>>>>> /build/octave-statistics-1.4.2/inst/nakainv.m +***** shared x,y + x = [-Inf, -1, 0, 1/2, 1, 2, Inf]; + y = [NaN, NaN, 0, 0.83255461115769769, Inf, NaN, NaN]; +***** assert (nakainv (x, ones (1,7), ones (1,7)), y, eps) +***** assert (nakainv (x, 1, 1), y, eps) +***** assert (nakainv (x, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) +***** assert (nakainv (x, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) +***** assert (nakainv ([x, NaN], 1, 1), [y, NaN], eps) +***** assert (nakainv (single ([x, NaN]), 1, 1), single ([y, NaN])) +***** assert (nakainv ([x, NaN], single (1), 1), single ([y, NaN])) +***** assert (nakainv ([x, NaN], 1, single (1)), single ([y, NaN])) +***** error nakainv () +***** error nakainv (1) +***** error nakainv (1,2) +***** error nakainv (1,2,3,4) +***** error nakainv (ones (3), ones (2), ones(2)) +***** error nakainv (ones (2), ones (3), ones(2)) +***** error nakainv (ones (2), ones (2), ones(3)) +***** error nakainv (i, 2, 2) +***** error nakainv (2, i, 2) +***** error nakainv (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/mvnrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/mvnrnd.m +***** shared m, n, C, rho + m = 10; n = 3; rho = 0.4; C = rho*ones(n, n) + (1 - rho)*eye(n); +***** assert(size(mvnrnd(0, C, m)), [m n]) +***** assert(size(mvnrnd(zeros(1, n), C, m)), [m n]) +***** assert(size(mvnrnd(zeros(n, 1), C, m)), [m n]) +***** assert(size(mvnrnd(zeros(m, n), C, m)), [m n]) +***** assert(size(mvnrnd(zeros(m, n), C)), [m n]) +***** assert(size(mvnrnd(zeros(1, n), C)), [1 n]) +***** assert(size(mvnrnd(zeros(n, 1), C)), [1 n]) +***** error(mvnrnd(zeros(m+1, n), C, m)) +***** error(mvnrnd(zeros(1, n+1), C, m)) +***** error(mvnrnd(zeros(n+1, 1), C, m)) +***** error(mvnrnd(zeros(m, n), eye(n+1), m)) +***** error(mvnrnd(zeros(m, n), eye(n+1, n), m)) +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/wishpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/wishpdf.m +***** assert(wishpdf(4, 3, 3.1), 0.07702496, 1E-7); +***** assert(wishpdf([2 -0.3;-0.3 4], [1 0.3;0.3 1], 4), 0.004529741, 1E-7); +***** assert(wishpdf([6 2 5; 2 10 -5; 5 -5 25], [9 5 5; 5 10 -8; 5 -8 22], 5.1), 4.474865e-10, 1E-15); +***** error wishpdf () +***** error wishpdf (1, 2) +***** error wishpdf (1, 2, 0) +***** error wishpdf (1, 2) +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/tblwrite.m] +>>>>> /build/octave-statistics-1.4.2/inst/tblwrite.m +***** shared privpath + privpath = [fileparts(which('tblwrite')) filesep() 'private']; +***** test + addpath (privpath,'-end') + [d err] = tbl_delim (" "); + assert (d, " "); + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ("space"); + assert (d, " "); + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ("tab"); + assert (d, sprintf ("\t")); + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ("comma"); + assert (d, ","); + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ("semi"); + assert (d, ";"); + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ("bar"); + assert (d, "|"); + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ("x"); + assert (d, "x"); + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ('\r'); + assert (d, sprintf ('\r')) + assert (err, ""); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ("bars"); + assert (isnan (d)); + assert (! isempty (err)); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim (""); + assert (isnan (d)); + assert (! isempty (err)); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim (5); + assert (isnan (d)); + assert (! isempty (err)); + rmpath (privpath); +***** test + addpath (privpath,'-end') + [d err] = tbl_delim ({"."}); + assert (isnan (d)); + assert (! isempty (err)); + rmpath (privpath); +***** shared d, v, c, tempfilename + d = [1 2;3 4]; + v = ["a ";"bc"]; + c = ["de";"f "]; + tempfilename = tempname; +***** test + tblwrite (d, v, c, tempfilename); + [dt vt ct] = tblread (tempfilename, " "); + assert (dt, d); + assert (vt, v); + assert (ct, c); + delete (tempfilename); +***** test + tblwrite (d, v, c, tempfilename, " "); + [dt vt ct] = tblread (tempfilename, " "); + assert (dt, d); + assert (vt, v); + assert (ct, c); + delete (tempfilename); +***** test + tblwrite (d, v, c, tempfilename, "space"); + [dt vt ct] = tblread (tempfilename); + assert (dt, d); + assert (vt, v); + assert (ct, c); + delete (tempfilename); +***** test + tblwrite (d, v, c, tempfilename, "tab"); + [dt vt ct] = tblread (tempfilename, "tab"); + assert (dt, d); + assert (vt, v); + assert (ct, c); + delete (tempfilename); +***** test + tblwrite (d, v, c, tempfilename, "\t"); + [dt vt ct] = tblread (tempfilename, "\t"); + assert (dt, d); + assert (vt, v); + assert (ct, c); + delete (tempfilename); +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/sigma_pts.m] +>>>>> /build/octave-statistics-1.4.2/inst/sigma_pts.m +***** demo + K = [1 0.5; 0.5 1]; # covaraince matrix + # calculate and build associated ellipse + [R,S,~] = svd (K); + theta = atan2 (R(2,1), R(1,1)); + v = sqrt (diag (S)); + v = v .* [cos(theta) sin(theta); -sin(theta) cos(theta)]; + t = linspace (0, 2*pi, 100).'; + xe = v(1,1) * cos (t) + v(2,1) * sin (t); + ye = v(1,2) * cos (t) + v(2,2) * sin (t); + + figure(1); clf; hold on + # Plot ellipse and axes + line ([0 0; v(:,1).'],[0 0; v(:,2).']) + plot (xe,ye,'-r'); + + col = 'rgb'; + l = [-1.8 -1 1.5]; + for li = 1:3 + p = sigma_pts (2, [], K, l(li)); + tmp = plot (p(2:end,1), p(2:end,2), ['x' col(li)], ... + p(1,1), p(1,2), ['o' col(li)]); + h(li) = tmp(1); + endfor + hold off + axis image + legend (h, arrayfun (@(x) sprintf ("l:%.2g", x), l, "unif", 0)); +***** test + p = sigma_pts (5); + assert (mean (p), zeros(1,5), sqrt(eps)); + assert (cov (p), eye(5), sqrt(eps)); +***** test + m = randn(1, 5); + p = sigma_pts (5, m); + assert (mean (p), m, sqrt(eps)); + assert (cov (p), eye(5), sqrt(eps)); +***** test + x = linspace (0,1,5); + K = exp (- (x.' - x).^2/ 0.5); + p = sigma_pts (5, [], K); + assert (mean (p), zeros(1,5), sqrt(eps)); + assert (cov (p), K, sqrt(eps)); +***** error sigma_pts(2,1); +***** error sigma_pts(2,[],1); +***** error sigma_pts(2,1,1); +***** error sigma_pts(2,[0.5 0.5],[-1 0; 0 0]); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/ttest.m] +>>>>> /build/octave-statistics-1.4.2/inst/ttest.m +***** test + x = 8:0.1:12; + [h, pval, ci] = ttest (x, 10); + assert (h, 0) + assert (pval, 1, 10*eps) + assert (ci, [9.6219 10.3781], 1E-5) + [h, pval, ci0] = ttest (x, 0); + assert (h, 1) + assert (pval, 0) + 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) + assert (ci, [9.68498 Inf], 1E-5) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/canoncorr.m] +>>>>> /build/octave-statistics-1.4.2/inst/canoncorr.m +***** shared X,Y,A,B,r,U,V,k + k = 10; + X = [1:k; sin(1:k); cos(1:k)]'; Y = [tan(1:k); tanh((1:k)/k)]'; + [A,B,r,U,V,stats] = canoncorr (X,Y); +***** assert (A, [-0.329229 0.072908; 0.074870 1.389318; -0.069302 -0.024109], 1E-6); +***** assert (B, [-0.017086 -0.398402; -4.475049 -0.824538], 1E-6); +***** assert (r, [0.99590 0.26754], 1E-5); +***** assert (U, center(X) * A, 10*eps); +***** assert (V, center(Y) * B, 10*eps); +***** assert (cov(U), eye(size(U, 2)), 10*eps); +***** assert (cov(V), eye(size(V, 2)), 10*eps); + rand ("state", 1); [A,B,r] = canoncorr (rand(5, 10),rand(5, 20)); +***** assert (r, ones(1, 5), 10*eps); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/pdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/pdf.m +***** test + assert(pdf ('norm', 1, 0, 1), normpdf (1, 0, 1)) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/gevinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/gevinv.m +***** test + p = 0.1:0.1:0.9; + k = 0; + sigma = 1; + mu = 0; + x = gevinv (p, k, sigma, mu); + c = gevcdf(x, k, sigma, mu); + assert (c, p, 0.001); +***** test + p = 0.1:0.1:0.9; + k = 1; + sigma = 1; + mu = 0; + x = gevinv (p, k, sigma, mu); + c = gevcdf(x, k, sigma, mu); + assert (c, p, 0.001); +***** test + p = 0.1:0.1:0.9; + k = 0.3; + sigma = 1; + mu = 0; + x = gevinv (p, k, sigma, mu); + c = gevcdf(x, k, sigma, mu); + assert (c, p, 0.001); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/base/ppplot.m] +>>>>> /build/octave-statistics-1.4.2/inst/base/ppplot.m +***** error ppplot () +***** error ppplot (ones (2,2)) +***** error ppplot (1, 2) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/base/logit.m] +>>>>> /build/octave-statistics-1.4.2/inst/base/logit.m +***** test + p = [0.01:0.01:0.99]; + assert (logit (p), log (p ./ (1-p)), 25*eps); +***** assert (logit ([-1, 0, 0.5, 1, 2]), [NaN, -Inf, 0, +Inf, NaN]) +***** error logit () +***** error logit (1, 2) +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/base/cloglog.m] +>>>>> /build/octave-statistics-1.4.2/inst/base/cloglog.m +***** assert (cloglog (0), -Inf) +***** assert (cloglog (1), Inf) +***** assert (cloglog (1/e), 0) +***** error cloglog () +***** error cloglog (1, 2) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/base/crosstab.m] +>>>>> /build/octave-statistics-1.4.2/inst/base/crosstab.m +***** error crosstab () +***** error crosstab (1) +***** error crosstab (1, 2, 3) +***** error crosstab (ones (2), [1 1]) +***** error crosstab ([1 1], ones (2)) +***** error crosstab ({true, true}, [1 1]) +***** error crosstab ([1 1], {true, true}) +***** error crosstab ([1], [1 1]) +***** error crosstab ([1 1], [1]) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/base/probit.m] +>>>>> /build/octave-statistics-1.4.2/inst/base/probit.m +***** assert (probit ([-1, 0, 0.5, 1, 2]), [NaN, -Inf, 0, Inf, NaN]) +***** error probit () +***** error probit (1, 2) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/base/qqplot.m] +>>>>> /build/octave-statistics-1.4.2/inst/base/qqplot.m +***** error qqplot () +***** error qqplot ({1}) +***** error qqplot (ones (2,2)) +***** error qqplot (1, "foobar") +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/bbspdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/bbspdf.m +***** shared x,y + x = [-1, 0, 1, 2, Inf]; + y = [0, 0, 0.3989422804014327, 0.1647717335503959, 0]; +***** 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) +***** 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')) +***** error bbspdf () +***** error bbspdf (1) +***** error bbspdf (1,2,3) +***** error bbspdf (1,2,3,4,5) +***** error bbspdf (ones (3), ones (2), ones(2), ones(2)) +***** 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, 4, 3, 2) +***** error bbspdf (1, i, 3, 2) +***** error bbspdf (1, 4, i, 2) +***** error bbspdf (1, 4, 3, i) +25 tests, 25 passed, 0 known failure, 0 skipped +[inst/distributions/finv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/finv.m ***** shared x - x = [-1 0 0.63212055882855778 1 2]; -***** assert (gaminv (x, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (gaminv (x, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (gaminv (x, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) -***** assert (gaminv (x, [1 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) -***** assert (gaminv (x, 1, [1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (gaminv ([x(1:2) NaN x(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) -***** assert (gaminv ([x, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) -***** assert (gaminv (single ([x, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** assert (gaminv ([x, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** assert (gaminv ([x, NaN], 1, single (1)), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** error gaminv () -***** error gaminv (1) -***** error gaminv (1,2) -***** error gaminv (1,2,3,4) -***** error gaminv (ones (3), ones (2), ones (2)) -***** error gaminv (ones (2), ones (3), ones (2)) -***** error gaminv (ones (2), ones (2), ones (3)) -***** error gaminv (i, 2, 2) -***** error gaminv (2, i, 2) -***** error gaminv (2, 2, i) + x = [-1 0 0.5 1 2]; +***** assert (finv (x, 2*ones (1,5), 2*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (finv (x, 2, 2*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (finv (x, 2*ones (1,5), 2), [NaN 0 1 Inf NaN]) +***** assert (finv (x, [2 -Inf NaN Inf 2], 2), [NaN NaN NaN NaN NaN]) +***** assert (finv (x, 2, [2 -Inf NaN Inf 2]), [NaN NaN NaN NaN NaN]) +***** assert (finv ([x(1:2) NaN x(4:5)], 2, 2), [NaN 0 NaN Inf NaN]) +***** assert (finv ([x, NaN], 2, 2), [NaN 0 1 Inf NaN NaN]) +***** assert (finv (single ([x, NaN]), 2, 2), single ([NaN 0 1 Inf NaN NaN])) +***** assert (finv ([x, NaN], single (2), 2), single ([NaN 0 1 Inf NaN NaN])) +***** assert (finv ([x, NaN], 2, single (2)), single ([NaN 0 1 Inf NaN NaN])) +***** error finv () +***** error finv (1) +***** error finv (1,2) +***** error finv (1,2,3,4) +***** error finv (ones (3), ones (2), ones (2)) +***** error finv (ones (2), ones (3), ones (2)) +***** error finv (ones (2), ones (2), ones (3)) +***** error finv (i, 2, 2) +***** error finv (2, i, 2) +***** error finv (2, 2, i) 20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/binoinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/binoinv.m +[inst/distributions/hygernd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/hygernd.m +***** assert (size (hygernd (4,2,2)), [1, 1]) +***** assert (size (hygernd (4*ones (2,1), 2,2)), [2, 1]) +***** assert (size (hygernd (4*ones (2,2), 2,2)), [2, 2]) +***** assert (size (hygernd (4, 2*ones (2,1), 2)), [2, 1]) +***** assert (size (hygernd (4, 2*ones (2,2), 2)), [2, 2]) +***** assert (size (hygernd (4, 2, 2*ones (2,1))), [2, 1]) +***** assert (size (hygernd (4, 2, 2*ones (2,2))), [2, 2]) +***** assert (size (hygernd (4, 2, 2, 3)), [3, 3]) +***** assert (size (hygernd (4, 2, 2, [4 1])), [4, 1]) +***** assert (size (hygernd (4, 2, 2, 4, 1)), [4, 1]) +***** assert (class (hygernd (4,2,2)), "double") +***** assert (class (hygernd (single (4),2,2)), "single") +***** assert (class (hygernd (single ([4 4]),2,2)), "single") +***** assert (class (hygernd (4,single (2),2)), "single") +***** assert (class (hygernd (4,single ([2 2]),2)), "single") +***** assert (class (hygernd (4,2,single (2))), "single") +***** assert (class (hygernd (4,2,single ([2 2]))), "single") +***** error hygernd () +***** error hygernd (1) +***** error hygernd (1,2) +***** error hygernd (ones (3), ones (2), ones (2), 2) +***** error hygernd (ones (2), ones (3), ones (2), 2) +***** error hygernd (ones (2), ones (2), ones (3), 2) +***** error hygernd (i, 2, 2) +***** error hygernd (2, i, 2) +***** error hygernd (2, 2, i) +***** error hygernd (4,2,2, -1) +***** error hygernd (4,2,2, ones (2)) +***** error hygernd (4,2,2, [2 -1 2]) +***** error hygernd (4*ones (2),2,2, 3) +***** error hygernd (4*ones (2),2,2, [3, 2]) +***** error hygernd (4*ones (2),2,2, 3, 2) +32 tests, 32 passed, 0 known failure, 0 skipped +[inst/distributions/unifinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/unifinv.m ***** shared x x = [-1 0 0.5 1 2]; -***** assert (binoinv (x, 2*ones (1,5), 0.5*ones (1,5)), [NaN 0 1 2 NaN]) -***** assert (binoinv (x, 2, 0.5*ones (1,5)), [NaN 0 1 2 NaN]) -***** assert (binoinv (x, 2*ones (1,5), 0.5), [NaN 0 1 2 NaN]) -***** assert (binoinv (x, 2*[0 -1 NaN 1.1 1], 0.5), [NaN NaN NaN NaN NaN]) -***** assert (binoinv (x, 2, 0.5*[0 -1 NaN 3 1]), [NaN NaN NaN NaN NaN]) -***** assert (binoinv ([x(1:2) NaN x(4:5)], 2, 0.5), [NaN 0 NaN 2 NaN]) -***** assert (binoinv ([x, NaN], 2, 0.5), [NaN 0 1 2 NaN NaN]) -***** assert (binoinv (single ([x, NaN]), 2, 0.5), single ([NaN 0 1 2 NaN NaN])) -***** assert (binoinv ([x, NaN], single (2), 0.5), single ([NaN 0 1 2 NaN NaN])) -***** assert (binoinv ([x, NaN], 2, single (0.5)), single ([NaN 0 1 2 NaN NaN])) -***** shared y, tol - y = magic (3) + 1; - tol = 1; -***** assert (binoinv (binocdf (1:10, 11, 0.1), 11, 0.1), 1:10, tol) -***** assert (binoinv (binocdf (1:10, 2*(1:10), 0.1), 2*(1:10), 0.1), 1:10, tol) -***** assert (binoinv (binocdf (y, 2*y, 1./y), 2*y, 1./y), y, tol) -***** error binoinv () -***** error binoinv (1) -***** error binoinv (1,2) -***** error binoinv (1,2,3,4) -***** error binoinv (ones (3), ones (2), ones (2)) -***** error binoinv (ones (2), ones (3), ones (2)) -***** error binoinv (ones (2), ones (2), ones (3)) -***** error binoinv (i, 2, 2) -***** error binoinv (2, i, 2) -***** error binoinv (2, 2, i) -23 tests, 23 passed, 0 known failure, 0 skipped -[inst/distributions/chi2pdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2pdf.m +***** assert (unifinv (x, ones (1,5), 2*ones (1,5)), [NaN 1 1.5 2 NaN]) +***** assert (unifinv (x, 1, 2*ones (1,5)), [NaN 1 1.5 2 NaN]) +***** assert (unifinv (x, ones (1,5), 2), [NaN 1 1.5 2 NaN]) +***** assert (unifinv (x, [1 2 NaN 1 1], 2), [NaN NaN NaN 2 NaN]) +***** assert (unifinv (x, 1, 2*[1 0 NaN 1 1]), [NaN NaN NaN 2 NaN]) +***** assert (unifinv ([x(1:2) NaN x(4:5)], 1, 2), [NaN 1 NaN 2 NaN]) +***** assert (unifinv ([x, NaN], 1, 2), [NaN 1 1.5 2 NaN NaN]) +***** assert (unifinv (single ([x, NaN]), 1, 2), single ([NaN 1 1.5 2 NaN NaN])) +***** assert (unifinv ([x, NaN], single (1), 2), single ([NaN 1 1.5 2 NaN NaN])) +***** assert (unifinv ([x, NaN], 1, single (2)), single ([NaN 1 1.5 2 NaN NaN])) +***** error unifinv () +***** error unifinv (1,2) +***** error unifinv (1,2,3,4) +***** error unifinv (ones (3), ones (2), ones (2)) +***** error unifinv (ones (2), ones (3), ones (2)) +***** error unifinv (ones (2), ones (2), ones (3)) +***** error unifinv (i, 2, 2) +***** error unifinv (2, i, 2) +***** error unifinv (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped +[inst/distributions/laplace_rnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_rnd.m +***** assert (size (laplace_rnd (3)), [3, 3]) +***** assert (size (laplace_rnd ([4 1])), [4, 1]) +***** assert (size (laplace_rnd (4,1)), [4, 1]) +***** error laplace_rnd () +***** error laplace_rnd (-1) +***** error laplace_rnd (ones (2)) +***** error laplace_rnd ([2 -1 2]) +***** error laplace_rnd (1, ones (2)) +***** error laplace_rnd (1, -1) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/unidinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/unidinv.m +***** shared x + x = [-1 0 0.5 1 2]; +***** assert (unidinv (x, 10*ones (1,5)), [NaN NaN 5 10 NaN], eps) +***** assert (unidinv (x, 10), [NaN NaN 5 10 NaN], eps) +***** assert (unidinv (x, 10*[0 1 NaN 1 1]), [NaN NaN NaN 10 NaN], eps) +***** assert (unidinv ([x(1:2) NaN x(4:5)], 10), [NaN NaN NaN 10 NaN], eps) +***** assert (unidinv ([x, NaN], 10), [NaN NaN 5 10 NaN NaN], eps) +***** assert (unidinv (single ([x, NaN]), 10), single ([NaN NaN 5 10 NaN NaN]), eps) +***** assert (unidinv ([x, NaN], single (10)), single ([NaN NaN 5 10 NaN NaN]), eps) +***** error unidinv () +***** error unidinv (1) +***** error unidinv (1,2,3) +***** error unidinv (ones (3), ones (2)) +***** error unidinv (ones (2), ones (3)) +***** error unidinv (i, 2) +***** error unidinv (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/wblpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/wblpdf.m ***** shared x,y x = [-1 0 0.5 1 Inf]; - y = [0, 1/2 * exp(-x(2:5)/2)]; -***** assert (chi2pdf (x, 2*ones (1,5)), y) -***** assert (chi2pdf (x, 2), y) -***** assert (chi2pdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) -***** assert (chi2pdf ([x, NaN], 2), [y, NaN]) -***** assert (chi2pdf (single ([x, NaN]), 2), single ([y, NaN])) -***** assert (chi2pdf ([x, NaN], single (2)), single ([y, NaN])) -***** error chi2pdf () -***** error chi2pdf (1) -***** error chi2pdf (1,2,3) -***** error chi2pdf (ones (3), ones (2)) -***** error chi2pdf (ones (2), ones (3)) -***** error chi2pdf (i, 2) -***** error chi2pdf (2, i) -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/distributions/wblinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/wblinv.m -***** shared x - x = [-1 0 0.63212055882855778 1 2]; -***** assert (wblinv (x, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (wblinv (x, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (wblinv (x, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) -***** assert (wblinv (x, [1 -1 NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) -***** assert (wblinv (x, 1, [1 -1 NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (wblinv ([x(1:2) NaN x(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) -***** assert (wblinv ([x, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) -***** assert (wblinv (single ([x, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** assert (wblinv ([x, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** assert (wblinv ([x, NaN], 1, single (1)), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** error wblinv () -***** error wblinv (1,2,3,4) -***** error wblinv (ones (3), ones (2), ones (2)) -***** error wblinv (ones (2), ones (3), ones (2)) -***** error wblinv (ones (2), ones (2), ones (3)) -***** error wblinv (i, 2, 2) -***** error wblinv (2, i, 2) -***** error wblinv (2, 2, i) + y = [0, exp(-x(2:4)), NaN]; +***** assert (wblpdf (x, ones (1,5), ones (1,5)), y) +***** assert (wblpdf (x, 1, ones (1,5)), y) +***** assert (wblpdf (x, ones (1,5), 1), y) +***** assert (wblpdf (x, [0 NaN Inf 1 1], 1), [NaN NaN NaN y(4:5)]) +***** assert (wblpdf (x, 1, [0 NaN Inf 1 1]), [NaN NaN NaN y(4:5)]) +***** assert (wblpdf ([x, NaN], 1, 1), [y, NaN]) +***** assert (wblpdf (single ([x, NaN]), 1, 1), single ([y, NaN])) +***** assert (wblpdf ([x, NaN], single (1), 1), single ([y, NaN])) +***** assert (wblpdf ([x, NaN], 1, single (1)), single ([y, NaN])) +***** error wblpdf () +***** error wblpdf (1,2,3,4) +***** error wblpdf (ones (3), ones (2), ones (2)) +***** error wblpdf (ones (2), ones (3), ones (2)) +***** error wblpdf (ones (2), ones (2), ones (3)) +***** error wblpdf (i, 2, 2) +***** error wblpdf (2, i, 2) +***** error wblpdf (2, 2, i) +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/distributions/normpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/normpdf.m +***** 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, 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) +***** assert (normpdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) +***** assert (normpdf ([x, NaN], single (1), 1), single ([y, NaN]), eps ("single")) +***** assert (normpdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps ("single")) +***** error normpdf () +***** error normpdf (1,2) +***** error normpdf (1,2,3,4) +***** error normpdf (ones (3), ones (2), ones (2)) +***** error normpdf (ones (2), ones (3), ones (2)) +***** error normpdf (ones (2), ones (2), ones (3)) +***** error normpdf (i, 2, 2) +***** error normpdf (2, i, 2) +***** error normpdf (2, 2, i) 18 tests, 18 passed, 0 known failure, 0 skipped +[inst/distributions/logninv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/logninv.m +***** shared x + x = [-1 0 0.5 1 2]; +***** assert (logninv (x, ones (1,5), ones (1,5)), [NaN 0 e Inf NaN]) +***** assert (logninv (x, 1, ones (1,5)), [NaN 0 e Inf NaN]) +***** assert (logninv (x, ones (1,5), 1), [NaN 0 e Inf NaN]) +***** assert (logninv (x, [1 1 NaN 0 1], 1), [NaN 0 NaN Inf NaN]) +***** assert (logninv (x, 1, [1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (logninv ([x(1:2) NaN x(4:5)], 1, 2), [NaN 0 NaN Inf NaN]) +***** assert (logninv ([x, NaN], 1, 1), [NaN 0 e Inf NaN NaN]) +***** assert (logninv (single ([x, NaN]), 1, 1), single ([NaN 0 e Inf NaN NaN])) +***** assert (logninv ([x, NaN], single (1), 1), single ([NaN 0 e Inf NaN NaN])) +***** assert (logninv ([x, NaN], 1, single (1)), single ([NaN 0 e Inf NaN NaN])) +***** error logninv () +***** error logninv (1,2) +***** error logninv (1,2,3,4) +***** error logninv (ones (3), ones (2), ones (2)) +***** error logninv (ones (2), ones (3), ones (2)) +***** error logninv (ones (2), ones (2), ones (3)) +***** error logninv (i, 2, 2) +***** error logninv (2, i, 2) +***** error logninv (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped [inst/distributions/cauchy_inv.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/cauchy_inv.m ***** shared x @@ -2784,58 +3719,78 @@ ***** error cauchy_inv (2, i, 2) ***** error cauchy_inv (2, 2, i) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/poisspdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/poisspdf.m +[inst/distributions/binopdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/binopdf.m +***** shared x,y,tol + if (ismac ()) + tol = eps (); + else + tol = 0; + endif + x = [-1 0 1 2 3]; + y = [0 1/4 1/2 1/4 0]; +***** assert (binopdf (x, 2*ones (1,5), 0.5*ones (1,5)), y, tol) +***** assert (binopdf (x, 2, 0.5*ones (1,5)), y, tol) +***** assert (binopdf (x, 2*ones (1,5), 0.5), y, tol) +***** assert (binopdf (x, 2*[0 -1 NaN 1.1 1], 0.5), [0 NaN NaN NaN 0]) +***** assert (binopdf (x, 2, 0.5*[0 -1 NaN 3 1]), [0 NaN NaN NaN 0]) +***** assert (binopdf ([x, NaN], 2, 0.5), [y, NaN], tol) +***** assert (binopdf (0, 3, 0), 1) +***** assert (binopdf (2, 2, 1), 1) +***** assert (binopdf (1, 2, 1), 0) +***** assert (binopdf (single ([x, NaN]), 2, 0.5), single ([y, NaN])) +***** assert (binopdf ([x, NaN], single (2), 0.5), single ([y, NaN])) +***** assert (binopdf ([x, NaN], 2, single (0.5)), single ([y, NaN])) +***** error binopdf () +***** error binopdf (1) +***** error binopdf (1,2) +***** error binopdf (1,2,3,4) +***** error binopdf (ones (3), ones (2), ones (2)) +***** error binopdf (ones (2), ones (3), ones (2)) +***** error binopdf (ones (2), ones (2), ones (3)) +***** error binopdf (i, 2, 2) +***** error binopdf (2, i, 2) +***** error binopdf (2, 2, i) +22 tests, 22 passed, 0 known failure, 0 skipped +[inst/distributions/chi2cdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2cdf.m ***** shared x,y - x = [-1 0 1 2 Inf]; - y = [0, exp(-1)*[1 1 0.5], 0]; -***** assert (poisspdf (x, ones (1,5)), y, eps) -***** assert (poisspdf (x, 1), y, eps) -***** assert (poisspdf (x, [1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)], eps) -***** assert (poisspdf ([x, NaN], 1), [y, NaN], eps) -***** assert (poisspdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) -***** assert (poisspdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) -***** error poisspdf () -***** error poisspdf (1) -***** error poisspdf (1,2,3) -***** error poisspdf (ones (3), ones (2)) -***** error poisspdf (ones (2), ones (3)) -***** error poisspdf (i, 2) -***** error poisspdf (2, i) -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/distributions/unifrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/unifrnd.m -***** assert (size (unifrnd (1,2)), [1, 1]) -***** assert (size (unifrnd (ones (2,1), 2)), [2, 1]) -***** assert (size (unifrnd (ones (2,2), 2)), [2, 2]) -***** assert (size (unifrnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (unifrnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (unifrnd (1, 2, 3)), [3, 3]) -***** assert (size (unifrnd (1, 2, [4 1])), [4, 1]) -***** assert (size (unifrnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (unifrnd (1, 2)), "double") -***** assert (class (unifrnd (single (1), 2)), "single") -***** assert (class (unifrnd (single ([1 1]), 2)), "single") -***** assert (class (unifrnd (1, single (2))), "single") -***** assert (class (unifrnd (1, single ([2 2]))), "single") -***** error unifrnd () -***** error unifrnd (1) -***** error unifrnd (ones (3), ones (2)) -***** error unifrnd (ones (2), ones (3)) -***** error unifrnd (i, 2) -***** error unifrnd (2, i) -***** error unifrnd (1,2, -1) -***** error unifrnd (1,2, ones (2)) -***** error unifrnd (1, 2, [2 -1 2]) -***** error unifrnd (1,2, 1, ones (2)) -***** error unifrnd (1,2, 1, -1) -***** error unifrnd (ones (2,2), 2, 3) -***** error unifrnd (ones (2,2), 2, [3, 2]) -***** error unifrnd (ones (2,2), 2, 2, 3) -***** assert (unifrnd (0,0), 0) -***** assert (unifrnd (1,1), 1) -***** assert (unifrnd (1,0), NaN) -30 tests, 30 passed, 0 known failure, 0 skipped + x = [-1 0 0.5 1 2]; + y = [0, 1 - exp(-x(2:end)/2)]; +***** assert (chi2cdf (x, 2*ones (1,5)), y, eps) +***** assert (chi2cdf (x, 2), y, eps) +***** assert (chi2cdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)], eps) +***** assert (chi2cdf ([x(1:2) NaN x(4:5)], 2), [y(1:2) NaN y(4:5)], eps) +***** assert (chi2cdf ([x, NaN], 2), [y, NaN], eps) +***** assert (chi2cdf (single ([x, NaN]), 2), single ([y, NaN]), eps ("single")) +***** assert (chi2cdf ([x, NaN], single (2)), single ([y, NaN]), eps ("single")) +***** error chi2cdf () +***** error chi2cdf (1) +***** error chi2cdf (1,2,3) +***** error chi2cdf (ones (3), ones (2)) +***** error chi2cdf (ones (2), ones (3)) +***** error chi2cdf (i, 2) +***** error chi2cdf (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/expinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/expinv.m +***** shared x + x = [-1 0 0.3934693402873666 1 2]; +***** assert (expinv (x, 2*ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (expinv (x, 2), [NaN 0 1 Inf NaN], eps) +***** assert (expinv (x, 2*[1 0 NaN 1 1]), [NaN NaN NaN Inf NaN], eps) +***** assert (expinv ([x(1:2) NaN x(4:5)], 2), [NaN 0 NaN Inf NaN], eps) +***** assert (expinv ([x, NaN], 2), [NaN 0 1 Inf NaN NaN], eps) +***** assert (expinv (single ([x, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), eps) +***** assert (expinv ([x, NaN], single (2)), single ([NaN 0 1 Inf NaN NaN]), eps) +***** error expinv () +***** error expinv (1) +***** error expinv (1,2,3) +***** error expinv (ones (3), ones (2)) +***** error expinv (ones (2), ones (3)) +***** error expinv (i, 2) +***** error expinv (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped [inst/distributions/unidrnd.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/unidrnd.m ***** assert (size (unidrnd (2)), [1, 1]) @@ -2852,6 +3807,141 @@ ***** error unidrnd (10*ones (2), 2, 1) ***** error unidrnd (i) 13 tests, 13 passed, 0 known failure, 0 skipped +[inst/distributions/betarnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/betarnd.m +***** assert (size (betarnd (1,2)), [1, 1]) +***** assert (size (betarnd (ones (2,1), 2)), [2, 1]) +***** assert (size (betarnd (ones (2,2), 2)), [2, 2]) +***** assert (size (betarnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (betarnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (betarnd (1, 2, 3)), [3, 3]) +***** assert (size (betarnd (1, 2, [4 1])), [4, 1]) +***** assert (size (betarnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (betarnd (1, 2)), "double") +***** assert (class (betarnd (single (1), 2)), "single") +***** assert (class (betarnd (single ([1 1]), 2)), "single") +***** assert (class (betarnd (1, single (2))), "single") +***** assert (class (betarnd (1, single ([2 2]))), "single") +***** error betarnd () +***** error betarnd (1) +***** error betarnd (ones (3), ones (2)) +***** error betarnd (ones (2), ones (3)) +***** error betarnd (i, 2) +***** error betarnd (2, i) +***** error betarnd (1,2, -1) +***** error betarnd (1,2, ones (2)) +***** error binornd (1,2, [2 -1 2]) +***** error betarnd (1,2, 1, ones (2)) +***** error betarnd (1,2, 1, -1) +***** error betarnd (ones (2,2), 2, 3) +***** error betarnd (ones (2,2), 2, [3, 2]) +***** error betarnd (ones (2,2), 2, 2, 3) +27 tests, 27 passed, 0 known failure, 0 skipped +[inst/distributions/stdnormal_pdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_pdf.m +***** shared x,y + x = [-Inf 0 1 Inf]; + y = 1/sqrt(2*pi)*exp (-x.^2/2); +***** assert (stdnormal_pdf ([x, NaN]), [y, NaN], eps) +***** assert (stdnormal_pdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) +***** error stdnormal_pdf () +***** error stdnormal_pdf (1,2) +***** error stdnormal_pdf (i) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/distributions/kolmogorov_smirnov_cdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/kolmogorov_smirnov_cdf.m +***** error kolmogorov_smirnov_cdf () +***** error kolmogorov_smirnov_cdf (1,2,3) +***** error kolmogorov_smirnov_cdf (1, ones (2)) +***** error kolmogorov_smirnov_cdf ([], 1) +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/distributions/wblinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/wblinv.m +***** shared x + x = [-1 0 0.63212055882855778 1 2]; +***** assert (wblinv (x, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (wblinv (x, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (wblinv (x, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) +***** assert (wblinv (x, [1 -1 NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) +***** assert (wblinv (x, 1, [1 -1 NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (wblinv ([x(1:2) NaN x(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) +***** assert (wblinv ([x, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) +***** assert (wblinv (single ([x, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** assert (wblinv ([x, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** assert (wblinv ([x, NaN], 1, single (1)), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** error wblinv () +***** error wblinv (1,2,3,4) +***** error wblinv (ones (3), ones (2), ones (2)) +***** error wblinv (ones (2), ones (3), ones (2)) +***** error wblinv (ones (2), ones (2), ones (3)) +***** error wblinv (i, 2, 2) +***** error wblinv (2, i, 2) +***** error wblinv (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/distributions/chi2pdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2pdf.m +***** shared x,y + x = [-1 0 0.5 1 Inf]; + y = [0, 1/2 * exp(-x(2:5)/2)]; +***** assert (chi2pdf (x, 2*ones (1,5)), y) +***** assert (chi2pdf (x, 2), y) +***** assert (chi2pdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) +***** assert (chi2pdf ([x, NaN], 2), [y, NaN]) +***** assert (chi2pdf (single ([x, NaN]), 2), single ([y, NaN])) +***** assert (chi2pdf ([x, NaN], single (2)), single ([y, NaN])) +***** error chi2pdf () +***** error chi2pdf (1) +***** error chi2pdf (1,2,3) +***** error chi2pdf (ones (3), ones (2)) +***** error chi2pdf (ones (2), ones (3)) +***** error chi2pdf (i, 2) +***** error chi2pdf (2, i) +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/distributions/cauchy_cdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/cauchy_cdf.m +***** shared x,y + x = [-1 0 0.5 1 2]; + y = 1/pi * atan ((x-1) / 2) + 1/2; +***** assert (cauchy_cdf (x, ones (1,5), 2*ones (1,5)), y) +***** assert (cauchy_cdf (x, 1, 2*ones (1,5)), y) +***** assert (cauchy_cdf (x, ones (1,5), 2), y) +***** assert (cauchy_cdf (x, [-Inf 1 NaN 1 Inf], 2), [NaN y(2) NaN y(4) NaN]) +***** assert (cauchy_cdf (x, 1, 2*[0 1 NaN 1 Inf]), [NaN y(2) NaN y(4) NaN]) +***** assert (cauchy_cdf ([x(1:2) NaN x(4:5)], 1, 2), [y(1:2) NaN y(4:5)]) +***** assert (cauchy_cdf ([x, NaN], 1, 2), [y, NaN]) +***** assert (cauchy_cdf (single ([x, NaN]), 1, 2), single ([y, NaN]), eps ("single")) +***** assert (cauchy_cdf ([x, NaN], single (1), 2), single ([y, NaN]), eps ("single")) +***** assert (cauchy_cdf ([x, NaN], 1, single (2)), single ([y, NaN]), eps ("single")) +***** error cauchy_cdf () +***** error cauchy_cdf (1,2) +***** error cauchy_cdf (1,2,3,4) +***** error cauchy_cdf (ones (3), ones (2), ones (2)) +***** error cauchy_cdf (ones (2), ones (3), ones (2)) +***** error cauchy_cdf (ones (2), ones (2), ones (3)) +***** error cauchy_cdf (i, 2, 2) +***** error cauchy_cdf (2, i, 2) +***** error cauchy_cdf (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped +[inst/distributions/unidcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/unidcdf.m +***** shared x,y + x = [0 1 2.5 10 11]; + y = [0, 0.1 0.2 1.0 1.0]; +***** assert (unidcdf (x, 10*ones (1,5)), y) +***** assert (unidcdf (x, 10), y) +***** assert (unidcdf (x, 10*[0 1 NaN 1 1]), [NaN 0.1 NaN y(4:5)]) +***** assert (unidcdf ([x(1:2) NaN Inf x(5)], 10), [y(1:2) NaN 1 y(5)]) +***** assert (unidcdf ([x, NaN], 10), [y, NaN]) +***** assert (unidcdf (single ([x, NaN]), 10), single ([y, NaN])) +***** assert (unidcdf ([x, NaN], single (10)), single ([y, NaN])) +***** error unidcdf () +***** error unidcdf (1) +***** error unidcdf (1,2,3) +***** error unidcdf (ones (3), ones (2)) +***** error unidcdf (ones (2), ones (3)) +***** error unidcdf (i, 2) +***** error unidcdf (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped [inst/distributions/betainv.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/betainv.m ***** shared x @@ -2877,25 +3967,323 @@ ***** error betainv (2, i, 2) ***** error betainv (2, 2, i) 20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/unidpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/unidpdf.m +[inst/distributions/hygeinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/hygeinv.m +***** shared x + x = [-1 0 0.5 1 2]; +***** assert (hygeinv (x, 4*ones (1,5), 2*ones (1,5), 2*ones (1,5)), [NaN 0 1 2 NaN]) +***** assert (hygeinv (x, 4*ones (1,5), 2, 2), [NaN 0 1 2 NaN]) +***** assert (hygeinv (x, 4, 2*ones (1,5), 2), [NaN 0 1 2 NaN]) +***** assert (hygeinv (x, 4, 2, 2*ones (1,5)), [NaN 0 1 2 NaN]) +***** assert (hygeinv (x, 4*[1 -1 NaN 1.1 1], 2, 2), [NaN NaN NaN NaN NaN]) +***** assert (hygeinv (x, 4, 2*[1 -1 NaN 1.1 1], 2), [NaN NaN NaN NaN NaN]) +***** assert (hygeinv (x, 4, 5, 2), [NaN NaN NaN NaN NaN]) +***** assert (hygeinv (x, 4, 2, 2*[1 -1 NaN 1.1 1]), [NaN NaN NaN NaN NaN]) +***** assert (hygeinv (x, 4, 2, 5), [NaN NaN NaN NaN NaN]) +***** assert (hygeinv ([x(1:2) NaN x(4:5)], 4, 2, 2), [NaN 0 NaN 2 NaN]) +***** assert (hygeinv ([x, NaN], 4, 2, 2), [NaN 0 1 2 NaN NaN]) +***** assert (hygeinv (single ([x, NaN]), 4, 2, 2), single ([NaN 0 1 2 NaN NaN])) +***** assert (hygeinv ([x, NaN], single (4), 2, 2), single ([NaN 0 1 2 NaN NaN])) +***** assert (hygeinv ([x, NaN], 4, single (2), 2), single ([NaN 0 1 2 NaN NaN])) +***** assert (hygeinv ([x, NaN], 4, 2, single (2)), single ([NaN 0 1 2 NaN NaN])) +***** error hygeinv () +***** error hygeinv (1) +***** error hygeinv (1,2) +***** error hygeinv (1,2,3) +***** error hygeinv (1,2,3,4,5) +***** error hygeinv (ones (2), ones (3), 1, 1) +***** error hygeinv (1, ones (2), ones (3), 1) +***** error hygeinv (1, 1, ones (2), ones (3)) +***** error hygeinv (i, 2, 2, 2) +***** error hygeinv (2, i, 2, 2) +***** error hygeinv (2, 2, i, 2) +***** error hygeinv (2, 2, 2, i) +27 tests, 27 passed, 0 known failure, 0 skipped +[inst/distributions/cauchy_rnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/cauchy_rnd.m +***** assert (size (cauchy_rnd (1,2)), [1, 1]) +***** assert (size (cauchy_rnd (ones (2,1), 2)), [2, 1]) +***** assert (size (cauchy_rnd (ones (2,2), 2)), [2, 2]) +***** assert (size (cauchy_rnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (cauchy_rnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (cauchy_rnd (1, 2, 3)), [3, 3]) +***** assert (size (cauchy_rnd (1, 2, [4 1])), [4, 1]) +***** assert (size (cauchy_rnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (cauchy_rnd (1, 2)), "double") +***** assert (class (cauchy_rnd (single (1), 2)), "single") +***** assert (class (cauchy_rnd (single ([1 1]), 2)), "single") +***** assert (class (cauchy_rnd (1, single (2))), "single") +***** assert (class (cauchy_rnd (1, single ([2 2]))), "single") +***** error cauchy_rnd () +***** error cauchy_rnd (1) +***** error cauchy_rnd (ones (3), ones (2)) +***** error cauchy_rnd (ones (2), ones (3)) +***** error cauchy_rnd (i, 2) +***** error cauchy_rnd (2, i) +***** error cauchy_rnd (1,2, -1) +***** error cauchy_rnd (1,2, ones (2)) +***** error cauchy_rnd (1,2, [2 -1 2]) +***** error cauchy_rnd (1,2, 1, ones (2)) +***** error cauchy_rnd (1,2, 1, -1) +***** error cauchy_rnd (ones (2,2), 2, 3) +***** error cauchy_rnd (ones (2,2), 2, [3, 2]) +***** error cauchy_rnd (ones (2,2), 2, 2, 3) +27 tests, 27 passed, 0 known failure, 0 skipped +[inst/distributions/tpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/tpdf.m +***** test + x = rand (10,1); + y = 1./(pi * (1 + x.^2)); + assert (tpdf (x, 1), y, 5*eps); ***** shared x,y - x = [-1 0 1 2 10 11]; - y = [0 0 0.1 0.1 0.1 0]; -***** assert (unidpdf (x, 10*ones (1,6)), y) -***** assert (unidpdf (x, 10), y) -***** assert (unidpdf (x, 10*[0 NaN 1 1 1 1]), [NaN NaN y(3:6)]) -***** assert (unidpdf ([x, NaN], 10), [y, NaN]) -***** assert (unidpdf (single ([x, NaN]), 10), single ([y, NaN])) -***** assert (unidpdf ([x, NaN], single (10)), single ([y, NaN])) -***** error unidpdf () -***** error unidpdf (1) -***** error unidpdf (1,2,3) -***** error unidpdf (ones (3), ones (2)) -***** error unidpdf (ones (2), ones (3)) -***** error unidpdf (i, 2) -***** error unidpdf (2, i) -13 tests, 13 passed, 0 known failure, 0 skipped + x = [-Inf 0 0.5 1 Inf]; + y = 1./(pi * (1 + x.^2)); +***** assert (tpdf (x, ones (1,5)), y, eps) +***** assert (tpdf (x, 1), y, eps) +***** assert (tpdf (x, [0 NaN 1 1 1]), [NaN NaN y(3:5)], eps) +***** assert (tpdf ([x, NaN], 1), [y, NaN], eps) +***** assert (tpdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) +***** assert (tpdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) +***** error tpdf () +***** error tpdf (1) +***** error tpdf (1,2,3) +***** error tpdf (ones (3), ones (2)) +***** error tpdf (ones (2), ones (3)) +***** error tpdf (i, 2) +***** error tpdf (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/gaminv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/gaminv.m +***** shared x + x = [-1 0 0.63212055882855778 1 2]; +***** assert (gaminv (x, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (gaminv (x, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (gaminv (x, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) +***** assert (gaminv (x, [1 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) +***** assert (gaminv (x, 1, [1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (gaminv ([x(1:2) NaN x(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) +***** assert (gaminv ([x, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) +***** assert (gaminv (single ([x, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** assert (gaminv ([x, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** assert (gaminv ([x, NaN], 1, single (1)), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** error gaminv () +***** error gaminv (1) +***** error gaminv (1,2) +***** error gaminv (1,2,3,4) +***** error gaminv (ones (3), ones (2), ones (2)) +***** error gaminv (ones (2), ones (3), ones (2)) +***** error gaminv (ones (2), ones (2), ones (3)) +***** error gaminv (i, 2, 2) +***** error gaminv (2, i, 2) +***** error gaminv (2, 2, i) +20 tests, 20 passed, 0 known failure, 0 skipped +[inst/distributions/binornd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/binornd.m +***** assert (binornd (0, 0, 1), 0) +***** assert (binornd ([0, 0], [0, 0], 1, 2), [0, 0]) +***** assert (size (binornd (2, 1/2)), [1, 1]) +***** assert (size (binornd (2*ones (2,1), 1/2)), [2, 1]) +***** assert (size (binornd (2*ones (2,2), 1/2)), [2, 2]) +***** assert (size (binornd (2, 1/2*ones (2,1))), [2, 1]) +***** assert (size (binornd (2, 1/2*ones (2,2))), [2, 2]) +***** assert (size (binornd (2, 1/2, 3)), [3, 3]) +***** assert (size (binornd (2, 1/2, [4 1])), [4, 1]) +***** assert (size (binornd (2, 1/2, 4, 1)), [4, 1]) +***** assert (class (binornd (2, 0.5)), "double") +***** assert (class (binornd (single (2), 0.5)), "single") +***** assert (class (binornd (single ([2 2]), 0.5)), "single") +***** assert (class (binornd (2, single (0.5))), "single") +***** assert (class (binornd (2, single ([0.5 0.5]))), "single") +***** error binornd () +***** error binornd (1) +***** error binornd (ones (3), ones (2)) +***** error binornd (ones (2), ones (3)) +***** error binornd (i, 2) +***** error binornd (2, i) +***** error binornd (1,2, -1) +***** error binornd (1,2, ones (2)) +***** error binornd (1,2, [2 -1 2]) +***** error binornd (1,2, 1, ones (2)) +***** error binornd (1,2, 1, -1) +***** error binornd (ones (2,2), 2, 3) +***** error binornd (ones (2,2), 2, [3, 2]) +***** error binornd (ones (2,2), 2, 2, 3) +29 tests, 29 passed, 0 known failure, 0 skipped +[inst/distributions/binocdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/binocdf.m +***** shared x,y + x = [-1 0 1 2 3]; + y = [0 1/4 3/4 1 1]; +***** assert (binocdf (x, 2*ones (1,5), 0.5*ones (1,5)), y, eps) +***** assert (binocdf (x, 2, 0.5*ones (1,5)), y, eps) +***** assert (binocdf (x, 2*ones (1,5), 0.5), y, eps) +***** assert (binocdf (x, 2*[0 -1 NaN 1.1 1], 0.5), [0 NaN NaN NaN 1]) +***** assert (binocdf (x, 2, 0.5*[0 -1 NaN 3 1]), [0 NaN NaN NaN 1]) +***** assert (binocdf ([x(1:2) NaN x(4:5)], 2, 0.5), [y(1:2) NaN y(4:5)], eps) +***** assert (binocdf ([x, NaN], 2, 0.5), [y, NaN], eps) +***** assert (binocdf (single ([x, NaN]), 2, 0.5), single ([y, NaN])) +***** assert (binocdf ([x, NaN], single (2), 0.5), single ([y, NaN])) +***** assert (binocdf ([x, NaN], 2, single (0.5)), single ([y, NaN])) +***** error binocdf () +***** error binocdf (1) +***** error binocdf (1,2) +***** error binocdf (1,2,3,4) +***** error binocdf (ones (3), ones (2), ones (2)) +***** error binocdf (ones (2), ones (3), ones (2)) +***** error binocdf (ones (2), ones (2), ones (3)) +***** error binocdf (i, 2, 2) +***** error binocdf (2, i, 2) +***** error binocdf (2, 2, i) +20 tests, 20 passed, 0 known failure, 0 skipped +[inst/distributions/betacdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/betacdf.m +***** shared x,y + x = [-1 0 0.5 1 2]; + y = [0 0 0.75 1 1]; +***** assert (betacdf (x, ones (1,5), 2*ones (1,5)), y) +***** assert (betacdf (x, 1, 2*ones (1,5)), y) +***** assert (betacdf (x, ones (1,5), 2), y) +***** assert (betacdf (x, [0 1 NaN 1 1], 2), [NaN 0 NaN 1 1]) +***** assert (betacdf (x, 1, 2*[0 1 NaN 1 1]), [NaN 0 NaN 1 1]) +***** assert (betacdf ([x(1:2) NaN x(4:5)], 1, 2), [y(1:2) NaN y(4:5)]) +***** assert (betacdf ([x, NaN], 1, 2), [y, NaN]) +***** assert (betacdf (single ([x, NaN]), 1, 2), single ([y, NaN])) +***** assert (betacdf ([x, NaN], single (1), 2), single ([y, NaN])) +***** assert (betacdf ([x, NaN], 1, single (2)), single ([y, NaN])) +***** error betacdf () +***** error betacdf (1) +***** error betacdf (1,2) +***** error betacdf (1,2,3,4) +***** error betacdf (ones (3), ones (2), ones (2)) +***** error betacdf (ones (2), ones (3), ones (2)) +***** error betacdf (ones (2), ones (2), ones (3)) +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/distributions/nbininv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/nbininv.m +***** shared x + x = [-1 0 3/4 1 2]; +***** assert (nbininv (x, ones (1,5), 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (nbininv (x, 1, 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (nbininv (x, ones (1,5), 0.5), [NaN 0 1 Inf NaN]) +***** assert (nbininv (x, [1 0 NaN Inf 1], 0.5), [NaN NaN NaN NaN NaN]) +***** assert (nbininv (x, [1 0 1.5 Inf 1], 0.5), [NaN NaN 2 NaN NaN]) +***** assert (nbininv (x, 1, 0.5*[1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (nbininv ([x(1:2) NaN x(4:5)], 1, 0.5), [NaN 0 NaN Inf NaN]) +***** assert (nbininv ([x, NaN], 1, 0.5), [NaN 0 1 Inf NaN NaN]) +***** assert (nbininv (single ([x, NaN]), 1, 0.5), single ([NaN 0 1 Inf NaN NaN])) +***** assert (nbininv ([x, NaN], single (1), 0.5), single ([NaN 0 1 Inf NaN NaN])) +***** assert (nbininv ([x, NaN], 1, single (0.5)), single ([NaN 0 1 Inf NaN NaN])) +***** shared y, tol + y = magic (3) + 1; + tol = 1; +***** assert (nbininv (nbincdf (1:10, 3, 0.1), 3, 0.1), 1:10, tol) +***** assert (nbininv (nbincdf (1:10, 3./(1:10), 0.1), 3./(1:10), 0.1), 1:10, tol) +***** assert (nbininv (nbincdf (y, 3./y, 1./y), 3./y, 1./y), y, tol) +***** error nbininv () +***** error nbininv (1) +***** error nbininv (1,2) +***** error nbininv (1,2,3,4) +***** error nbininv (ones (3), ones (2), ones (2)) +***** error nbininv (ones (2), ones (3), ones (2)) +***** error nbininv (ones (2), ones (2), ones (3)) +***** error nbininv (i, 2, 2) +***** error nbininv (2, i, 2) +***** error nbininv (2, 2, i) +24 tests, 24 passed, 0 known failure, 0 skipped +[inst/distributions/unifpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/unifpdf.m +***** shared x,y + x = [-1 0 0.5 1 2] + 1; + y = [0 1 1 1 0]; +***** assert (unifpdf (x, ones (1,5), 2*ones (1,5)), y) +***** assert (unifpdf (x, 1, 2*ones (1,5)), y) +***** assert (unifpdf (x, ones (1,5), 2), y) +***** assert (unifpdf (x, [2 NaN 1 1 1], 2), [NaN NaN y(3:5)]) +***** assert (unifpdf (x, 1, 2*[0 NaN 1 1 1]), [NaN NaN y(3:5)]) +***** assert (unifpdf ([x, NaN], 1, 2), [y, NaN]) +***** assert (unifpdf (single ([x, NaN]), 1, 2), single ([y, NaN])) +***** assert (unifpdf (single ([x, NaN]), single (1), 2), single ([y, NaN])) +***** assert (unifpdf ([x, NaN], 1, single (2)), single ([y, NaN])) +***** error unifpdf () +***** error unifpdf (1,2) +***** error unifpdf (1,2,3,4) +***** error unifpdf (ones (3), ones (2), ones (2)) +***** error unifpdf (ones (2), ones (3), ones (2)) +***** error unifpdf (ones (2), ones (2), ones (3)) +***** error unifpdf (i, 2, 2) +***** error unifpdf (2, i, 2) +***** error unifpdf (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/distributions/laplace_cdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_cdf.m +***** shared x,y + x = [-Inf -log(2) 0 log(2) Inf]; + y = [0, 1/4, 1/2, 3/4, 1]; +***** assert (laplace_cdf ([x, NaN]), [y, NaN]) +***** assert (laplace_cdf (single ([x, NaN])), single ([y, NaN])) +***** error laplace_cdf () +***** error laplace_cdf (1,2) +***** error laplace_cdf (i) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/distributions/hygecdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/hygecdf.m +***** shared x,y + x = [-1 0 1 2 3]; + y = [0 1/6 5/6 1 1]; +***** assert (hygecdf (x, 4*ones (1,5), 2, 2), y, eps) +***** assert (hygecdf (x, 4, 2*ones (1,5), 2), y, eps) +***** assert (hygecdf (x, 4, 2, 2*ones (1,5)), y, eps) +***** assert (hygecdf (x, 4*[1 -1 NaN 1.1 1], 2, 2), [y(1) NaN NaN NaN y(5)], eps) +***** assert (hygecdf (x, 4, 2*[1 -1 NaN 1.1 1], 2), [y(1) NaN NaN NaN y(5)], eps) +***** assert (hygecdf (x, 4, 5, 2), [NaN NaN NaN NaN NaN]) +***** assert (hygecdf (x, 4, 2, 2*[1 -1 NaN 1.1 1]), [y(1) NaN NaN NaN y(5)], eps) +***** assert (hygecdf (x, 4, 2, 5), [NaN NaN NaN NaN NaN]) +***** assert (hygecdf ([x(1:2) NaN x(4:5)], 4, 2, 2), [y(1:2) NaN y(4:5)], eps) +***** assert (hygecdf ([x, NaN], 4, 2, 2), [y, NaN], eps) +***** assert (hygecdf (single ([x, NaN]), 4, 2, 2), single ([y, NaN]), eps ("single")) +***** assert (hygecdf ([x, NaN], single (4), 2, 2), single ([y, NaN]), eps ("single")) +***** assert (hygecdf ([x, NaN], 4, single (2), 2), single ([y, NaN]), eps ("single")) +***** assert (hygecdf ([x, NaN], 4, 2, single (2)), single ([y, NaN]), eps ("single")) +***** error hygecdf () +***** error hygecdf (1) +***** error hygecdf (1,2) +***** error hygecdf (1,2,3) +***** error hygecdf (1,2,3,4,5) +***** error hygecdf (ones (2), ones (3), 1, 1) +***** error hygecdf (1, ones (2), ones (3), 1) +***** error hygecdf (1, 1, ones (2), ones (3)) +***** error hygecdf (i, 2, 2, 2) +***** error hygecdf (2, i, 2, 2) +***** error hygecdf (2, 2, i, 2) +***** error hygecdf (2, 2, 2, i) +26 tests, 26 passed, 0 known failure, 0 skipped +[inst/distributions/cauchy_pdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/cauchy_pdf.m +***** shared x,y + x = [-1 0 0.5 1 2]; + y = 1/pi * ( 2 ./ ((x-1).^2 + 2^2) ); +***** assert (cauchy_pdf (x, ones (1,5), 2*ones (1,5)), y) +***** assert (cauchy_pdf (x, 1, 2*ones (1,5)), y) +***** assert (cauchy_pdf (x, ones (1,5), 2), y) +***** assert (cauchy_pdf (x, [-Inf 1 NaN 1 Inf], 2), [NaN y(2) NaN y(4) NaN]) +***** assert (cauchy_pdf (x, 1, 2*[0 1 NaN 1 Inf]), [NaN y(2) NaN y(4) NaN]) +***** assert (cauchy_pdf ([x, NaN], 1, 2), [y, NaN]) +***** assert (cauchy_pdf (single ([x, NaN]), 1, 2), single ([y, NaN]), eps ("single")) +***** assert (cauchy_pdf ([x, NaN], single (1), 2), single ([y, NaN]), eps ("single")) +***** assert (cauchy_pdf ([x, NaN], 1, single (2)), single ([y, NaN]), eps ("single")) +***** test + x = rand (10, 1); + assert (cauchy_pdf (x, 0, 1), tpdf (x, 1), eps); +***** error cauchy_pdf () +***** error cauchy_pdf (1,2) +***** error cauchy_pdf (1,2,3,4) +***** error cauchy_pdf (ones (3), ones (2), ones (2)) +***** error cauchy_pdf (ones (2), ones (3), ones (2)) +***** error cauchy_pdf (ones (2), ones (2), ones (3)) +***** error cauchy_pdf (i, 2, 2) +***** error cauchy_pdf (2, i, 2) +***** error cauchy_pdf (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped [inst/distributions/nbincdf.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/nbincdf.m ***** shared x,y @@ -2922,17 +4310,50 @@ ***** error nbincdf (2, i, 2) ***** error nbincdf (2, 2, i) 20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/stdnormal_cdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_cdf.m +[inst/distributions/unifcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/unifcdf.m ***** shared x,y - x = [-Inf 0 1 Inf]; - y = [0, 0.5, 1/2*(1+erf(1/sqrt(2))), 1]; -***** assert (stdnormal_cdf ([x, NaN]), [y, NaN]) -***** assert (stdnormal_cdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) -***** error stdnormal_cdf () -***** error stdnormal_cdf (1,2) -***** error stdnormal_cdf (i) -5 tests, 5 passed, 0 known failure, 0 skipped + x = [-1 0 0.5 1 2] + 1; + y = [0 0 0.5 1 1]; +***** assert (unifcdf (x, ones (1,5), 2*ones (1,5)), y) +***** assert (unifcdf (x, 1, 2*ones (1,5)), y) +***** assert (unifcdf (x, ones (1,5), 2), y) +***** assert (unifcdf (x, [2 1 NaN 1 1], 2), [NaN 0 NaN 1 1]) +***** assert (unifcdf (x, 1, 2*[0 1 NaN 1 1]), [NaN 0 NaN 1 1]) +***** assert (unifcdf ([x(1:2) NaN x(4:5)], 1, 2), [y(1:2) NaN y(4:5)]) +***** assert (unifcdf ([x, NaN], 1, 2), [y, NaN]) +***** assert (unifcdf (single ([x, NaN]), 1, 2), single ([y, NaN])) +***** assert (unifcdf ([x, NaN], single (1), 2), single ([y, NaN])) +***** assert (unifcdf ([x, NaN], 1, single (2)), single ([y, NaN])) +***** error unifcdf () +***** error unifcdf (1,2) +***** error unifcdf (1,2,3,4) +***** error unifcdf (ones (3), ones (2), ones (2)) +***** error unifcdf (ones (2), ones (3), ones (2)) +***** error unifcdf (ones (2), ones (2), ones (3)) +***** error unifcdf (i, 2, 2) +***** error unifcdf (2, i, 2) +***** error unifcdf (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped +[inst/distributions/poissinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/poissinv.m +***** shared x + x = [-1 0 0.5 1 2]; +***** assert (poissinv (x, ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (poissinv (x, 1), [NaN 0 1 Inf NaN]) +***** assert (poissinv (x, [1 0 NaN 1 1]), [NaN NaN NaN Inf NaN]) +***** assert (poissinv ([x(1:2) NaN x(4:5)], 1), [NaN 0 NaN Inf NaN]) +***** assert (poissinv ([x, NaN], 1), [NaN 0 1 Inf NaN NaN]) +***** assert (poissinv (single ([x, NaN]), 1), single ([NaN 0 1 Inf NaN NaN])) +***** assert (poissinv ([x, NaN], single (1)), single ([NaN 0 1 Inf NaN NaN])) +***** error poissinv () +***** error poissinv (1) +***** error poissinv (1,2,3) +***** error poissinv (ones (3), ones (2)) +***** error poissinv (ones (2), ones (3)) +***** error poissinv (i, 2) +***** error poissinv (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped [inst/distributions/gampdf.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/gampdf.m ***** shared x,y @@ -2958,126 +4379,60 @@ ***** error gampdf (2, i, 2) ***** error gampdf (2, 2, i) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/lognpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/lognpdf.m +[inst/distributions/stdnormal_inv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_inv.m +***** shared x + x = [-1 0 0.5 1 2]; +***** assert (stdnormal_inv (x), [NaN -Inf 0 Inf NaN]) +***** assert (stdnormal_inv ([x, NaN]), [NaN -Inf 0 Inf NaN NaN]) +***** assert (stdnormal_inv (single ([x, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) +***** error stdnormal_inv () +***** error stdnormal_inv (1,2) +***** error stdnormal_inv (i) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/distributions/wblcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/wblcdf.m ***** shared x,y - x = [-1 0 e Inf]; - y = [0, 0, 1/(e*sqrt(2*pi)) * exp(-1/2), 0]; -***** assert (lognpdf (x, zeros (1,4), ones (1,4)), y, eps) -***** assert (lognpdf (x, 0, ones (1,4)), y, eps) -***** assert (lognpdf (x, zeros (1,4), 1), y, eps) -***** assert (lognpdf (x, [0 1 NaN 0], 1), [0 0 NaN y(4)], eps) -***** assert (lognpdf (x, 0, [0 NaN Inf 1]), [NaN NaN NaN y(4)], eps) -***** assert (lognpdf ([x, NaN], 0, 1), [y, NaN], eps) -***** assert (lognpdf (single ([x, NaN]), 0, 1), single ([y, NaN]), eps ("single")) -***** assert (lognpdf ([x, NaN], single (0), 1), single ([y, NaN]), eps ("single")) -***** assert (lognpdf ([x, NaN], 0, single (1)), single ([y, NaN]), eps ("single")) -***** error lognpdf () -***** error lognpdf (1,2) -***** error lognpdf (1,2,3,4) -***** error lognpdf (ones (3), ones (2), ones (2)) -***** error lognpdf (ones (2), ones (3), ones (2)) -***** error lognpdf (ones (2), ones (2), ones (3)) -***** error lognpdf (i, 2, 2) -***** error lognpdf (2, i, 2) -***** error lognpdf (2, 2, i) + x = [-1 0 0.5 1 Inf]; + y = [0, 1-exp(-x(2:4)), 1]; +***** assert (wblcdf (x, ones (1,5), ones (1,5)), y) +***** assert (wblcdf (x, 1, ones (1,5)), y) +***** assert (wblcdf (x, ones (1,5), 1), y) +***** assert (wblcdf (x, [0 1 NaN Inf 1], 1), [NaN 0 NaN NaN 1]) +***** assert (wblcdf (x, 1, [0 1 NaN Inf 1]), [NaN 0 NaN NaN 1]) +***** assert (wblcdf ([x(1:2) NaN x(4:5)], 1, 1), [y(1:2) NaN y(4:5)]) +***** assert (wblcdf ([x, NaN], 1, 1), [y, NaN]) +***** assert (wblcdf (single ([x, NaN]), 1, 1), single ([y, NaN])) +***** assert (wblcdf ([x, NaN], single (1), 1), single ([y, NaN])) +***** assert (wblcdf ([x, NaN], 1, single (1)), single ([y, NaN])) +***** error wblcdf () +***** error wblcdf (1,2,3,4) +***** error wblcdf (ones (3), ones (2), ones (2)) +***** error wblcdf (ones (2), ones (3), ones (2)) +***** error wblcdf (ones (2), ones (2), ones (3)) +***** error wblcdf (i, 2, 2) +***** error wblcdf (2, i, 2) +***** error wblcdf (2, 2, i) 18 tests, 18 passed, 0 known failure, 0 skipped -[inst/distributions/logncdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/logncdf.m -***** shared x,y - x = [-1 0 1 e Inf]; - y = [0, 0, 0.5, 1/2+1/2*erf(1/2), 1]; -***** assert (logncdf (x, zeros (1,5), sqrt(2)*ones (1,5)), y, eps) -***** assert (logncdf (x, 0, sqrt(2)*ones (1,5)), y, eps) -***** assert (logncdf (x, zeros (1,5), sqrt(2)), y, eps) -***** assert (logncdf (x, [0 1 NaN 0 1], sqrt(2)), [0 0 NaN y(4:5)], eps) -***** assert (logncdf (x, 0, sqrt(2)*[0 NaN Inf 1 1]), [NaN NaN NaN y(4:5)], eps) -***** assert (logncdf ([x(1:3) NaN x(5)], 0, sqrt(2)), [y(1:3) NaN y(5)], eps) -***** assert (logncdf ([x, NaN], 0, sqrt(2)), [y, NaN], eps) -***** assert (logncdf (single ([x, NaN]), 0, sqrt(2)), single ([y, NaN]), eps ("single")) -***** assert (logncdf ([x, NaN], single (0), sqrt(2)), single ([y, NaN]), eps ("single")) -***** assert (logncdf ([x, NaN], 0, single (sqrt(2))), single ([y, NaN]), eps ("single")) -***** error logncdf () -***** error logncdf (1,2) -***** error logncdf (1,2,3,4) -***** error logncdf (ones (3), ones (2), ones (2)) -***** error logncdf (ones (2), ones (3), ones (2)) -***** error logncdf (ones (2), ones (2), ones (3)) -***** error logncdf (i, 2, 2) -***** error logncdf (2, i, 2) -***** error logncdf (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_cdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_cdf.m -***** shared x,y - x = [-Inf -log(2) 0 log(2) Inf]; - y = [0, 1/4, 1/2, 3/4, 1]; -***** assert (laplace_cdf ([x, NaN]), [y, NaN]) -***** assert (laplace_cdf (single ([x, NaN])), single ([y, NaN])) -***** error laplace_cdf () -***** error laplace_cdf (1,2) -***** error laplace_cdf (i) -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/distributions/expcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/expcdf.m +[inst/distributions/unidpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/unidpdf.m ***** shared x,y - x = [-1 0 0.5 1 Inf]; - y = [0, 1 - exp(-x(2:end)/2)]; -***** assert (expcdf (x, 2*ones (1,5)), y) -***** assert (expcdf (x, 2), y) -***** assert (expcdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) -***** assert (expcdf ([x, NaN], 2), [y, NaN]) -***** assert (expcdf (single ([x, NaN]), 2), single ([y, NaN])) -***** assert (expcdf ([x, NaN], single (2)), single ([y, NaN])) -***** error expcdf () -***** error expcdf (1) -***** error expcdf (1,2,3) -***** error expcdf (ones (3), ones (2)) -***** error expcdf (ones (2), ones (3)) -***** error expcdf (i, 2) -***** error expcdf (2, i) + x = [-1 0 1 2 10 11]; + y = [0 0 0.1 0.1 0.1 0]; +***** assert (unidpdf (x, 10*ones (1,6)), y) +***** assert (unidpdf (x, 10), y) +***** assert (unidpdf (x, 10*[0 NaN 1 1 1 1]), [NaN NaN y(3:6)]) +***** assert (unidpdf ([x, NaN], 10), [y, NaN]) +***** assert (unidpdf (single ([x, NaN]), 10), single ([y, NaN])) +***** assert (unidpdf ([x, NaN], single (10)), single ([y, NaN])) +***** error unidpdf () +***** error unidpdf (1) +***** error unidpdf (1,2,3) +***** error unidpdf (ones (3), ones (2)) +***** error unidpdf (ones (2), ones (3)) +***** error unidpdf (i, 2) +***** error unidpdf (2, i) 13 tests, 13 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_pdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_pdf.m -***** shared x,y - x = [-Inf -log(2) 0 log(2) Inf]; - y = [0, 1/4, 1/2, 1/4, 0]; -***** assert (laplace_pdf ([x, NaN]), [y, NaN]) -***** assert (laplace_pdf (single ([x, NaN])), single ([y, NaN])) -***** error laplace_pdf () -***** error laplace_pdf (1,2) -***** error laplace_pdf (i) -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/distributions/fpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/fpdf.m -***** test - x = rand (10,1); - x = x(x > 0.1 & x < 0.9); - y = tpdf (sqrt (x), 2) ./ sqrt (x); - assert (fpdf (x, 1, 2), y, 5*eps); -***** shared x,y - x = [-1 0 0.5 1 2]; - y = [0 0 4/9 1/4 1/9]; -***** assert (fpdf (x, 2*ones (1,5), 2*ones (1,5)), y, eps) -***** assert (fpdf (x, 2, 2*ones (1,5)), y, eps) -***** assert (fpdf (x, 2*ones (1,5), 2), y, eps) -***** assert (fpdf (x, [0 NaN Inf 2 2], 2), [NaN NaN NaN y(4:5)], eps) -***** assert (fpdf (x, 2, [0 NaN Inf 2 2]), [NaN NaN NaN y(4:5)], eps) -***** assert (fpdf ([x, NaN], 2, 2), [y, NaN], eps) -***** assert (fpdf (single ([x, NaN]), 2, 2), single ([y, NaN]), eps ("single")) -***** assert (fpdf ([x, NaN], single (2), 2), single ([y, NaN]), eps ("single")) -***** assert (fpdf ([x, NaN], 2, single (2)), single ([y, NaN]), eps ("single")) -***** error fpdf () -***** error fpdf (1) -***** error fpdf (1,2) -***** error fpdf (1,2,3,4) -***** error fpdf (ones (3), ones (2), ones (2)) -***** error fpdf (ones (2), ones (3), ones (2)) -***** error fpdf (ones (2), ones (2), ones (3)) -***** error fpdf (i, 2, 2) -***** error fpdf (2, i, 2) -***** error fpdf (2, 2, i) -20 tests, 20 passed, 0 known failure, 0 skipped [inst/distributions/logistic_pdf.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/logistic_pdf.m ***** shared x,y @@ -3089,186 +4444,36 @@ ***** error logistic_pdf (1,2) ***** error logistic_pdf (i) 5 tests, 5 passed, 0 known failure, 0 skipped -[inst/distributions/chi2cdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2cdf.m -***** shared x,y - x = [-1 0 0.5 1 2]; - y = [0, 1 - exp(-x(2:end)/2)]; -***** assert (chi2cdf (x, 2*ones (1,5)), y, eps) -***** assert (chi2cdf (x, 2), y, eps) -***** assert (chi2cdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)], eps) -***** assert (chi2cdf ([x(1:2) NaN x(4:5)], 2), [y(1:2) NaN y(4:5)], eps) -***** assert (chi2cdf ([x, NaN], 2), [y, NaN], eps) -***** assert (chi2cdf (single ([x, NaN]), 2), single ([y, NaN]), eps ("single")) -***** assert (chi2cdf ([x, NaN], single (2)), single ([y, NaN]), eps ("single")) -***** error chi2cdf () -***** error chi2cdf (1) -***** error chi2cdf (1,2,3) -***** error chi2cdf (ones (3), ones (2)) -***** error chi2cdf (ones (2), ones (3)) -***** error chi2cdf (i, 2) -***** error chi2cdf (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/geocdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/geocdf.m -***** shared x,y - x = [-1 0 1 Inf]; - y = [0 0.5 0.75 1]; -***** assert (geocdf (x, 0.5*ones (1,4)), y) -***** assert (geocdf (x, 0.5), y) -***** assert (geocdf (x, 0.5*[-1 NaN 4 1]), [NaN NaN NaN y(4)]) -***** assert (geocdf ([x(1:2) NaN x(4)], 0.5), [y(1:2) NaN y(4)]) -***** assert (geocdf ([x, NaN], 0.5), [y, NaN]) -***** assert (geocdf (single ([x, NaN]), 0.5), single ([y, NaN])) -***** assert (geocdf ([x, NaN], single (0.5)), single ([y, NaN])) -***** error geocdf () -***** error geocdf (1) -***** error geocdf (1,2,3) -***** error geocdf (ones (3), ones (2)) -***** error geocdf (ones (2), ones (3)) -***** error geocdf (i, 2) -***** error geocdf (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/gamcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/gamcdf.m -***** shared x,y - x = [-1 0 0.5 1 2 Inf]; - y = [0, gammainc(x(2:end), 1)]; -***** assert (gamcdf (x, ones (1,6), ones (1,6)), y) -***** assert (gamcdf (x, 1, ones (1,6)), y) -***** assert (gamcdf (x, ones (1,6), 1), y) -***** assert (gamcdf (x, [0 -Inf NaN Inf 1 1], 1), [NaN NaN NaN NaN y(5:6)]) -***** assert (gamcdf (x, 1, [0 -Inf NaN Inf 1 1]), [NaN NaN NaN NaN y(5:6)]) -***** assert (gamcdf ([x(1:2) NaN x(4:6)], 1, 1), [y(1:2) NaN y(4:6)]) -***** assert (gamcdf ([x, NaN], 1, 1), [y, NaN]) -***** assert (gamcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) -***** error gamcdf () -***** error gamcdf (1) -***** error gamcdf (1,2) -***** error gamcdf (1,2,3,4) -***** error gamcdf (ones (3), ones (2), ones (2)) -***** error gamcdf (ones (2), ones (3), ones (2)) -***** error gamcdf (ones (2), ones (2), ones (3)) -***** error gamcdf (i, 2, 2) -***** error gamcdf (2, i, 2) -***** error gamcdf (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/distributions/nbinrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/nbinrnd.m -***** assert (size (nbinrnd (2, 1/2)), [1, 1]) -***** assert (size (nbinrnd (2*ones (2,1), 1/2)), [2, 1]) -***** assert (size (nbinrnd (2*ones (2,2), 1/2)), [2, 2]) -***** assert (size (nbinrnd (2, 1/2*ones (2,1))), [2, 1]) -***** assert (size (nbinrnd (2, 1/2*ones (2,2))), [2, 2]) -***** assert (size (nbinrnd (2, 1/2, 3)), [3, 3]) -***** assert (size (nbinrnd (2, 1/2, [4 1])), [4, 1]) -***** assert (size (nbinrnd (2, 1/2, 4, 1)), [4, 1]) -***** assert (class (nbinrnd (2, 1/2)), "double") -***** assert (class (nbinrnd (single (2), 1/2)), "single") -***** assert (class (nbinrnd (single ([2 2]), 1/2)), "single") -***** assert (class (nbinrnd (2, single (1/2))), "single") -***** assert (class (nbinrnd (2, single ([1/2 1/2]))), "single") -***** error nbinrnd () -***** error nbinrnd (1) -***** error nbinrnd (ones (3), ones (2)) -***** error nbinrnd (ones (2), ones (3)) -***** error nbinrnd (i, 2) -***** error nbinrnd (2, i) -***** error nbinrnd (1,2, -1) -***** error nbinrnd (1,2, ones (2)) -***** error nbinrnd (1, 2, [2 -1 2]) -***** error nbinrnd (1,2, 1, ones (2)) -***** error nbinrnd (1,2, 1, -1) -***** error nbinrnd (ones (2,2), 2, 3) -***** error nbinrnd (ones (2,2), 2, [3, 2]) -***** error nbinrnd (ones (2,2), 2, 2, 3) +[inst/distributions/normrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/normrnd.m +***** assert (size (normrnd (1,2)), [1, 1]) +***** assert (size (normrnd (ones (2,1), 2)), [2, 1]) +***** assert (size (normrnd (ones (2,2), 2)), [2, 2]) +***** assert (size (normrnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (normrnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (normrnd (1, 2, 3)), [3, 3]) +***** assert (size (normrnd (1, 2, [4 1])), [4, 1]) +***** assert (size (normrnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (normrnd (1, 2)), "double") +***** assert (class (normrnd (single (1), 2)), "single") +***** assert (class (normrnd (single ([1 1]), 2)), "single") +***** assert (class (normrnd (1, single (2))), "single") +***** assert (class (normrnd (1, single ([2 2]))), "single") +***** error normrnd () +***** error normrnd (1) +***** error normrnd (ones (3), ones (2)) +***** error normrnd (ones (2), ones (3)) +***** error normrnd (i, 2) +***** error normrnd (2, i) +***** error normrnd (1,2, -1) +***** error normrnd (1,2, ones (2)) +***** error normrnd (1, 2, [2 -1 2]) +***** error normrnd (1,2, 1, ones (2)) +***** error normrnd (1,2, 1, -1) +***** error normrnd (ones (2,2), 2, 3) +***** error normrnd (ones (2,2), 2, [3, 2]) +***** error normrnd (ones (2,2), 2, 2, 3) 27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/cauchy_pdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/cauchy_pdf.m -***** shared x,y - x = [-1 0 0.5 1 2]; - y = 1/pi * ( 2 ./ ((x-1).^2 + 2^2) ); -***** assert (cauchy_pdf (x, ones (1,5), 2*ones (1,5)), y) -***** assert (cauchy_pdf (x, 1, 2*ones (1,5)), y) -***** assert (cauchy_pdf (x, ones (1,5), 2), y) -***** assert (cauchy_pdf (x, [-Inf 1 NaN 1 Inf], 2), [NaN y(2) NaN y(4) NaN]) -***** assert (cauchy_pdf (x, 1, 2*[0 1 NaN 1 Inf]), [NaN y(2) NaN y(4) NaN]) -***** assert (cauchy_pdf ([x, NaN], 1, 2), [y, NaN]) -***** assert (cauchy_pdf (single ([x, NaN]), 1, 2), single ([y, NaN]), eps ("single")) -***** assert (cauchy_pdf ([x, NaN], single (1), 2), single ([y, NaN]), eps ("single")) -***** assert (cauchy_pdf ([x, NaN], 1, single (2)), single ([y, NaN]), eps ("single")) -***** test - x = rand (10, 1); - assert (cauchy_pdf (x, 0, 1), tpdf (x, 1), eps); -***** error cauchy_pdf () -***** error cauchy_pdf (1,2) -***** error cauchy_pdf (1,2,3,4) -***** error cauchy_pdf (ones (3), ones (2), ones (2)) -***** error cauchy_pdf (ones (2), ones (3), ones (2)) -***** error cauchy_pdf (ones (2), ones (2), ones (3)) -***** error cauchy_pdf (i, 2, 2) -***** error cauchy_pdf (2, i, 2) -***** error cauchy_pdf (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/stdnormal_pdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_pdf.m -***** shared x,y - x = [-Inf 0 1 Inf]; - y = 1/sqrt(2*pi)*exp (-x.^2/2); -***** assert (stdnormal_pdf ([x, NaN]), [y, NaN], eps) -***** assert (stdnormal_pdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) -***** error stdnormal_pdf () -***** error stdnormal_pdf (1,2) -***** error stdnormal_pdf (i) -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/distributions/betacdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/betacdf.m -***** shared x,y - x = [-1 0 0.5 1 2]; - y = [0 0 0.75 1 1]; -***** assert (betacdf (x, ones (1,5), 2*ones (1,5)), y) -***** assert (betacdf (x, 1, 2*ones (1,5)), y) -***** assert (betacdf (x, ones (1,5), 2), y) -***** assert (betacdf (x, [0 1 NaN 1 1], 2), [NaN 0 NaN 1 1]) -***** assert (betacdf (x, 1, 2*[0 1 NaN 1 1]), [NaN 0 NaN 1 1]) -***** assert (betacdf ([x(1:2) NaN x(4:5)], 1, 2), [y(1:2) NaN y(4:5)]) -***** assert (betacdf ([x, NaN], 1, 2), [y, NaN]) -***** assert (betacdf (single ([x, NaN]), 1, 2), single ([y, NaN])) -***** assert (betacdf ([x, NaN], single (1), 2), single ([y, NaN])) -***** assert (betacdf ([x, NaN], 1, single (2)), single ([y, NaN])) -***** error betacdf () -***** error betacdf (1) -***** error betacdf (1,2) -***** error betacdf (1,2,3,4) -***** error betacdf (ones (3), ones (2), ones (2)) -***** error betacdf (ones (2), ones (3), ones (2)) -***** error betacdf (ones (2), ones (2), ones (3)) -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/distributions/finv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/finv.m -***** shared x - x = [-1 0 0.5 1 2]; -***** assert (finv (x, 2*ones (1,5), 2*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (finv (x, 2, 2*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (finv (x, 2*ones (1,5), 2), [NaN 0 1 Inf NaN]) -***** assert (finv (x, [2 -Inf NaN Inf 2], 2), [NaN NaN NaN NaN NaN]) -***** assert (finv (x, 2, [2 -Inf NaN Inf 2]), [NaN NaN NaN NaN NaN]) -***** assert (finv ([x(1:2) NaN x(4:5)], 2, 2), [NaN 0 NaN Inf NaN]) -***** assert (finv ([x, NaN], 2, 2), [NaN 0 1 Inf NaN NaN]) -***** assert (finv (single ([x, NaN]), 2, 2), single ([NaN 0 1 Inf NaN NaN])) -***** assert (finv ([x, NaN], single (2), 2), single ([NaN 0 1 Inf NaN NaN])) -***** assert (finv ([x, NaN], 2, single (2)), single ([NaN 0 1 Inf NaN NaN])) -***** error finv () -***** error finv (1) -***** error finv (1,2) -***** error finv (1,2,3,4) -***** error finv (ones (3), ones (2), ones (2)) -***** error finv (ones (2), ones (3), ones (2)) -***** error finv (ones (2), ones (2), ones (3)) -***** error finv (i, 2, 2) -***** error finv (2, i, 2) -***** error finv (2, 2, i) -20 tests, 20 passed, 0 known failure, 0 skipped [inst/distributions/exppdf.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/exppdf.m ***** shared x,y @@ -3287,156 +4492,72 @@ ***** error exppdf (i, 2) ***** error exppdf (2, i) 12 tests, 12 passed, 0 known failure, 0 skipped -[inst/distributions/geornd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/geornd.m -***** assert (size (geornd (0.5)), [1, 1]) -***** assert (size (geornd (0.5*ones (2,1))), [2, 1]) -***** assert (size (geornd (0.5*ones (2,2))), [2, 2]) -***** assert (size (geornd (0.5, 3)), [3, 3]) -***** assert (size (geornd (0.5, [4 1])), [4, 1]) -***** assert (size (geornd (0.5, 4, 1)), [4, 1]) -***** assert (class (geornd (0.5)), "double") -***** assert (class (geornd (single (0.5))), "single") -***** assert (class (geornd (single ([0.5 0.5]))), "single") -***** assert (class (geornd (single (0))), "single") -***** assert (class (geornd (single (1))), "single") -***** error geornd () -***** error geornd (ones (3), ones (2)) -***** error geornd (ones (2), ones (3)) -***** error geornd (i) -***** error geornd (1, -1) -***** error geornd (1, ones (2)) -***** error geornd (1, [2 -1 2]) -***** error geornd (ones (2,2), 2, 3) -***** error geornd (ones (2,2), 3, 2) -20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/stdnormal_inv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_inv.m -***** shared x - x = [-1 0 0.5 1 2]; -***** assert (stdnormal_inv (x), [NaN -Inf 0 Inf NaN]) -***** assert (stdnormal_inv ([x, NaN]), [NaN -Inf 0 Inf NaN NaN]) -***** assert (stdnormal_inv (single ([x, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) -***** error stdnormal_inv () -***** error stdnormal_inv (1,2) -***** error stdnormal_inv (i) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/distributions/hygecdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/hygecdf.m +[inst/distributions/expcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/expcdf.m ***** shared x,y - x = [-1 0 1 2 3]; - y = [0 1/6 5/6 1 1]; -***** assert (hygecdf (x, 4*ones (1,5), 2, 2), y, eps) -***** assert (hygecdf (x, 4, 2*ones (1,5), 2), y, eps) -***** assert (hygecdf (x, 4, 2, 2*ones (1,5)), y, eps) -***** assert (hygecdf (x, 4*[1 -1 NaN 1.1 1], 2, 2), [y(1) NaN NaN NaN y(5)], eps) -***** assert (hygecdf (x, 4, 2*[1 -1 NaN 1.1 1], 2), [y(1) NaN NaN NaN y(5)], eps) -***** assert (hygecdf (x, 4, 5, 2), [NaN NaN NaN NaN NaN]) -***** assert (hygecdf (x, 4, 2, 2*[1 -1 NaN 1.1 1]), [y(1) NaN NaN NaN y(5)], eps) -***** assert (hygecdf (x, 4, 2, 5), [NaN NaN NaN NaN NaN]) -***** assert (hygecdf ([x(1:2) NaN x(4:5)], 4, 2, 2), [y(1:2) NaN y(4:5)], eps) -***** assert (hygecdf ([x, NaN], 4, 2, 2), [y, NaN], eps) -***** assert (hygecdf (single ([x, NaN]), 4, 2, 2), single ([y, NaN]), eps ("single")) -***** assert (hygecdf ([x, NaN], single (4), 2, 2), single ([y, NaN]), eps ("single")) -***** assert (hygecdf ([x, NaN], 4, single (2), 2), single ([y, NaN]), eps ("single")) -***** assert (hygecdf ([x, NaN], 4, 2, single (2)), single ([y, NaN]), eps ("single")) -***** error hygecdf () -***** error hygecdf (1) -***** error hygecdf (1,2) -***** error hygecdf (1,2,3) -***** error hygecdf (1,2,3,4,5) -***** error hygecdf (ones (2), ones (3), 1, 1) -***** error hygecdf (1, ones (2), ones (3), 1) -***** error hygecdf (1, 1, ones (2), ones (3)) -***** error hygecdf (i, 2, 2, 2) -***** error hygecdf (2, i, 2, 2) -***** error hygecdf (2, 2, i, 2) -***** error hygecdf (2, 2, 2, i) -26 tests, 26 passed, 0 known failure, 0 skipped -[inst/distributions/wblrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/wblrnd.m -***** assert (size (wblrnd (1,2)), [1, 1]) -***** assert (size (wblrnd (ones (2,1), 2)), [2, 1]) -***** assert (size (wblrnd (ones (2,2), 2)), [2, 2]) -***** assert (size (wblrnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (wblrnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (wblrnd (1, 2, 3)), [3, 3]) -***** assert (size (wblrnd (1, 2, [4 1])), [4, 1]) -***** assert (size (wblrnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (wblrnd (1, 2)), "double") -***** assert (class (wblrnd (single (1), 2)), "single") -***** assert (class (wblrnd (single ([1 1]), 2)), "single") -***** assert (class (wblrnd (1, single (2))), "single") -***** assert (class (wblrnd (1, single ([2 2]))), "single") -***** error wblrnd () -***** error wblrnd (1) -***** error wblrnd (ones (3), ones (2)) -***** error wblrnd (ones (2), ones (3)) -***** error wblrnd (i, 2) -***** error wblrnd (2, i) -***** error wblrnd (1,2, -1) -***** error wblrnd (1,2, ones (2)) -***** error wblrnd (1, 2, [2 -1 2]) -***** error wblrnd (1,2, 1, ones (2)) -***** error wblrnd (1,2, 1, -1) -***** error wblrnd (ones (2,2), 2, 3) -***** error wblrnd (ones (2,2), 2, [3, 2]) -***** error wblrnd (ones (2,2), 2, 2, 3) -27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/unifpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/unifpdf.m + x = [-1 0 0.5 1 Inf]; + y = [0, 1 - exp(-x(2:end)/2)]; +***** assert (expcdf (x, 2*ones (1,5)), y) +***** assert (expcdf (x, 2), y) +***** assert (expcdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) +***** assert (expcdf ([x, NaN], 2), [y, NaN]) +***** assert (expcdf (single ([x, NaN]), 2), single ([y, NaN])) +***** assert (expcdf ([x, NaN], single (2)), single ([y, NaN])) +***** error expcdf () +***** error expcdf (1) +***** error expcdf (1,2,3) +***** error expcdf (ones (3), ones (2)) +***** error expcdf (ones (2), ones (3)) +***** error expcdf (i, 2) +***** error expcdf (2, i) +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/distributions/logistic_cdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/logistic_cdf.m ***** shared x,y - x = [-1 0 0.5 1 2] + 1; - y = [0 1 1 1 0]; -***** assert (unifpdf (x, ones (1,5), 2*ones (1,5)), y) -***** assert (unifpdf (x, 1, 2*ones (1,5)), y) -***** assert (unifpdf (x, ones (1,5), 2), y) -***** assert (unifpdf (x, [2 NaN 1 1 1], 2), [NaN NaN y(3:5)]) -***** assert (unifpdf (x, 1, 2*[0 NaN 1 1 1]), [NaN NaN y(3:5)]) -***** assert (unifpdf ([x, NaN], 1, 2), [y, NaN]) -***** assert (unifpdf (single ([x, NaN]), 1, 2), single ([y, NaN])) -***** assert (unifpdf (single ([x, NaN]), single (1), 2), single ([y, NaN])) -***** assert (unifpdf ([x, NaN], 1, single (2)), single ([y, NaN])) -***** error unifpdf () -***** error unifpdf (1,2) -***** error unifpdf (1,2,3,4) -***** error unifpdf (ones (3), ones (2), ones (2)) -***** error unifpdf (ones (2), ones (3), ones (2)) -***** error unifpdf (ones (2), ones (2), ones (3)) -***** error unifpdf (i, 2, 2) -***** error unifpdf (2, i, 2) -***** error unifpdf (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/distributions/betapdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/betapdf.m + x = [-Inf -log(3) 0 log(3) Inf]; + y = [0, 1/4, 1/2, 3/4, 1]; +***** assert (logistic_cdf ([x, NaN]), [y, NaN], eps) +***** assert (logistic_cdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) +***** error logistic_cdf () +***** error logistic_cdf (1,2) +***** error logistic_cdf (i) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/distributions/laplace_pdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_pdf.m ***** shared x,y - x = [-1 0 0.5 1 2]; - y = [0 2 1 0 0]; -***** assert (betapdf (x, ones (1,5), 2*ones (1,5)), y) -***** assert (betapdf (x, 1, 2*ones (1,5)), y) -***** assert (betapdf (x, ones (1,5), 2), y) -***** assert (betapdf (x, [0 NaN 1 1 1], 2), [NaN NaN y(3:5)]) -***** assert (betapdf (x, 1, 2*[0 NaN 1 1 1]), [NaN NaN y(3:5)]) -***** assert (betapdf ([x, NaN], 1, 2), [y, NaN]) -***** assert (betapdf (single ([x, NaN]), 1, 2), single ([y, NaN])) -***** assert (betapdf ([x, NaN], single (1), 2), single ([y, NaN])) -***** assert (betapdf ([x, NaN], 1, single (2)), single ([y, NaN])) -***** test - x = rand (10,1); - y = 1./(pi * sqrt (x.*(1-x))); - assert (betapdf (x, 1/2, 1/2), y, 50*eps); -***** assert (betapdf (0.5, 1000, 1000), 35.678, 1e-3) -***** error betapdf () -***** error betapdf (1) -***** error betapdf (1,2) -***** error betapdf (1,2,3,4) -***** error betapdf (ones (3), ones (2), ones (2)) -***** error betapdf (ones (2), ones (3), ones (2)) -***** error betapdf (ones (2), ones (2), ones (3)) -***** error betapdf (i, 2, 2) -***** error betapdf (2, i, 2) -***** error betapdf (2, 2, i) -21 tests, 21 passed, 0 known failure, 0 skipped + x = [-Inf -log(2) 0 log(2) Inf]; + y = [0, 1/4, 1/2, 1/4, 0]; +***** assert (laplace_pdf ([x, NaN]), [y, NaN]) +***** assert (laplace_pdf (single ([x, NaN])), single ([y, NaN])) +***** error laplace_pdf () +***** error laplace_pdf (1,2) +***** error laplace_pdf (i) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/distributions/nbinpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/nbinpdf.m +***** shared x,y + x = [-1 0 1 2 Inf]; + y = [0 1/2 1/4 1/8 NaN]; +***** assert (nbinpdf (x, ones (1,5), 0.5*ones (1,5)), y) +***** assert (nbinpdf (x, 1, 0.5*ones (1,5)), y) +***** assert (nbinpdf (x, ones (1,5), 0.5), y) +***** assert (nbinpdf (x, [0 1 NaN 1.5 Inf], 0.5), [NaN 1/2 NaN 1.875*0.5^1.5/4 NaN], eps) +***** assert (nbinpdf (x, 1, 0.5*[-1 NaN 4 1 1]), [NaN NaN NaN y(4:5)]) +***** assert (nbinpdf ([x, NaN], 1, 0.5), [y, NaN]) +***** assert (nbinpdf (single ([x, NaN]), 1, 0.5), single ([y, NaN])) +***** assert (nbinpdf ([x, NaN], single (1), 0.5), single ([y, NaN])) +***** assert (nbinpdf ([x, NaN], 1, single (0.5)), single ([y, NaN])) +***** error nbinpdf () +***** error nbinpdf (1) +***** error nbinpdf (1,2) +***** error nbinpdf (1,2,3,4) +***** error nbinpdf (ones (3), ones (2), ones (2)) +***** error nbinpdf (ones (2), ones (3), ones (2)) +***** error nbinpdf (ones (2), ones (2), ones (3)) +***** error nbinpdf (i, 2, 2) +***** error nbinpdf (2, i, 2) +***** error nbinpdf (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped [inst/distributions/norminv.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/norminv.m ***** shared x @@ -3461,150 +4582,37 @@ ***** error norminv (2, i, 2) ***** error norminv (2, 2, i) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/wblcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/wblcdf.m -***** shared x,y - x = [-1 0 0.5 1 Inf]; - y = [0, 1-exp(-x(2:4)), 1]; -***** assert (wblcdf (x, ones (1,5), ones (1,5)), y) -***** assert (wblcdf (x, 1, ones (1,5)), y) -***** assert (wblcdf (x, ones (1,5), 1), y) -***** assert (wblcdf (x, [0 1 NaN Inf 1], 1), [NaN 0 NaN NaN 1]) -***** assert (wblcdf (x, 1, [0 1 NaN Inf 1]), [NaN 0 NaN NaN 1]) -***** assert (wblcdf ([x(1:2) NaN x(4:5)], 1, 1), [y(1:2) NaN y(4:5)]) -***** assert (wblcdf ([x, NaN], 1, 1), [y, NaN]) -***** assert (wblcdf (single ([x, NaN]), 1, 1), single ([y, NaN])) -***** assert (wblcdf ([x, NaN], single (1), 1), single ([y, NaN])) -***** assert (wblcdf ([x, NaN], 1, single (1)), single ([y, NaN])) -***** error wblcdf () -***** error wblcdf (1,2,3,4) -***** error wblcdf (ones (3), ones (2), ones (2)) -***** error wblcdf (ones (2), ones (3), ones (2)) -***** error wblcdf (ones (2), ones (2), ones (3)) -***** error wblcdf (i, 2, 2) -***** error wblcdf (2, i, 2) -***** error wblcdf (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/distributions/unifcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/unifcdf.m -***** shared x,y - x = [-1 0 0.5 1 2] + 1; - y = [0 0 0.5 1 1]; -***** assert (unifcdf (x, ones (1,5), 2*ones (1,5)), y) -***** assert (unifcdf (x, 1, 2*ones (1,5)), y) -***** assert (unifcdf (x, ones (1,5), 2), y) -***** assert (unifcdf (x, [2 1 NaN 1 1], 2), [NaN 0 NaN 1 1]) -***** assert (unifcdf (x, 1, 2*[0 1 NaN 1 1]), [NaN 0 NaN 1 1]) -***** assert (unifcdf ([x(1:2) NaN x(4:5)], 1, 2), [y(1:2) NaN y(4:5)]) -***** assert (unifcdf ([x, NaN], 1, 2), [y, NaN]) -***** assert (unifcdf (single ([x, NaN]), 1, 2), single ([y, NaN])) -***** assert (unifcdf ([x, NaN], single (1), 2), single ([y, NaN])) -***** assert (unifcdf ([x, NaN], 1, single (2)), single ([y, NaN])) -***** error unifcdf () -***** error unifcdf (1,2) -***** error unifcdf (1,2,3,4) -***** error unifcdf (ones (3), ones (2), ones (2)) -***** error unifcdf (ones (2), ones (3), ones (2)) -***** error unifcdf (ones (2), ones (2), ones (3)) -***** error unifcdf (i, 2, 2) -***** error unifcdf (2, i, 2) -***** error unifcdf (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/normcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/normcdf.m -***** shared x,y - x = [-Inf 1 2 Inf]; - y = [0, 0.5, 1/2*(1+erf(1/sqrt(2))), 1]; -***** assert (normcdf (x, ones (1,4), ones (1,4)), y) -***** assert (normcdf (x, 1, ones (1,4)), y) -***** assert (normcdf (x, ones (1,4), 1), y) -***** assert (normcdf (x, [0 -Inf NaN Inf], 1), [y(1) NaN NaN NaN]) -***** assert (normcdf (x, 1, [Inf NaN -1 0]), [NaN NaN NaN NaN]) -***** assert (normcdf ([x(1:2) NaN x(4)], 1, 1), [y(1:2) NaN y(4)]) -***** assert (normcdf ([x, NaN], 1, 1), [y, NaN]) -***** assert (normcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) -***** assert (normcdf ([x, NaN], single (1), 1), single ([y, NaN]), eps ("single")) -***** assert (normcdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps ("single")) -***** error normcdf () -***** error normcdf (1,2) -***** error normcdf (1,2,3,4) -***** error normcdf (ones (3), ones (2), ones (2)) -***** error normcdf (ones (2), ones (3), ones (2)) -***** error normcdf (ones (2), ones (2), ones (3)) -***** error normcdf (i, 2, 2) -***** error normcdf (2, i, 2) -***** error normcdf (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/wblpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/wblpdf.m -***** shared x,y - x = [-1 0 0.5 1 Inf]; - y = [0, exp(-x(2:4)), NaN]; -***** assert (wblpdf (x, ones (1,5), ones (1,5)), y) -***** assert (wblpdf (x, 1, ones (1,5)), y) -***** assert (wblpdf (x, ones (1,5), 1), y) -***** assert (wblpdf (x, [0 NaN Inf 1 1], 1), [NaN NaN NaN y(4:5)]) -***** assert (wblpdf (x, 1, [0 NaN Inf 1 1]), [NaN NaN NaN y(4:5)]) -***** assert (wblpdf ([x, NaN], 1, 1), [y, NaN]) -***** assert (wblpdf (single ([x, NaN]), 1, 1), single ([y, NaN])) -***** assert (wblpdf ([x, NaN], single (1), 1), single ([y, NaN])) -***** assert (wblpdf ([x, NaN], 1, single (1)), single ([y, NaN])) -***** error wblpdf () -***** error wblpdf (1,2,3,4) -***** error wblpdf (ones (3), ones (2), ones (2)) -***** error wblpdf (ones (2), ones (3), ones (2)) -***** error wblpdf (ones (2), ones (2), ones (3)) -***** error wblpdf (i, 2, 2) -***** error wblpdf (2, i, 2) -***** error wblpdf (2, 2, i) -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_rnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_rnd.m -***** assert (size (laplace_rnd (3)), [3, 3]) -***** assert (size (laplace_rnd ([4 1])), [4, 1]) -***** assert (size (laplace_rnd (4,1)), [4, 1]) -***** error laplace_rnd () -***** error laplace_rnd (-1) -***** error laplace_rnd (ones (2)) -***** error laplace_rnd ([2 -1 2]) -***** error laplace_rnd (1, ones (2)) -***** error laplace_rnd (1, -1) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/hygernd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/hygernd.m -***** assert (size (hygernd (4,2,2)), [1, 1]) -***** assert (size (hygernd (4*ones (2,1), 2,2)), [2, 1]) -***** assert (size (hygernd (4*ones (2,2), 2,2)), [2, 2]) -***** assert (size (hygernd (4, 2*ones (2,1), 2)), [2, 1]) -***** assert (size (hygernd (4, 2*ones (2,2), 2)), [2, 2]) -***** assert (size (hygernd (4, 2, 2*ones (2,1))), [2, 1]) -***** assert (size (hygernd (4, 2, 2*ones (2,2))), [2, 2]) -***** assert (size (hygernd (4, 2, 2, 3)), [3, 3]) -***** assert (size (hygernd (4, 2, 2, [4 1])), [4, 1]) -***** assert (size (hygernd (4, 2, 2, 4, 1)), [4, 1]) -***** assert (class (hygernd (4,2,2)), "double") -***** assert (class (hygernd (single (4),2,2)), "single") -***** assert (class (hygernd (single ([4 4]),2,2)), "single") -***** assert (class (hygernd (4,single (2),2)), "single") -***** assert (class (hygernd (4,single ([2 2]),2)), "single") -***** assert (class (hygernd (4,2,single (2))), "single") -***** assert (class (hygernd (4,2,single ([2 2]))), "single") -***** error hygernd () -***** error hygernd (1) -***** error hygernd (1,2) -***** error hygernd (ones (3), ones (2), ones (2), 2) -***** error hygernd (ones (2), ones (3), ones (2), 2) -***** error hygernd (ones (2), ones (2), ones (3), 2) -***** error hygernd (i, 2, 2) -***** error hygernd (2, i, 2) -***** error hygernd (2, 2, i) -***** error hygernd (4,2,2, -1) -***** error hygernd (4,2,2, ones (2)) -***** error hygernd (4,2,2, [2 -1 2]) -***** error hygernd (4*ones (2),2,2, 3) -***** error hygernd (4*ones (2),2,2, [3, 2]) -***** error hygernd (4*ones (2),2,2, 3, 2) -32 tests, 32 passed, 0 known failure, 0 skipped +[inst/distributions/binoinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/binoinv.m +***** shared x + x = [-1 0 0.5 1 2]; +***** assert (binoinv (x, 2*ones (1,5), 0.5*ones (1,5)), [NaN 0 1 2 NaN]) +***** assert (binoinv (x, 2, 0.5*ones (1,5)), [NaN 0 1 2 NaN]) +***** assert (binoinv (x, 2*ones (1,5), 0.5), [NaN 0 1 2 NaN]) +***** assert (binoinv (x, 2*[0 -1 NaN 1.1 1], 0.5), [NaN NaN NaN NaN NaN]) +***** assert (binoinv (x, 2, 0.5*[0 -1 NaN 3 1]), [NaN NaN NaN NaN NaN]) +***** assert (binoinv ([x(1:2) NaN x(4:5)], 2, 0.5), [NaN 0 NaN 2 NaN]) +***** assert (binoinv ([x, NaN], 2, 0.5), [NaN 0 1 2 NaN NaN]) +***** assert (binoinv (single ([x, NaN]), 2, 0.5), single ([NaN 0 1 2 NaN NaN])) +***** assert (binoinv ([x, NaN], single (2), 0.5), single ([NaN 0 1 2 NaN NaN])) +***** assert (binoinv ([x, NaN], 2, single (0.5)), single ([NaN 0 1 2 NaN NaN])) +***** shared y, tol + y = magic (3) + 1; + tol = 1; +***** assert (binoinv (binocdf (1:10, 11, 0.1), 11, 0.1), 1:10, tol) +***** assert (binoinv (binocdf (1:10, 2*(1:10), 0.1), 2*(1:10), 0.1), 1:10, tol) +***** assert (binoinv (binocdf (y, 2*y, 1./y), 2*y, 1./y), y, tol) +***** error binoinv () +***** error binoinv (1) +***** error binoinv (1,2) +***** error binoinv (1,2,3,4) +***** error binoinv (ones (3), ones (2), ones (2)) +***** error binoinv (ones (2), ones (3), ones (2)) +***** error binoinv (ones (2), ones (2), ones (3)) +***** error binoinv (i, 2, 2) +***** error binoinv (2, i, 2) +***** error binoinv (2, 2, i) +23 tests, 23 passed, 0 known failure, 0 skipped [inst/distributions/frnd.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/frnd.m ***** assert (size (frnd (1,2)), [1, 1]) @@ -3635,41 +4643,86 @@ ***** error frnd (ones (2,2), 2, [3, 2]) ***** error frnd (ones (2,2), 2, 2, 3) 27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_inv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_inv.m +[inst/distributions/gamcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/gamcdf.m +***** shared x,y + x = [-1 0 0.5 1 2 Inf]; + y = [0, gammainc(x(2:end), 1)]; +***** assert (gamcdf (x, ones (1,6), ones (1,6)), y) +***** assert (gamcdf (x, 1, ones (1,6)), y) +***** assert (gamcdf (x, ones (1,6), 1), y) +***** assert (gamcdf (x, [0 -Inf NaN Inf 1 1], 1), [NaN NaN NaN NaN y(5:6)]) +***** assert (gamcdf (x, 1, [0 -Inf NaN Inf 1 1]), [NaN NaN NaN NaN y(5:6)]) +***** assert (gamcdf ([x(1:2) NaN x(4:6)], 1, 1), [y(1:2) NaN y(4:6)]) +***** assert (gamcdf ([x, NaN], 1, 1), [y, NaN]) +***** assert (gamcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) +***** error gamcdf () +***** error gamcdf (1) +***** error gamcdf (1,2) +***** error gamcdf (1,2,3,4) +***** error gamcdf (ones (3), ones (2), ones (2)) +***** error gamcdf (ones (2), ones (3), ones (2)) +***** error gamcdf (ones (2), ones (2), ones (3)) +***** error gamcdf (i, 2, 2) +***** error gamcdf (2, i, 2) +***** error gamcdf (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/distributions/logistic_inv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/logistic_inv.m ***** shared x x = [-1 0 0.5 1 2]; -***** assert (laplace_inv (x), [NaN -Inf 0 Inf NaN]) -***** assert (laplace_inv ([x, NaN]), [NaN -Inf 0 Inf NaN NaN]) -***** assert (laplace_inv (single ([x, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) -***** error laplace_inv () -***** error laplace_inv (1,2) -***** error laplace_inv (i) +***** assert (logistic_inv (x), [NaN -Inf 0 Inf NaN]) +***** assert (logistic_inv ([x, NaN]), [NaN -Inf 0 Inf NaN NaN]) +***** assert (logistic_inv (single ([x, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) +***** error logistic_inv () +***** error logistic_inv (1,2) +***** error logistic_inv (i) 6 tests, 6 passed, 0 known failure, 0 skipped -[inst/distributions/normpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/normpdf.m +[inst/distributions/tcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/tcdf.m ***** 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, 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) -***** assert (normpdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) -***** assert (normpdf ([x, NaN], single (1), 1), single ([y, NaN]), eps ("single")) -***** assert (normpdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps ("single")) -***** error normpdf () -***** error normpdf (1,2) -***** error normpdf (1,2,3,4) -***** error normpdf (ones (3), ones (2), ones (2)) -***** error normpdf (ones (2), ones (3), ones (2)) -***** error normpdf (ones (2), ones (2), ones (3)) -***** error normpdf (i, 2, 2) -***** error normpdf (2, i, 2) -***** error normpdf (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped + x = [-Inf 0 1 Inf]; + y = [0 1/2 3/4 1]; +***** assert (tcdf (x, ones (1,4)), y, eps) +***** assert (tcdf (x, 1), y, eps) +***** assert (tcdf (x, [0 1 NaN 1]), [NaN 1/2 NaN 1], eps) +***** assert (tcdf ([x(1:2) NaN x(4)], 1), [y(1:2) NaN y(4)], eps) +***** assert (tcdf ([x, NaN], 1), [y, NaN], eps) +***** assert (tcdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) +***** assert (tcdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) +***** error tcdf () +***** error tcdf (1) +***** error tcdf (1,2,3) +***** error tcdf (ones (3), ones (2)) +***** error tcdf (ones (2), ones (3)) +***** error tcdf (i, 2) +***** error tcdf (2, i) +***** shared tol_rel + tol_rel = 10 * eps; +***** assert (tcdf (10^(-10), 2.5), 0.50000000003618087, -tol_rel) +***** assert (tcdf (10^(-11), 2.5), 0.50000000000361809, -tol_rel) +***** assert (tcdf (10^(-12), 2.5), 0.50000000000036181, -tol_rel) +***** assert (tcdf (10^(-13), 2.5), 0.50000000000003618, -tol_rel) +***** assert (tcdf (10^(-14), 2.5), 0.50000000000000362, -tol_rel) +***** assert (tcdf (10^(-15), 2.5), 0.50000000000000036, -tol_rel) +***** assert (tcdf (10^(-16), 2.5), 0.50000000000000004, -tol_rel) +***** assert (tcdf (-10^1, 2.5), 2.2207478836537124e-03, -tol_rel) +***** assert (tcdf (-10^2, 2.5), 7.1916492116661878e-06, -tol_rel) +***** assert (tcdf (-10^3, 2.5), 2.2747463948307452e-08, -tol_rel) +***** assert (tcdf (-10^4, 2.5), 7.1933970159922115e-11, -tol_rel) +***** assert (tcdf (-10^5, 2.5), 2.2747519231756221e-13, -tol_rel) +26 tests, 26 passed, 0 known failure, 0 skipped +[inst/distributions/stdnormal_cdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_cdf.m +***** shared x,y + x = [-Inf 0 1 Inf]; + y = [0, 0.5, 1/2*(1+erf(1/sqrt(2))), 1]; +***** assert (stdnormal_cdf ([x, NaN]), [y, NaN]) +***** assert (stdnormal_cdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) +***** error stdnormal_cdf () +***** error stdnormal_cdf (1,2) +***** error stdnormal_cdf (i) +5 tests, 5 passed, 0 known failure, 0 skipped [inst/distributions/poissrnd.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/poissrnd.m ***** assert (size (poissrnd (2)), [1, 1]) @@ -3694,6 +4747,104 @@ ***** assert (poissrnd (0, 1, 1), 0) ***** assert (poissrnd ([0, 0, 0], [1, 3]), [0 0 0]) 21 tests, 21 passed, 0 known failure, 0 skipped +[inst/distributions/geopdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/geopdf.m +***** shared x,y + x = [-1 0 1 Inf]; + y = [0, 1/2, 1/4, NaN]; +***** assert (geopdf (x, 0.5*ones (1,4)), y) +***** assert (geopdf (x, 0.5), y) +***** assert (geopdf (x, 0.5*[-1 NaN 4 1]), [NaN NaN NaN y(4)]) +***** assert (geopdf ([x, NaN], 0.5), [y, NaN]) +***** assert (geopdf (single ([x, NaN]), 0.5), single ([y, NaN]), 5*eps ("single")) +***** assert (geopdf ([x, NaN], single (0.5)), single ([y, NaN]), 5*eps ("single")) +***** error geopdf () +***** error geopdf (1) +***** error geopdf (1,2,3) +***** error geopdf (ones (3), ones (2)) +***** error geopdf (ones (2), ones (3)) +***** error geopdf (i, 2) +***** error geopdf (2, i) +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/distributions/fpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/fpdf.m +***** test + x = rand (10,1); + x = x(x > 0.1 & x < 0.9); + y = tpdf (sqrt (x), 2) ./ sqrt (x); + assert (fpdf (x, 1, 2), y, 5*eps); +***** shared x,y + x = [-1 0 0.5 1 2]; + y = [0 0 4/9 1/4 1/9]; +***** assert (fpdf (x, 2*ones (1,5), 2*ones (1,5)), y, eps) +***** assert (fpdf (x, 2, 2*ones (1,5)), y, eps) +***** assert (fpdf (x, 2*ones (1,5), 2), y, eps) +***** assert (fpdf (x, [0 NaN Inf 2 2], 2), [NaN NaN NaN y(4:5)], eps) +***** assert (fpdf (x, 2, [0 NaN Inf 2 2]), [NaN NaN NaN y(4:5)], eps) +***** assert (fpdf ([x, NaN], 2, 2), [y, NaN], eps) +***** assert (fpdf (single ([x, NaN]), 2, 2), single ([y, NaN]), eps ("single")) +***** assert (fpdf ([x, NaN], single (2), 2), single ([y, NaN]), eps ("single")) +***** assert (fpdf ([x, NaN], 2, single (2)), single ([y, NaN]), eps ("single")) +***** error fpdf () +***** error fpdf (1) +***** error fpdf (1,2) +***** error fpdf (1,2,3,4) +***** error fpdf (ones (3), ones (2), ones (2)) +***** error fpdf (ones (2), ones (3), ones (2)) +***** error fpdf (ones (2), ones (2), ones (3)) +***** error fpdf (i, 2, 2) +***** error fpdf (2, i, 2) +***** error fpdf (2, 2, i) +20 tests, 20 passed, 0 known failure, 0 skipped +[inst/distributions/lognrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/lognrnd.m +***** assert (size (lognrnd (1,2)), [1, 1]) +***** assert (size (lognrnd (ones (2,1), 2)), [2, 1]) +***** assert (size (lognrnd (ones (2,2), 2)), [2, 2]) +***** assert (size (lognrnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (lognrnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (lognrnd (1, 2, 3)), [3, 3]) +***** assert (size (lognrnd (1, 2, [4 1])), [4, 1]) +***** assert (size (lognrnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (lognrnd (1, 2)), "double") +***** assert (class (lognrnd (single (1), 2)), "single") +***** assert (class (lognrnd (single ([1 1]), 2)), "single") +***** assert (class (lognrnd (1, single (2))), "single") +***** assert (class (lognrnd (1, single ([2 2]))), "single") +***** error lognrnd () +***** error lognrnd (1) +***** error lognrnd (ones (3), ones (2)) +***** error lognrnd (ones (2), ones (3)) +***** error lognrnd (i, 2) +***** error lognrnd (2, i) +***** error lognrnd (1,2, -1) +***** error lognrnd (1,2, ones (2)) +***** error lognrnd (1, 2, [2 -1 2]) +***** error lognrnd (1,2, 1, ones (2)) +***** error lognrnd (1,2, 1, -1) +***** error lognrnd (ones (2,2), 2, 3) +***** error lognrnd (ones (2,2), 2, [3, 2]) +***** error lognrnd (ones (2,2), 2, 2, 3) +27 tests, 27 passed, 0 known failure, 0 skipped +[inst/distributions/poisspdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/poisspdf.m +***** shared x,y + x = [-1 0 1 2 Inf]; + y = [0, exp(-1)*[1 1 0.5], 0]; +***** assert (poisspdf (x, ones (1,5)), y, eps) +***** assert (poisspdf (x, 1), y, eps) +***** assert (poisspdf (x, [1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)], eps) +***** assert (poisspdf ([x, NaN], 1), [y, NaN], eps) +***** assert (poisspdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) +***** assert (poisspdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) +***** error poisspdf () +***** error poisspdf (1) +***** error poisspdf (1,2,3) +***** error poisspdf (ones (3), ones (2)) +***** error poisspdf (ones (2), ones (3)) +***** error poisspdf (i, 2) +***** error poisspdf (2, i) +13 tests, 13 passed, 0 known failure, 0 skipped [inst/distributions/trnd.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/trnd.m ***** assert (size (trnd (2)), [1, 1]) @@ -3716,57 +4867,99 @@ ***** error trnd (ones (2,2), [3, 2]) ***** error trnd (ones (2,2), 2, 3) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/chi2rnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2rnd.m -***** assert (size (chi2rnd (2)), [1, 1]) -***** assert (size (chi2rnd (ones (2,1))), [2, 1]) -***** assert (size (chi2rnd (ones (2,2))), [2, 2]) -***** assert (size (chi2rnd (1, 3)), [3, 3]) -***** assert (size (chi2rnd (1, [4 1])), [4, 1]) -***** assert (size (chi2rnd (1, 4, 1)), [4, 1]) -***** assert (class (chi2rnd (2)), "double") -***** assert (class (chi2rnd (single (2))), "single") -***** assert (class (chi2rnd (single ([2 2]))), "single") -***** error chi2rnd () -***** error chi2rnd (ones (3), ones (2)) -***** error chi2rnd (ones (2), ones (3)) -***** error chi2rnd (i) -***** error chi2rnd (1, -1) -***** error chi2rnd (1, ones (2)) -***** error chi2rnd (1, [2 -1 2]) -***** error chi2rnd (ones (2,2), 3) -***** error chi2rnd (ones (2,2), [3, 2]) -***** error chi2rnd (ones (2,2), 2, 3) +[inst/distributions/chi2inv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2inv.m +***** shared x + x = [-1 0 0.3934693402873666 1 2]; +***** assert (chi2inv (x, 2*ones (1,5)), [NaN 0 1 Inf NaN], 5*eps) +***** assert (chi2inv (x, 2), [NaN 0 1 Inf NaN], 5*eps) +***** assert (chi2inv (x, 2*[0 1 NaN 1 1]), [NaN 0 NaN Inf NaN], 5*eps) +***** assert (chi2inv ([x(1:2) NaN x(4:5)], 2), [NaN 0 NaN Inf NaN], 5*eps) +***** assert (chi2inv ([x, NaN], 2), [NaN 0 1 Inf NaN NaN], 5*eps) +***** assert (chi2inv (single ([x, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), 5*eps ("single")) +***** assert (chi2inv ([x, NaN], single (2)), single ([NaN 0 1 Inf NaN NaN]), 5*eps ("single")) +***** error chi2inv () +***** error chi2inv (1) +***** error chi2inv (1,2,3) +***** error chi2inv (ones (3), ones (2)) +***** error chi2inv (ones (2), ones (3)) +***** error chi2inv (i, 2) +***** error chi2inv (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/logncdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/logncdf.m +***** shared x,y + x = [-1 0 1 e Inf]; + y = [0, 0, 0.5, 1/2+1/2*erf(1/2), 1]; +***** assert (logncdf (x, zeros (1,5), sqrt(2)*ones (1,5)), y, eps) +***** assert (logncdf (x, 0, sqrt(2)*ones (1,5)), y, eps) +***** assert (logncdf (x, zeros (1,5), sqrt(2)), y, eps) +***** assert (logncdf (x, [0 1 NaN 0 1], sqrt(2)), [0 0 NaN y(4:5)], eps) +***** assert (logncdf (x, 0, sqrt(2)*[0 NaN Inf 1 1]), [NaN NaN NaN y(4:5)], eps) +***** assert (logncdf ([x(1:3) NaN x(5)], 0, sqrt(2)), [y(1:3) NaN y(5)], eps) +***** assert (logncdf ([x, NaN], 0, sqrt(2)), [y, NaN], eps) +***** assert (logncdf (single ([x, NaN]), 0, sqrt(2)), single ([y, NaN]), eps ("single")) +***** assert (logncdf ([x, NaN], single (0), sqrt(2)), single ([y, NaN]), eps ("single")) +***** assert (logncdf ([x, NaN], 0, single (sqrt(2))), single ([y, NaN]), eps ("single")) +***** error logncdf () +***** error logncdf (1,2) +***** error logncdf (1,2,3,4) +***** error logncdf (ones (3), ones (2), ones (2)) +***** error logncdf (ones (2), ones (3), ones (2)) +***** error logncdf (ones (2), ones (2), ones (3)) +***** error logncdf (i, 2, 2) +***** error logncdf (2, i, 2) +***** error logncdf (2, 2, i) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/normrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/normrnd.m -***** assert (size (normrnd (1,2)), [1, 1]) -***** assert (size (normrnd (ones (2,1), 2)), [2, 1]) -***** assert (size (normrnd (ones (2,2), 2)), [2, 2]) -***** assert (size (normrnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (normrnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (normrnd (1, 2, 3)), [3, 3]) -***** assert (size (normrnd (1, 2, [4 1])), [4, 1]) -***** assert (size (normrnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (normrnd (1, 2)), "double") -***** assert (class (normrnd (single (1), 2)), "single") -***** assert (class (normrnd (single ([1 1]), 2)), "single") -***** assert (class (normrnd (1, single (2))), "single") -***** assert (class (normrnd (1, single ([2 2]))), "single") -***** error normrnd () -***** error normrnd (1) -***** error normrnd (ones (3), ones (2)) -***** error normrnd (ones (2), ones (3)) -***** error normrnd (i, 2) -***** error normrnd (2, i) -***** error normrnd (1,2, -1) -***** error normrnd (1,2, ones (2)) -***** error normrnd (1, 2, [2 -1 2]) -***** error normrnd (1,2, 1, ones (2)) -***** error normrnd (1,2, 1, -1) -***** error normrnd (ones (2,2), 2, 3) -***** error normrnd (ones (2,2), 2, [3, 2]) -***** error normrnd (ones (2,2), 2, 2, 3) +[inst/distributions/poisscdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/poisscdf.m +***** shared x,y + x = [-1 0 1 2 Inf]; + y = [0, gammainc(1, (x(2:4) +1), "upper"), 1]; +***** assert (poisscdf (x, ones (1,5)), y) +***** assert (poisscdf (x, 1), y) +***** assert (poisscdf (x, [1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) +***** assert (poisscdf ([x(1:2) NaN Inf x(5)], 1), [y(1:2) NaN 1 y(5)]) +***** assert (poisscdf ([x, NaN], 1), [y, NaN]) +***** assert (poisscdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) +***** assert (poisscdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) +***** error poisscdf () +***** error poisscdf (1) +***** error poisscdf (1,2,3) +***** error poisscdf (ones (3), ones (2)) +***** error poisscdf (ones (2), ones (3)) +***** error poisscdf (i, 2) +***** error poisscdf (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/wblrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/wblrnd.m +***** assert (size (wblrnd (1,2)), [1, 1]) +***** assert (size (wblrnd (ones (2,1), 2)), [2, 1]) +***** assert (size (wblrnd (ones (2,2), 2)), [2, 2]) +***** assert (size (wblrnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (wblrnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (wblrnd (1, 2, 3)), [3, 3]) +***** assert (size (wblrnd (1, 2, [4 1])), [4, 1]) +***** assert (size (wblrnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (wblrnd (1, 2)), "double") +***** assert (class (wblrnd (single (1), 2)), "single") +***** assert (class (wblrnd (single ([1 1]), 2)), "single") +***** assert (class (wblrnd (1, single (2))), "single") +***** assert (class (wblrnd (1, single ([2 2]))), "single") +***** error wblrnd () +***** error wblrnd (1) +***** error wblrnd (ones (3), ones (2)) +***** error wblrnd (ones (2), ones (3)) +***** error wblrnd (i, 2) +***** error wblrnd (2, i) +***** error wblrnd (1,2, -1) +***** error wblrnd (1,2, ones (2)) +***** error wblrnd (1, 2, [2 -1 2]) +***** error wblrnd (1,2, 1, ones (2)) +***** error wblrnd (1,2, 1, -1) +***** error wblrnd (ones (2,2), 2, 3) +***** error wblrnd (ones (2,2), 2, [3, 2]) +***** error wblrnd (ones (2,2), 2, 2, 3) 27 tests, 27 passed, 0 known failure, 0 skipped [inst/distributions/fcdf.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/fcdf.m @@ -3794,83 +4987,39 @@ ***** error fcdf (2, i, 2) ***** error fcdf (2, 2, i) 20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/geopdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/geopdf.m -***** shared x,y - x = [-1 0 1 Inf]; - y = [0, 1/2, 1/4, NaN]; -***** assert (geopdf (x, 0.5*ones (1,4)), y) -***** assert (geopdf (x, 0.5), y) -***** assert (geopdf (x, 0.5*[-1 NaN 4 1]), [NaN NaN NaN y(4)]) -***** assert (geopdf ([x, NaN], 0.5), [y, NaN]) -***** assert (geopdf (single ([x, NaN]), 0.5), single ([y, NaN]), 5*eps ("single")) -***** assert (geopdf ([x, NaN], single (0.5)), single ([y, NaN]), 5*eps ("single")) -***** error geopdf () -***** error geopdf (1) -***** error geopdf (1,2,3) -***** error geopdf (ones (3), ones (2)) -***** error geopdf (ones (2), ones (3)) -***** error geopdf (i, 2) -***** error geopdf (2, i) -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/distributions/cauchy_cdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/cauchy_cdf.m -***** shared x,y +[inst/distributions/laplace_inv.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/laplace_inv.m +***** shared x x = [-1 0 0.5 1 2]; - y = 1/pi * atan ((x-1) / 2) + 1/2; -***** assert (cauchy_cdf (x, ones (1,5), 2*ones (1,5)), y) -***** assert (cauchy_cdf (x, 1, 2*ones (1,5)), y) -***** assert (cauchy_cdf (x, ones (1,5), 2), y) -***** assert (cauchy_cdf (x, [-Inf 1 NaN 1 Inf], 2), [NaN y(2) NaN y(4) NaN]) -***** assert (cauchy_cdf (x, 1, 2*[0 1 NaN 1 Inf]), [NaN y(2) NaN y(4) NaN]) -***** assert (cauchy_cdf ([x(1:2) NaN x(4:5)], 1, 2), [y(1:2) NaN y(4:5)]) -***** assert (cauchy_cdf ([x, NaN], 1, 2), [y, NaN]) -***** assert (cauchy_cdf (single ([x, NaN]), 1, 2), single ([y, NaN]), eps ("single")) -***** assert (cauchy_cdf ([x, NaN], single (1), 2), single ([y, NaN]), eps ("single")) -***** assert (cauchy_cdf ([x, NaN], 1, single (2)), single ([y, NaN]), eps ("single")) -***** error cauchy_cdf () -***** error cauchy_cdf (1,2) -***** error cauchy_cdf (1,2,3,4) -***** error cauchy_cdf (ones (3), ones (2), ones (2)) -***** error cauchy_cdf (ones (2), ones (3), ones (2)) -***** error cauchy_cdf (ones (2), ones (2), ones (3)) -***** error cauchy_cdf (i, 2, 2) -***** error cauchy_cdf (2, i, 2) -***** error cauchy_cdf (2, 2, i) +***** assert (laplace_inv (x), [NaN -Inf 0 Inf NaN]) +***** assert (laplace_inv ([x, NaN]), [NaN -Inf 0 Inf NaN NaN]) +***** assert (laplace_inv (single ([x, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) +***** error laplace_inv () +***** error laplace_inv (1,2) +***** error laplace_inv (i) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/distributions/exprnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/exprnd.m +***** assert (size (exprnd (2)), [1, 1]) +***** assert (size (exprnd (ones (2,1))), [2, 1]) +***** assert (size (exprnd (ones (2,2))), [2, 2]) +***** assert (size (exprnd (1, 3)), [3, 3]) +***** assert (size (exprnd (1, [4 1])), [4, 1]) +***** assert (size (exprnd (1, 4, 1)), [4, 1]) +***** assert (class (exprnd (1)), "double") +***** assert (class (exprnd (single (1))), "single") +***** assert (class (exprnd (single ([1 1]))), "single") +***** error exprnd () +***** error exprnd (1, -1) +***** error exprnd (1, ones (2)) +***** error exprnd (i) +***** error exprnd (1, [2 -1 2]) +***** error exprnd (1, 2, -1) +***** error exprnd (1, 2, ones (2)) +***** error exprnd (ones (2,2), 3) +***** error exprnd (ones (2,2), [3, 2]) +***** error exprnd (ones (2,2), 2, 3) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/binopdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/binopdf.m -***** shared x,y,tol - if (ismac ()) - tol = eps (); - else - tol = 0; - endif - x = [-1 0 1 2 3]; - y = [0 1/4 1/2 1/4 0]; -***** assert (binopdf (x, 2*ones (1,5), 0.5*ones (1,5)), y, tol) -***** assert (binopdf (x, 2, 0.5*ones (1,5)), y, tol) -***** assert (binopdf (x, 2*ones (1,5), 0.5), y, tol) -***** assert (binopdf (x, 2*[0 -1 NaN 1.1 1], 0.5), [0 NaN NaN NaN 0]) -***** assert (binopdf (x, 2, 0.5*[0 -1 NaN 3 1]), [0 NaN NaN NaN 0]) -***** assert (binopdf ([x, NaN], 2, 0.5), [y, NaN], tol) -***** assert (binopdf (0, 3, 0), 1) -***** assert (binopdf (2, 2, 1), 1) -***** assert (binopdf (1, 2, 1), 0) -***** assert (binopdf (single ([x, NaN]), 2, 0.5), single ([y, NaN])) -***** assert (binopdf ([x, NaN], single (2), 0.5), single ([y, NaN])) -***** assert (binopdf ([x, NaN], 2, single (0.5)), single ([y, NaN])) -***** error binopdf () -***** error binopdf (1) -***** error binopdf (1,2) -***** error binopdf (1,2,3,4) -***** error binopdf (ones (3), ones (2), ones (2)) -***** error binopdf (ones (2), ones (3), ones (2)) -***** error binopdf (ones (2), ones (2), ones (3)) -***** error binopdf (i, 2, 2) -***** error binopdf (2, i, 2) -***** error binopdf (2, 2, i) -22 tests, 22 passed, 0 known failure, 0 skipped [inst/distributions/hygepdf.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/hygepdf.m ***** shared x,y @@ -3902,25 +5051,111 @@ ***** error hygepdf (2, 2, i, 2) ***** error hygepdf (2, 2, 2, i) 25 tests, 25 passed, 0 known failure, 0 skipped -[inst/distributions/unidcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/unidcdf.m +[inst/distributions/unifrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/unifrnd.m +***** assert (size (unifrnd (1,2)), [1, 1]) +***** assert (size (unifrnd (ones (2,1), 2)), [2, 1]) +***** assert (size (unifrnd (ones (2,2), 2)), [2, 2]) +***** assert (size (unifrnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (unifrnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (unifrnd (1, 2, 3)), [3, 3]) +***** assert (size (unifrnd (1, 2, [4 1])), [4, 1]) +***** assert (size (unifrnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (unifrnd (1, 2)), "double") +***** assert (class (unifrnd (single (1), 2)), "single") +***** assert (class (unifrnd (single ([1 1]), 2)), "single") +***** assert (class (unifrnd (1, single (2))), "single") +***** assert (class (unifrnd (1, single ([2 2]))), "single") +***** error unifrnd () +***** error unifrnd (1) +***** error unifrnd (ones (3), ones (2)) +***** error unifrnd (ones (2), ones (3)) +***** error unifrnd (i, 2) +***** error unifrnd (2, i) +***** error unifrnd (1,2, -1) +***** error unifrnd (1,2, ones (2)) +***** error unifrnd (1, 2, [2 -1 2]) +***** error unifrnd (1,2, 1, ones (2)) +***** error unifrnd (1,2, 1, -1) +***** error unifrnd (ones (2,2), 2, 3) +***** error unifrnd (ones (2,2), 2, [3, 2]) +***** error unifrnd (ones (2,2), 2, 2, 3) +***** assert (unifrnd (0,0), 0) +***** assert (unifrnd (1,1), 1) +***** assert (unifrnd (1,0), NaN) +30 tests, 30 passed, 0 known failure, 0 skipped +[inst/distributions/geornd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/geornd.m +***** assert (size (geornd (0.5)), [1, 1]) +***** assert (size (geornd (0.5*ones (2,1))), [2, 1]) +***** assert (size (geornd (0.5*ones (2,2))), [2, 2]) +***** assert (size (geornd (0.5, 3)), [3, 3]) +***** assert (size (geornd (0.5, [4 1])), [4, 1]) +***** assert (size (geornd (0.5, 4, 1)), [4, 1]) +***** assert (class (geornd (0.5)), "double") +***** assert (class (geornd (single (0.5))), "single") +***** assert (class (geornd (single ([0.5 0.5]))), "single") +***** assert (class (geornd (single (0))), "single") +***** assert (class (geornd (single (1))), "single") +***** error geornd () +***** error geornd (ones (3), ones (2)) +***** error geornd (ones (2), ones (3)) +***** error geornd (i) +***** error geornd (1, -1) +***** error geornd (1, ones (2)) +***** error geornd (1, [2 -1 2]) +***** error geornd (ones (2,2), 2, 3) +***** error geornd (ones (2,2), 3, 2) +20 tests, 20 passed, 0 known failure, 0 skipped +[inst/distributions/nbinrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/nbinrnd.m +***** assert (size (nbinrnd (2, 1/2)), [1, 1]) +***** assert (size (nbinrnd (2*ones (2,1), 1/2)), [2, 1]) +***** assert (size (nbinrnd (2*ones (2,2), 1/2)), [2, 2]) +***** assert (size (nbinrnd (2, 1/2*ones (2,1))), [2, 1]) +***** assert (size (nbinrnd (2, 1/2*ones (2,2))), [2, 2]) +***** assert (size (nbinrnd (2, 1/2, 3)), [3, 3]) +***** assert (size (nbinrnd (2, 1/2, [4 1])), [4, 1]) +***** assert (size (nbinrnd (2, 1/2, 4, 1)), [4, 1]) +***** assert (class (nbinrnd (2, 1/2)), "double") +***** assert (class (nbinrnd (single (2), 1/2)), "single") +***** assert (class (nbinrnd (single ([2 2]), 1/2)), "single") +***** assert (class (nbinrnd (2, single (1/2))), "single") +***** assert (class (nbinrnd (2, single ([1/2 1/2]))), "single") +***** error nbinrnd () +***** error nbinrnd (1) +***** error nbinrnd (ones (3), ones (2)) +***** error nbinrnd (ones (2), ones (3)) +***** error nbinrnd (i, 2) +***** error nbinrnd (2, i) +***** error nbinrnd (1,2, -1) +***** error nbinrnd (1,2, ones (2)) +***** error nbinrnd (1, 2, [2 -1 2]) +***** error nbinrnd (1,2, 1, ones (2)) +***** error nbinrnd (1,2, 1, -1) +***** error nbinrnd (ones (2,2), 2, 3) +***** error nbinrnd (ones (2,2), 2, [3, 2]) +***** error nbinrnd (ones (2,2), 2, 2, 3) +27 tests, 27 passed, 0 known failure, 0 skipped +[inst/distributions/geocdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/geocdf.m ***** shared x,y - x = [0 1 2.5 10 11]; - y = [0, 0.1 0.2 1.0 1.0]; -***** assert (unidcdf (x, 10*ones (1,5)), y) -***** assert (unidcdf (x, 10), y) -***** assert (unidcdf (x, 10*[0 1 NaN 1 1]), [NaN 0.1 NaN y(4:5)]) -***** assert (unidcdf ([x(1:2) NaN Inf x(5)], 10), [y(1:2) NaN 1 y(5)]) -***** assert (unidcdf ([x, NaN], 10), [y, NaN]) -***** assert (unidcdf (single ([x, NaN]), 10), single ([y, NaN])) -***** assert (unidcdf ([x, NaN], single (10)), single ([y, NaN])) -***** error unidcdf () -***** error unidcdf (1) -***** error unidcdf (1,2,3) -***** error unidcdf (ones (3), ones (2)) -***** error unidcdf (ones (2), ones (3)) -***** error unidcdf (i, 2) -***** error unidcdf (2, i) + x = [-1 0 1 Inf]; + y = [0 0.5 0.75 1]; +***** assert (geocdf (x, 0.5*ones (1,4)), y) +***** assert (geocdf (x, 0.5), y) +***** assert (geocdf (x, 0.5*[-1 NaN 4 1]), [NaN NaN NaN y(4)]) +***** assert (geocdf ([x(1:2) NaN x(4)], 0.5), [y(1:2) NaN y(4)]) +***** assert (geocdf ([x, NaN], 0.5), [y, NaN]) +***** assert (geocdf (single ([x, NaN]), 0.5), single ([y, NaN])) +***** assert (geocdf ([x, NaN], single (0.5)), single ([y, NaN])) +***** error geocdf () +***** error geocdf (1) +***** error geocdf (1,2,3) +***** error geocdf (ones (3), ones (2)) +***** error geocdf (ones (2), ones (3)) +***** error geocdf (i, 2) +***** error geocdf (2, i) 14 tests, 14 passed, 0 known failure, 0 skipped [inst/distributions/tinv.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/tinv.m @@ -3941,17 +5176,17 @@ ***** error tinv (i, 2) ***** error tinv (2, i) 14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/stdnormal_rnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_rnd.m -***** assert (size (stdnormal_rnd (3)), [3, 3]) -***** assert (size (stdnormal_rnd ([4 1])), [4, 1]) -***** assert (size (stdnormal_rnd (4,1)), [4, 1]) -***** error stdnormal_rnd () -***** error stdnormal_rnd (-1) -***** error stdnormal_rnd (ones (2)) -***** error stdnormal_rnd ([2 -1 2]) -***** error stdnormal_rnd (1, ones (2)) -***** error stdnormal_rnd (1, -1) +[inst/distributions/logistic_rnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/logistic_rnd.m +***** assert (size (logistic_rnd (3)), [3, 3]) +***** assert (size (logistic_rnd ([4 1])), [4, 1]) +***** assert (size (logistic_rnd (4,1)), [4, 1]) +***** error logistic_rnd () +***** error logistic_rnd (-1) +***** error logistic_rnd (ones (2)) +***** error logistic_rnd ([2 -1 2]) +***** error logistic_rnd (1, ones (2)) +***** error logistic_rnd (1, -1) 9 tests, 9 passed, 0 known failure, 0 skipped [inst/distributions/geoinv.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/geoinv.m @@ -3972,220 +5207,28 @@ ***** error geoinv (i, 2) ***** error geoinv (2, i) 14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/binornd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/binornd.m -***** assert (binornd (0, 0, 1), 0) -***** assert (binornd ([0, 0], [0, 0], 1, 2), [0, 0]) -***** assert (size (binornd (2, 1/2)), [1, 1]) -***** assert (size (binornd (2*ones (2,1), 1/2)), [2, 1]) -***** assert (size (binornd (2*ones (2,2), 1/2)), [2, 2]) -***** assert (size (binornd (2, 1/2*ones (2,1))), [2, 1]) -***** assert (size (binornd (2, 1/2*ones (2,2))), [2, 2]) -***** assert (size (binornd (2, 1/2, 3)), [3, 3]) -***** assert (size (binornd (2, 1/2, [4 1])), [4, 1]) -***** assert (size (binornd (2, 1/2, 4, 1)), [4, 1]) -***** assert (class (binornd (2, 0.5)), "double") -***** assert (class (binornd (single (2), 0.5)), "single") -***** assert (class (binornd (single ([2 2]), 0.5)), "single") -***** assert (class (binornd (2, single (0.5))), "single") -***** assert (class (binornd (2, single ([0.5 0.5]))), "single") -***** error binornd () -***** error binornd (1) -***** error binornd (ones (3), ones (2)) -***** error binornd (ones (2), ones (3)) -***** error binornd (i, 2) -***** error binornd (2, i) -***** error binornd (1,2, -1) -***** error binornd (1,2, ones (2)) -***** error binornd (1,2, [2 -1 2]) -***** error binornd (1,2, 1, ones (2)) -***** error binornd (1,2, 1, -1) -***** error binornd (ones (2,2), 2, 3) -***** error binornd (ones (2,2), 2, [3, 2]) -***** error binornd (ones (2,2), 2, 2, 3) -29 tests, 29 passed, 0 known failure, 0 skipped -[inst/distributions/hygeinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/hygeinv.m -***** shared x - x = [-1 0 0.5 1 2]; -***** assert (hygeinv (x, 4*ones (1,5), 2*ones (1,5), 2*ones (1,5)), [NaN 0 1 2 NaN]) -***** assert (hygeinv (x, 4*ones (1,5), 2, 2), [NaN 0 1 2 NaN]) -***** assert (hygeinv (x, 4, 2*ones (1,5), 2), [NaN 0 1 2 NaN]) -***** assert (hygeinv (x, 4, 2, 2*ones (1,5)), [NaN 0 1 2 NaN]) -***** assert (hygeinv (x, 4*[1 -1 NaN 1.1 1], 2, 2), [NaN NaN NaN NaN NaN]) -***** assert (hygeinv (x, 4, 2*[1 -1 NaN 1.1 1], 2), [NaN NaN NaN NaN NaN]) -***** assert (hygeinv (x, 4, 5, 2), [NaN NaN NaN NaN NaN]) -***** assert (hygeinv (x, 4, 2, 2*[1 -1 NaN 1.1 1]), [NaN NaN NaN NaN NaN]) -***** assert (hygeinv (x, 4, 2, 5), [NaN NaN NaN NaN NaN]) -***** assert (hygeinv ([x(1:2) NaN x(4:5)], 4, 2, 2), [NaN 0 NaN 2 NaN]) -***** assert (hygeinv ([x, NaN], 4, 2, 2), [NaN 0 1 2 NaN NaN]) -***** assert (hygeinv (single ([x, NaN]), 4, 2, 2), single ([NaN 0 1 2 NaN NaN])) -***** assert (hygeinv ([x, NaN], single (4), 2, 2), single ([NaN 0 1 2 NaN NaN])) -***** assert (hygeinv ([x, NaN], 4, single (2), 2), single ([NaN 0 1 2 NaN NaN])) -***** assert (hygeinv ([x, NaN], 4, 2, single (2)), single ([NaN 0 1 2 NaN NaN])) -***** error hygeinv () -***** error hygeinv (1) -***** error hygeinv (1,2) -***** error hygeinv (1,2,3) -***** error hygeinv (1,2,3,4,5) -***** error hygeinv (ones (2), ones (3), 1, 1) -***** error hygeinv (1, ones (2), ones (3), 1) -***** error hygeinv (1, 1, ones (2), ones (3)) -***** error hygeinv (i, 2, 2, 2) -***** error hygeinv (2, i, 2, 2) -***** error hygeinv (2, 2, i, 2) -***** error hygeinv (2, 2, 2, i) -27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/poisscdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/poisscdf.m -***** shared x,y - x = [-1 0 1 2 Inf]; - y = [0, gammainc(1, (x(2:4) +1), "upper"), 1]; -***** assert (poisscdf (x, ones (1,5)), y) -***** assert (poisscdf (x, 1), y) -***** assert (poisscdf (x, [1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) -***** assert (poisscdf ([x(1:2) NaN Inf x(5)], 1), [y(1:2) NaN 1 y(5)]) -***** assert (poisscdf ([x, NaN], 1), [y, NaN]) -***** assert (poisscdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) -***** assert (poisscdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) -***** error poisscdf () -***** error poisscdf (1) -***** error poisscdf (1,2,3) -***** error poisscdf (ones (3), ones (2)) -***** error poisscdf (ones (2), ones (3)) -***** error poisscdf (i, 2) -***** error poisscdf (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/kolmogorov_smirnov_cdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/kolmogorov_smirnov_cdf.m -***** error kolmogorov_smirnov_cdf () -***** error kolmogorov_smirnov_cdf (1,2,3) -***** error kolmogorov_smirnov_cdf (1, ones (2)) -***** error kolmogorov_smirnov_cdf ([], 1) -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/distributions/exprnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/exprnd.m -***** assert (size (exprnd (2)), [1, 1]) -***** assert (size (exprnd (ones (2,1))), [2, 1]) -***** assert (size (exprnd (ones (2,2))), [2, 2]) -***** assert (size (exprnd (1, 3)), [3, 3]) -***** assert (size (exprnd (1, [4 1])), [4, 1]) -***** assert (size (exprnd (1, 4, 1)), [4, 1]) -***** assert (class (exprnd (1)), "double") -***** assert (class (exprnd (single (1))), "single") -***** assert (class (exprnd (single ([1 1]))), "single") -***** error exprnd () -***** error exprnd (1, -1) -***** error exprnd (1, ones (2)) -***** error exprnd (i) -***** error exprnd (1, [2 -1 2]) -***** error exprnd (1, 2, -1) -***** error exprnd (1, 2, ones (2)) -***** error exprnd (ones (2,2), 3) -***** error exprnd (ones (2,2), [3, 2]) -***** error exprnd (ones (2,2), 2, 3) +[inst/distributions/chi2rnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2rnd.m +***** assert (size (chi2rnd (2)), [1, 1]) +***** assert (size (chi2rnd (ones (2,1))), [2, 1]) +***** assert (size (chi2rnd (ones (2,2))), [2, 2]) +***** assert (size (chi2rnd (1, 3)), [3, 3]) +***** assert (size (chi2rnd (1, [4 1])), [4, 1]) +***** assert (size (chi2rnd (1, 4, 1)), [4, 1]) +***** assert (class (chi2rnd (2)), "double") +***** assert (class (chi2rnd (single (2))), "single") +***** assert (class (chi2rnd (single ([2 2]))), "single") +***** error chi2rnd () +***** error chi2rnd (ones (3), ones (2)) +***** error chi2rnd (ones (2), ones (3)) +***** error chi2rnd (i) +***** error chi2rnd (1, -1) +***** error chi2rnd (1, ones (2)) +***** error chi2rnd (1, [2 -1 2]) +***** error chi2rnd (ones (2,2), 3) +***** error chi2rnd (ones (2,2), [3, 2]) +***** error chi2rnd (ones (2,2), 2, 3) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/tcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/tcdf.m -***** shared x,y - x = [-Inf 0 1 Inf]; - y = [0 1/2 3/4 1]; -***** assert (tcdf (x, ones (1,4)), y, eps) -***** assert (tcdf (x, 1), y, eps) -***** assert (tcdf (x, [0 1 NaN 1]), [NaN 1/2 NaN 1], eps) -***** assert (tcdf ([x(1:2) NaN x(4)], 1), [y(1:2) NaN y(4)], eps) -***** assert (tcdf ([x, NaN], 1), [y, NaN], eps) -***** assert (tcdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) -***** assert (tcdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) -***** error tcdf () -***** error tcdf (1) -***** error tcdf (1,2,3) -***** error tcdf (ones (3), ones (2)) -***** error tcdf (ones (2), ones (3)) -***** error tcdf (i, 2) -***** error tcdf (2, i) -***** shared tol_rel - tol_rel = 10 * eps; -***** assert (tcdf (10^(-10), 2.5), 0.50000000003618087, -tol_rel) -***** assert (tcdf (10^(-11), 2.5), 0.50000000000361809, -tol_rel) -***** assert (tcdf (10^(-12), 2.5), 0.50000000000036181, -tol_rel) -***** assert (tcdf (10^(-13), 2.5), 0.50000000000003618, -tol_rel) -***** assert (tcdf (10^(-14), 2.5), 0.50000000000000362, -tol_rel) -***** assert (tcdf (10^(-15), 2.5), 0.50000000000000036, -tol_rel) -***** assert (tcdf (10^(-16), 2.5), 0.50000000000000004, -tol_rel) -***** assert (tcdf (-10^1, 2.5), 2.2207478836537124e-03, -tol_rel) -***** assert (tcdf (-10^2, 2.5), 7.1916492116661878e-06, -tol_rel) -***** assert (tcdf (-10^3, 2.5), 2.2747463948307452e-08, -tol_rel) -***** assert (tcdf (-10^4, 2.5), 7.1933970159922115e-11, -tol_rel) -***** assert (tcdf (-10^5, 2.5), 2.2747519231756221e-13, -tol_rel) -26 tests, 26 passed, 0 known failure, 0 skipped -[inst/distributions/binocdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/binocdf.m -***** shared x,y - x = [-1 0 1 2 3]; - y = [0 1/4 3/4 1 1]; -***** assert (binocdf (x, 2*ones (1,5), 0.5*ones (1,5)), y, eps) -***** assert (binocdf (x, 2, 0.5*ones (1,5)), y, eps) -***** assert (binocdf (x, 2*ones (1,5), 0.5), y, eps) -***** assert (binocdf (x, 2*[0 -1 NaN 1.1 1], 0.5), [0 NaN NaN NaN 1]) -***** assert (binocdf (x, 2, 0.5*[0 -1 NaN 3 1]), [0 NaN NaN NaN 1]) -***** assert (binocdf ([x(1:2) NaN x(4:5)], 2, 0.5), [y(1:2) NaN y(4:5)], eps) -***** assert (binocdf ([x, NaN], 2, 0.5), [y, NaN], eps) -***** assert (binocdf (single ([x, NaN]), 2, 0.5), single ([y, NaN])) -***** assert (binocdf ([x, NaN], single (2), 0.5), single ([y, NaN])) -***** assert (binocdf ([x, NaN], 2, single (0.5)), single ([y, NaN])) -***** error binocdf () -***** error binocdf (1) -***** error binocdf (1,2) -***** error binocdf (1,2,3,4) -***** error binocdf (ones (3), ones (2), ones (2)) -***** error binocdf (ones (2), ones (3), ones (2)) -***** error binocdf (ones (2), ones (2), ones (3)) -***** error binocdf (i, 2, 2) -***** error binocdf (2, i, 2) -***** error binocdf (2, 2, i) -20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/logistic_cdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/logistic_cdf.m -***** shared x,y - x = [-Inf -log(3) 0 log(3) Inf]; - y = [0, 1/4, 1/2, 3/4, 1]; -***** assert (logistic_cdf ([x, NaN]), [y, NaN], eps) -***** assert (logistic_cdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) -***** error logistic_cdf () -***** error logistic_cdf (1,2) -***** error logistic_cdf (i) -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/distributions/cauchy_rnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/cauchy_rnd.m -***** assert (size (cauchy_rnd (1,2)), [1, 1]) -***** assert (size (cauchy_rnd (ones (2,1), 2)), [2, 1]) -***** assert (size (cauchy_rnd (ones (2,2), 2)), [2, 2]) -***** assert (size (cauchy_rnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (cauchy_rnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (cauchy_rnd (1, 2, 3)), [3, 3]) -***** assert (size (cauchy_rnd (1, 2, [4 1])), [4, 1]) -***** assert (size (cauchy_rnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (cauchy_rnd (1, 2)), "double") -***** assert (class (cauchy_rnd (single (1), 2)), "single") -***** assert (class (cauchy_rnd (single ([1 1]), 2)), "single") -***** assert (class (cauchy_rnd (1, single (2))), "single") -***** assert (class (cauchy_rnd (1, single ([2 2]))), "single") -***** error cauchy_rnd () -***** error cauchy_rnd (1) -***** error cauchy_rnd (ones (3), ones (2)) -***** error cauchy_rnd (ones (2), ones (3)) -***** error cauchy_rnd (i, 2) -***** error cauchy_rnd (2, i) -***** error cauchy_rnd (1,2, -1) -***** error cauchy_rnd (1,2, ones (2)) -***** error cauchy_rnd (1,2, [2 -1 2]) -***** error cauchy_rnd (1,2, 1, ones (2)) -***** error cauchy_rnd (1,2, 1, -1) -***** error cauchy_rnd (ones (2,2), 2, 3) -***** error cauchy_rnd (ones (2,2), 2, [3, 2]) -***** error cauchy_rnd (ones (2,2), 2, 2, 3) -27 tests, 27 passed, 0 known failure, 0 skipped [inst/distributions/gamrnd.m] >>>>> /build/octave-statistics-1.4.2/inst/distributions/gamrnd.m ***** assert (size (gamrnd (1,2)), [1, 1]) @@ -4216,413 +5259,350 @@ ***** error gamrnd (ones (2,2), 2, [3, 2]) ***** error gamrnd (ones (2,2), 2, 2, 3) 27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/nbininv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/nbininv.m -***** shared x - x = [-1 0 3/4 1 2]; -***** assert (nbininv (x, ones (1,5), 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (nbininv (x, 1, 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (nbininv (x, ones (1,5), 0.5), [NaN 0 1 Inf NaN]) -***** assert (nbininv (x, [1 0 NaN Inf 1], 0.5), [NaN NaN NaN NaN NaN]) -***** assert (nbininv (x, [1 0 1.5 Inf 1], 0.5), [NaN NaN 2 NaN NaN]) -***** assert (nbininv (x, 1, 0.5*[1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (nbininv ([x(1:2) NaN x(4:5)], 1, 0.5), [NaN 0 NaN Inf NaN]) -***** assert (nbininv ([x, NaN], 1, 0.5), [NaN 0 1 Inf NaN NaN]) -***** assert (nbininv (single ([x, NaN]), 1, 0.5), single ([NaN 0 1 Inf NaN NaN])) -***** assert (nbininv ([x, NaN], single (1), 0.5), single ([NaN 0 1 Inf NaN NaN])) -***** assert (nbininv ([x, NaN], 1, single (0.5)), single ([NaN 0 1 Inf NaN NaN])) -***** shared y, tol - y = magic (3) + 1; - tol = 1; -***** assert (nbininv (nbincdf (1:10, 3, 0.1), 3, 0.1), 1:10, tol) -***** assert (nbininv (nbincdf (1:10, 3./(1:10), 0.1), 3./(1:10), 0.1), 1:10, tol) -***** assert (nbininv (nbincdf (y, 3./y, 1./y), 3./y, 1./y), y, tol) -***** error nbininv () -***** error nbininv (1) -***** error nbininv (1,2) -***** error nbininv (1,2,3,4) -***** error nbininv (ones (3), ones (2), ones (2)) -***** error nbininv (ones (2), ones (3), ones (2)) -***** error nbininv (ones (2), ones (2), ones (3)) -***** error nbininv (i, 2, 2) -***** error nbininv (2, i, 2) -***** error nbininv (2, 2, i) -24 tests, 24 passed, 0 known failure, 0 skipped -[inst/distributions/expinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/expinv.m -***** shared x - x = [-1 0 0.3934693402873666 1 2]; -***** assert (expinv (x, 2*ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (expinv (x, 2), [NaN 0 1 Inf NaN], eps) -***** assert (expinv (x, 2*[1 0 NaN 1 1]), [NaN NaN NaN Inf NaN], eps) -***** assert (expinv ([x(1:2) NaN x(4:5)], 2), [NaN 0 NaN Inf NaN], eps) -***** assert (expinv ([x, NaN], 2), [NaN 0 1 Inf NaN NaN], eps) -***** assert (expinv (single ([x, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), eps) -***** assert (expinv ([x, NaN], single (2)), single ([NaN 0 1 Inf NaN NaN]), eps) -***** error expinv () -***** error expinv (1) -***** error expinv (1,2,3) -***** error expinv (ones (3), ones (2)) -***** error expinv (ones (2), ones (3)) -***** error expinv (i, 2) -***** error expinv (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/poissinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/poissinv.m -***** shared x +[inst/distributions/betapdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/betapdf.m +***** shared x,y x = [-1 0 0.5 1 2]; -***** assert (poissinv (x, ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (poissinv (x, 1), [NaN 0 1 Inf NaN]) -***** assert (poissinv (x, [1 0 NaN 1 1]), [NaN NaN NaN Inf NaN]) -***** assert (poissinv ([x(1:2) NaN x(4:5)], 1), [NaN 0 NaN Inf NaN]) -***** assert (poissinv ([x, NaN], 1), [NaN 0 1 Inf NaN NaN]) -***** assert (poissinv (single ([x, NaN]), 1), single ([NaN 0 1 Inf NaN NaN])) -***** assert (poissinv ([x, NaN], single (1)), single ([NaN 0 1 Inf NaN NaN])) -***** error poissinv () -***** error poissinv (1) -***** error poissinv (1,2,3) -***** error poissinv (ones (3), ones (2)) -***** error poissinv (ones (2), ones (3)) -***** error poissinv (i, 2) -***** error poissinv (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/tpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/tpdf.m + y = [0 2 1 0 0]; +***** assert (betapdf (x, ones (1,5), 2*ones (1,5)), y) +***** assert (betapdf (x, 1, 2*ones (1,5)), y) +***** assert (betapdf (x, ones (1,5), 2), y) +***** assert (betapdf (x, [0 NaN 1 1 1], 2), [NaN NaN y(3:5)]) +***** assert (betapdf (x, 1, 2*[0 NaN 1 1 1]), [NaN NaN y(3:5)]) +***** assert (betapdf ([x, NaN], 1, 2), [y, NaN]) +***** assert (betapdf (single ([x, NaN]), 1, 2), single ([y, NaN])) +***** assert (betapdf ([x, NaN], single (1), 2), single ([y, NaN])) +***** assert (betapdf ([x, NaN], 1, single (2)), single ([y, NaN])) ***** test x = rand (10,1); - y = 1./(pi * (1 + x.^2)); - assert (tpdf (x, 1), y, 5*eps); -***** shared x,y - x = [-Inf 0 0.5 1 Inf]; - y = 1./(pi * (1 + x.^2)); -***** assert (tpdf (x, ones (1,5)), y, eps) -***** assert (tpdf (x, 1), y, eps) -***** assert (tpdf (x, [0 NaN 1 1 1]), [NaN NaN y(3:5)], eps) -***** assert (tpdf ([x, NaN], 1), [y, NaN], eps) -***** assert (tpdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) -***** assert (tpdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) -***** error tpdf () -***** error tpdf (1) -***** error tpdf (1,2,3) -***** error tpdf (ones (3), ones (2)) -***** error tpdf (ones (2), ones (3)) -***** error tpdf (i, 2) -***** error tpdf (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/logninv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/logninv.m -***** shared x - x = [-1 0 0.5 1 2]; -***** assert (logninv (x, ones (1,5), ones (1,5)), [NaN 0 e Inf NaN]) -***** assert (logninv (x, 1, ones (1,5)), [NaN 0 e Inf NaN]) -***** assert (logninv (x, ones (1,5), 1), [NaN 0 e Inf NaN]) -***** assert (logninv (x, [1 1 NaN 0 1], 1), [NaN 0 NaN Inf NaN]) -***** assert (logninv (x, 1, [1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (logninv ([x(1:2) NaN x(4:5)], 1, 2), [NaN 0 NaN Inf NaN]) -***** assert (logninv ([x, NaN], 1, 1), [NaN 0 e Inf NaN NaN]) -***** assert (logninv (single ([x, NaN]), 1, 1), single ([NaN 0 e Inf NaN NaN])) -***** assert (logninv ([x, NaN], single (1), 1), single ([NaN 0 e Inf NaN NaN])) -***** assert (logninv ([x, NaN], 1, single (1)), single ([NaN 0 e Inf NaN NaN])) -***** error logninv () -***** error logninv (1,2) -***** error logninv (1,2,3,4) -***** error logninv (ones (3), ones (2), ones (2)) -***** error logninv (ones (2), ones (3), ones (2)) -***** error logninv (ones (2), ones (2), ones (3)) -***** error logninv (i, 2, 2) -***** error logninv (2, i, 2) -***** error logninv (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/unifinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/unifinv.m -***** shared x - x = [-1 0 0.5 1 2]; -***** assert (unifinv (x, ones (1,5), 2*ones (1,5)), [NaN 1 1.5 2 NaN]) -***** assert (unifinv (x, 1, 2*ones (1,5)), [NaN 1 1.5 2 NaN]) -***** assert (unifinv (x, ones (1,5), 2), [NaN 1 1.5 2 NaN]) -***** assert (unifinv (x, [1 2 NaN 1 1], 2), [NaN NaN NaN 2 NaN]) -***** assert (unifinv (x, 1, 2*[1 0 NaN 1 1]), [NaN NaN NaN 2 NaN]) -***** assert (unifinv ([x(1:2) NaN x(4:5)], 1, 2), [NaN 1 NaN 2 NaN]) -***** assert (unifinv ([x, NaN], 1, 2), [NaN 1 1.5 2 NaN NaN]) -***** assert (unifinv (single ([x, NaN]), 1, 2), single ([NaN 1 1.5 2 NaN NaN])) -***** assert (unifinv ([x, NaN], single (1), 2), single ([NaN 1 1.5 2 NaN NaN])) -***** assert (unifinv ([x, NaN], 1, single (2)), single ([NaN 1 1.5 2 NaN NaN])) -***** error unifinv () -***** error unifinv (1,2) -***** error unifinv (1,2,3,4) -***** error unifinv (ones (3), ones (2), ones (2)) -***** error unifinv (ones (2), ones (3), ones (2)) -***** error unifinv (ones (2), ones (2), ones (3)) -***** error unifinv (i, 2, 2) -***** error unifinv (2, i, 2) -***** error unifinv (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/logistic_inv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/logistic_inv.m -***** shared x - x = [-1 0 0.5 1 2]; -***** assert (logistic_inv (x), [NaN -Inf 0 Inf NaN]) -***** assert (logistic_inv ([x, NaN]), [NaN -Inf 0 Inf NaN NaN]) -***** assert (logistic_inv (single ([x, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) -***** error logistic_inv () -***** error logistic_inv (1,2) -***** error logistic_inv (i) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/distributions/logistic_rnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/logistic_rnd.m -***** assert (size (logistic_rnd (3)), [3, 3]) -***** assert (size (logistic_rnd ([4 1])), [4, 1]) -***** assert (size (logistic_rnd (4,1)), [4, 1]) -***** error logistic_rnd () -***** error logistic_rnd (-1) -***** error logistic_rnd (ones (2)) -***** error logistic_rnd ([2 -1 2]) -***** error logistic_rnd (1, ones (2)) -***** error logistic_rnd (1, -1) + y = 1./(pi * sqrt (x.*(1-x))); + assert (betapdf (x, 1/2, 1/2), y, 50*eps); +***** assert (betapdf (0.5, 1000, 1000), 35.678, 1e-3) +***** error betapdf () +***** error betapdf (1) +***** error betapdf (1,2) +***** error betapdf (1,2,3,4) +***** error betapdf (ones (3), ones (2), ones (2)) +***** error betapdf (ones (2), ones (3), ones (2)) +***** error betapdf (ones (2), ones (2), ones (3)) +***** error betapdf (i, 2, 2) +***** error betapdf (2, i, 2) +***** error betapdf (2, 2, i) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/distributions/stdnormal_rnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/stdnormal_rnd.m +***** assert (size (stdnormal_rnd (3)), [3, 3]) +***** assert (size (stdnormal_rnd ([4 1])), [4, 1]) +***** assert (size (stdnormal_rnd (4,1)), [4, 1]) +***** error stdnormal_rnd () +***** error stdnormal_rnd (-1) +***** error stdnormal_rnd (ones (2)) +***** error stdnormal_rnd ([2 -1 2]) +***** error stdnormal_rnd (1, ones (2)) +***** error stdnormal_rnd (1, -1) 9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/unidinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/unidinv.m -***** shared x - x = [-1 0 0.5 1 2]; -***** assert (unidinv (x, 10*ones (1,5)), [NaN NaN 5 10 NaN], eps) -***** assert (unidinv (x, 10), [NaN NaN 5 10 NaN], eps) -***** assert (unidinv (x, 10*[0 1 NaN 1 1]), [NaN NaN NaN 10 NaN], eps) -***** assert (unidinv ([x(1:2) NaN x(4:5)], 10), [NaN NaN NaN 10 NaN], eps) -***** assert (unidinv ([x, NaN], 10), [NaN NaN 5 10 NaN NaN], eps) -***** assert (unidinv (single ([x, NaN]), 10), single ([NaN NaN 5 10 NaN NaN]), eps) -***** assert (unidinv ([x, NaN], single (10)), single ([NaN NaN 5 10 NaN NaN]), eps) -***** error unidinv () -***** error unidinv (1) -***** error unidinv (1,2,3) -***** error unidinv (ones (3), ones (2)) -***** error unidinv (ones (2), ones (3)) -***** error unidinv (i, 2) -***** error unidinv (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/betarnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/betarnd.m -***** assert (size (betarnd (1,2)), [1, 1]) -***** assert (size (betarnd (ones (2,1), 2)), [2, 1]) -***** assert (size (betarnd (ones (2,2), 2)), [2, 2]) -***** assert (size (betarnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (betarnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (betarnd (1, 2, 3)), [3, 3]) -***** assert (size (betarnd (1, 2, [4 1])), [4, 1]) -***** assert (size (betarnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (betarnd (1, 2)), "double") -***** assert (class (betarnd (single (1), 2)), "single") -***** assert (class (betarnd (single ([1 1]), 2)), "single") -***** assert (class (betarnd (1, single (2))), "single") -***** assert (class (betarnd (1, single ([2 2]))), "single") -***** error betarnd () -***** error betarnd (1) -***** error betarnd (ones (3), ones (2)) -***** error betarnd (ones (2), ones (3)) -***** error betarnd (i, 2) -***** error betarnd (2, i) -***** error betarnd (1,2, -1) -***** error betarnd (1,2, ones (2)) -***** error binornd (1,2, [2 -1 2]) -***** error betarnd (1,2, 1, ones (2)) -***** error betarnd (1,2, 1, -1) -***** error betarnd (ones (2,2), 2, 3) -***** error betarnd (ones (2,2), 2, [3, 2]) -***** error betarnd (ones (2,2), 2, 2, 3) -27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/nbinpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/nbinpdf.m +[inst/distributions/normcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/normcdf.m ***** shared x,y - x = [-1 0 1 2 Inf]; - y = [0 1/2 1/4 1/8 NaN]; -***** assert (nbinpdf (x, ones (1,5), 0.5*ones (1,5)), y) -***** assert (nbinpdf (x, 1, 0.5*ones (1,5)), y) -***** assert (nbinpdf (x, ones (1,5), 0.5), y) -***** assert (nbinpdf (x, [0 1 NaN 1.5 Inf], 0.5), [NaN 1/2 NaN 1.875*0.5^1.5/4 NaN], eps) -***** assert (nbinpdf (x, 1, 0.5*[-1 NaN 4 1 1]), [NaN NaN NaN y(4:5)]) -***** assert (nbinpdf ([x, NaN], 1, 0.5), [y, NaN]) -***** assert (nbinpdf (single ([x, NaN]), 1, 0.5), single ([y, NaN])) -***** assert (nbinpdf ([x, NaN], single (1), 0.5), single ([y, NaN])) -***** assert (nbinpdf ([x, NaN], 1, single (0.5)), single ([y, NaN])) -***** error nbinpdf () -***** error nbinpdf (1) -***** error nbinpdf (1,2) -***** error nbinpdf (1,2,3,4) -***** error nbinpdf (ones (3), ones (2), ones (2)) -***** error nbinpdf (ones (2), ones (3), ones (2)) -***** error nbinpdf (ones (2), ones (2), ones (3)) -***** error nbinpdf (i, 2, 2) -***** error nbinpdf (2, i, 2) -***** error nbinpdf (2, 2, i) + x = [-Inf 1 2 Inf]; + y = [0, 0.5, 1/2*(1+erf(1/sqrt(2))), 1]; +***** assert (normcdf (x, ones (1,4), ones (1,4)), y) +***** assert (normcdf (x, 1, ones (1,4)), y) +***** assert (normcdf (x, ones (1,4), 1), y) +***** assert (normcdf (x, [0 -Inf NaN Inf], 1), [y(1) NaN NaN NaN]) +***** assert (normcdf (x, 1, [Inf NaN -1 0]), [NaN NaN NaN NaN]) +***** assert (normcdf ([x(1:2) NaN x(4)], 1, 1), [y(1:2) NaN y(4)]) +***** assert (normcdf ([x, NaN], 1, 1), [y, NaN]) +***** assert (normcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) +***** assert (normcdf ([x, NaN], single (1), 1), single ([y, NaN]), eps ("single")) +***** assert (normcdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps ("single")) +***** error normcdf () +***** error normcdf (1,2) +***** error normcdf (1,2,3,4) +***** error normcdf (ones (3), ones (2), ones (2)) +***** error normcdf (ones (2), ones (3), ones (2)) +***** error normcdf (ones (2), ones (2), ones (3)) +***** error normcdf (i, 2, 2) +***** error normcdf (2, i, 2) +***** error normcdf (2, 2, i) 19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/chi2inv.m] ->>>>> /build/octave-statistics-1.4.2/inst/distributions/chi2inv.m -***** shared x - x = [-1 0 0.3934693402873666 1 2]; -***** assert (chi2inv (x, 2*ones (1,5)), [NaN 0 1 Inf NaN], 5*eps) -***** assert (chi2inv (x, 2), [NaN 0 1 Inf NaN], 5*eps) -***** assert (chi2inv (x, 2*[0 1 NaN 1 1]), [NaN 0 NaN Inf NaN], 5*eps) -***** assert (chi2inv ([x(1:2) NaN x(4:5)], 2), [NaN 0 NaN Inf NaN], 5*eps) -***** assert (chi2inv ([x, NaN], 2), [NaN 0 1 Inf NaN NaN], 5*eps) -***** assert (chi2inv (single ([x, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), 5*eps ("single")) -***** assert (chi2inv ([x, NaN], single (2)), single ([NaN 0 1 Inf NaN NaN]), 5*eps ("single")) -***** error chi2inv () -***** error chi2inv (1) -***** error chi2inv (1,2,3) -***** error chi2inv (ones (3), ones (2)) -***** error chi2inv (ones (2), ones (3)) -***** error chi2inv (i, 2) -***** error chi2inv (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/unifstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/unifstat.m +[inst/distributions/lognpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/distributions/lognpdf.m +***** shared x,y + x = [-1 0 e Inf]; + y = [0, 0, 1/(e*sqrt(2*pi)) * exp(-1/2), 0]; +***** assert (lognpdf (x, zeros (1,4), ones (1,4)), y, eps) +***** assert (lognpdf (x, 0, ones (1,4)), y, eps) +***** assert (lognpdf (x, zeros (1,4), 1), y, eps) +***** assert (lognpdf (x, [0 1 NaN 0], 1), [0 0 NaN y(4)], eps) +***** assert (lognpdf (x, 0, [0 NaN Inf 1]), [NaN NaN NaN y(4)], eps) +***** assert (lognpdf ([x, NaN], 0, 1), [y, NaN], eps) +***** assert (lognpdf (single ([x, NaN]), 0, 1), single ([y, NaN]), eps ("single")) +***** assert (lognpdf ([x, NaN], single (0), 1), single ([y, NaN]), eps ("single")) +***** assert (lognpdf ([x, NaN], 0, single (1)), single ([y, NaN]), eps ("single")) +***** error lognpdf () +***** error lognpdf (1,2) +***** error lognpdf (1,2,3,4) +***** error lognpdf (ones (3), ones (2), ones (2)) +***** error lognpdf (ones (2), ones (3), ones (2)) +***** error lognpdf (ones (2), ones (2), ones (3)) +***** error lognpdf (i, 2, 2) +***** error lognpdf (2, i, 2) +***** error lognpdf (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/raylrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/raylrnd.m ***** test - a = 1:6; - b = 2:2:12; - [m, v] = unifstat (a, b); - expected_m = [1.5000, 3.0000, 4.5000, 6.0000, 7.5000, 9.0000]; - expected_v = [0.0833, 0.3333, 0.7500, 1.3333, 2.0833, 3.0000]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); + sigma = 1:6; + x = raylrnd (sigma); + assert (size (x), size (sigma)); + assert (all (x >= 0)); ***** test - a = 1:6; - [m, v] = unifstat (a, 10); - expected_m = [5.5000, 6.0000, 6.5000, 7.0000, 7.5000, 8.0000]; - expected_v = [6.7500, 5.3333, 4.0833, 3.0000, 2.0833, 1.3333]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/gevstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/gevstat.m + sigma = 0.5; + sz = [2, 3]; + x = raylrnd (sigma, sz); + assert (size (x), sz); + assert (all (x >= 0)); ***** test - k = [-1 -0.5 0 0.2 0.4 0.5 1]; - sigma = 2; - mu = 1; - [m, v] = gevstat (k, sigma, mu); - expected_m = [1 1.4551 2.1544 2.6423 3.4460 4.0898 Inf]; - expected_v = [4 3.4336 6.5797 13.3761 59.3288 Inf Inf]; - assert (m, expected_m, -0.001); - assert (v, expected_v, -0.001); + sigma = 0.5; + r = 2; + c = 3; + x = raylrnd (sigma, r, c); + assert (size (x), [r, c]); + assert (all (x >= 0)); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/binotest.m] +>>>>> /build/octave-statistics-1.4.2/inst/binotest.m +***** demo + % flip a coin 1000 times, showing 475 heads + % Hypothesis: coin is fair, i.e. p=1/2 + [h,p_val,ci] = binotest(475,1000,0.5) + % Result: h = 0 : null hypothesis not rejected, coin could be fair + % P value 0.12, i.e. hypothesis not rejected for alpha up to 12% + % 0.444 <= p <= 0.506 with 95% confidence +***** demo + % flip a coin 100 times, showing 65 heads + % Hypothesis: coin shows less than 50% heads, i.e. p<=1/2 + [h,p_val,ci] = binotest(65,100,0.5,'tail','left','alpha',0.01) + % Result: h = 1 : null hypothesis is rejected, i.e. coin shows more heads than tails + % P value 0.0018, i.e. hypothesis not rejected for alpha up to 0.18% + % 0 <= p <= 0.76 with 99% confidence +***** test #example from https://en.wikipedia.org/wiki/Binomial_test + [h,p_val,ci] = binotest (51,235,1/6); + assert (p_val, 0.0437, 0.00005) + [h,p_val,ci] = binotest (51,235,1/6,'tail','left'); + assert (p_val, 0.027, 0.0005) 1 test, 1 passed, 0 known failure, 0 skipped -[inst/gamfit.m] ->>>>> /build/octave-statistics-1.4.2/inst/gamfit.m -***** shared v, res - v = [1.2 1.6 1.7 1.8 1.9 2.0 2.2 2.6 3.0 3.5 4.0 4.8 5.6 6.6 7.6]; - res = gamfit(v); -***** assert (res(1), 3.425, 1E-3); -***** assert (res(2), 0.975, 1E-3); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/pdist2.m] ->>>>> /build/octave-statistics-1.4.2/inst/pdist2.m -***** function dist = euclidean_distance (x, y) - [m, p] = size (X); - [n, p] = size (Y); - D = zeros (m, n); - for i = 1:n - d = X - repmat (Y(i,:), [m 1]); - D(:,i) = sumsq (d, 2); - endfor -***** endfunction +[inst/gevfit.m] +>>>>> /build/octave-statistics-1.4.2/inst/gevfit.m ***** test - x = [1 1 1; 2 2 2; 3 3 3]; - y = [0 0 0; 1 2 3; 0 2 4; 4 7 1]; - d = sqrt([ 3 5 11 45 - 12 2 8 30 - 27 5 11 21]); - assert (pdist2 (x, y), d) + data = 1:50; + [pfit, pci] = gevfit (data); + expected_p = [-0.44 15.19 21.53]'; + expected_pu = [-0.13 19.31 26.49]'; + assert (pfit, expected_p, 0.1); + assert (pci(:, 2), expected_pu, 0.1); 1 test, 1 passed, 0 known failure, 0 skipped -[inst/binostat.m] ->>>>> /build/octave-statistics-1.4.2/inst/binostat.m +[inst/hmmviterbi.m] +>>>>> /build/octave-statistics-1.4.2/inst/hmmviterbi.m ***** test - n = 1:6; - p = 0:0.2:1; - [m, v] = binostat (n, p); - expected_m = [0.00, 0.40, 1.20, 2.40, 4.00, 6.00]; - expected_v = [0.00, 0.32, 0.72, 0.96, 0.80, 0.00]; - assert (m, expected_m, 0.001); + sequence = [1, 2, 1, 1, 1, 2, 2, 1, 2, 3, 3, 3, 3, 2, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 3]; + transprob = [0.8, 0.2; 0.4, 0.6]; + outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; + vpath = hmmviterbi (sequence, transprob, outprob); + expected = [1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]; + assert (vpath, expected); +***** test + sequence = {'A', 'B', 'A', 'A', 'A', 'B', 'B', 'A', 'B', 'C', 'C', 'C', 'C', 'B', 'C', 'A', 'A', 'A', 'A', 'C', 'C', 'B', 'C', 'A', 'C'}; + transprob = [0.8, 0.2; 0.4, 0.6]; + outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; + symbols = {'A', 'B', 'C'}; + statenames = {'One', 'Two'}; + vpath = hmmviterbi (sequence, transprob, outprob, 'symbols', symbols, 'statenames', statenames); + expected = {'One', 'One', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'Two', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One'}; + assert (vpath, expected); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/fstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/fstat.m +***** test + m = 1:6; + n = 5:10; + [mn, v] = fstat (m, n); + expected_mn = [1.6667, 1.5000, 1.4000, 1.3333, 1.2857, 1.2500]; + expected_v = [22.2222, 6.7500, 3.4844, 2.2222, 1.5869, 1.2153]; + assert (mn, expected_mn, 0.001); assert (v, expected_v, 0.001); ***** test - n = 1:6; - [m, v] = binostat (n, 0.5); - expected_m = [0.50, 1.00, 1.50, 2.00, 2.50, 3.00]; - expected_v = [0.25, 0.50, 0.75, 1.00, 1.25, 1.50]; - assert (m, expected_m, 0.001); + m = 1:6; + [mn, v] = fstat (m, 5); + expected_mn = [1.6667, 1.6667, 1.6667, 1.6667, 1.6667, 1.6667]; + expected_v = [22.2222, 13.8889, 11.1111, 9.7222, 8.8889, 8.3333]; + assert (mn, expected_mn, 0.001); assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/princomp.m] +>>>>> /build/octave-statistics-1.4.2/inst/princomp.m +***** shared COEFF,SCORE,latent,tsquare,m,x,R,V,lambda,i,S,F ***** test - n = [-Inf -3 5 0.5 3 NaN 100, Inf]; - [m, v] = binostat (n, 0.5); - assert (isnan (m), [true true false true false true false false]) - assert (isnan (v), [true true false true false true false false]) - assert (m(end), Inf); - assert (v(end), Inf); -***** assert (nthargout (1:2, @binostat, 5, []), {[], []}) -***** assert (nthargout (1:2, @binostat, [], 5), {[], []}) -***** assert (nthargout (1:2, @binostat, "", 5), {[], []}) -***** assert (nthargout (1:2, @binostat, true, 5), {NaN, NaN}) -***** assert (nthargout (1:2, @binostat, 5, true), {5, 0}) -***** assert (size (binostat (randi (100, 10, 5, 4), rand (10, 5, 4))), [10 5 4]) -***** assert (size (binostat (randi (100, 10, 5, 4), 7)), [10 5 4]) -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/ttest.m] ->>>>> /build/octave-statistics-1.4.2/inst/ttest.m + x=[7 4 3 + 4 1 8 + 6 3 5 + 8 6 1 + 8 5 7 + 7 2 9 + 5 3 3 + 9 5 8 + 7 4 5 + 8 2 2]; + R = corrcoef (x); + [V, lambda] = eig (R); + [~, i] = sort(diag(lambda), "descend"); #arrange largest PC first + S = V(:, i) * diag(sqrt(diag(lambda)(i))); +***** assert(diag(S(:, 1:2)*S(:, 1:2)'), [0.8662; 0.8420; 0.9876], 1E-4); #contribution of first 2 PCs to each original variable + B = V(:, i) * diag( 1./ sqrt(diag(lambda)(i))); + F = zscore(x)*B; + [COEFF,SCORE,latent,tsquare] = princomp(zscore(x, 1)); +***** assert(tsquare,sumsq(F, 2),1E4*eps); ***** test - x = 8:0.1:12; - [h, pval, ci] = ttest (x, 10); - assert (h, 0) - assert (pval, 1, 10*eps) - assert (ci, [9.6219 10.3781], 1E-5) - [h, pval, ci0] = ttest (x, 0); - assert (h, 1) - assert (pval, 0) - 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) - assert (ci, [9.68498 Inf], 1E-5) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/wishrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/wishrnd.m -***** 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]); -***** assert(size (wishrnd (eye(2), 2, [], 3)), [2, 2, 3]); -***** error wishrnd () -***** error wishrnd (1) -***** error wishrnd ([1; 1], 2) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/bbsinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/bbsinv.m -***** shared x,y,f - 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, 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]) -***** 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])) -***** error bbsinv () -***** error bbsinv (1) -***** error bbsinv (1,2,3) -***** error bbsinv (1,2,3,4,5) -***** error bbsinv (ones (3), ones (2), ones(2), ones(2)) -***** 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, 4, 3, 2) -***** error bbsinv (1, i, 3, 2) -***** error bbsinv (1, 4, i, 2) -***** error bbsinv (1, 4, 3, i) -25 tests, 25 passed, 0 known failure, 0 skipped + x=[1,2,3;2,1,3]'; + [COEFF,SCORE,latent,tsquare] = princomp(x); + m=[sqrt(2),sqrt(2);sqrt(2),-sqrt(2);-2*sqrt(2),0]/2; + m(:,1) = m(:,1)*sign(COEFF(1,1)); + m(:,2) = m(:,2)*sign(COEFF(1,2)); +***** assert(COEFF,m(1:2,:),10*eps); +***** assert(SCORE,-m,10*eps); +***** assert(latent,[1.5;.5],10*eps); +***** assert(tsquare,[4;4;4]/3,10*eps); +***** test + x=x'; + [COEFF,SCORE,latent,tsquare] = princomp(x); + m=[sqrt(2),sqrt(2),0;-sqrt(2),sqrt(2),0;0,0,2]/2; + m(:,1) = m(:,1)*sign(COEFF(1,1)); + m(:,2) = m(:,2)*sign(COEFF(1,2)); + m(:,3) = m(:,3)*sign(COEFF(3,3)); +***** assert(COEFF,m,10*eps); +***** assert(SCORE(:,1),-m(1:2,1),10*eps); +***** assert(SCORE(:,2:3),zeros(2),10*eps); +***** assert(latent,[1;0;0],10*eps); +***** assert(tsquare,[0.5;0.5],10*eps) +***** test + [COEFF,SCORE,latent,tsquare] = princomp(x, "econ"); +***** assert(COEFF,m(:, 1),10*eps); +***** assert(SCORE,-m(1:2,1),10*eps); +***** assert(latent,[1],10*eps); +***** assert(tsquare,[0.5;0.5],10*eps) +19 tests, 19 passed, 0 known failure, 0 skipped +[inst/grp2idx.m] +>>>>> /build/octave-statistics-1.4.2/inst/grp2idx.m +***** test + in = [true false false true]; + out = {[2; 1; 1; 2] {"0"; "1"} [false; true]}; + assert (nthargout (1:3, @grp2idx, in), out) + assert (nthargout (1:3, @grp2idx, in), nthargout (1:3, @grp2idx, in')) +***** test + assert (nthargout (1:3, @grp2idx, [false true]), + {[1; 2] {"0"; "1"} [false; true]}); + assert (nthargout (1:3, @grp2idx, [true false]), + {[2; 1] {"0"; "1"} [false; true]}); +***** assert (nthargout (1:3, @grp2idx, ["oct"; "sci"; "oct"; "oct"; "sci"]), + {[1; 2; 1; 1; 2] {"oct"; "sci"} ["oct"; "sci"]}); +***** assert (nthargout (1:3, @grp2idx, {"oct"; "sci"; "oct"; "oct"; "sci"}), + {[1; 2; 1; 1; 2] {"oct"; "sci"} {"oct"; "sci"}}); +***** assert (nthargout (1:3, @grp2idx, [ 1 -3 -2 -3 -3 2 1 -1 3 -3]), + {[4; 1; 2; 1; 1; 5; 4; 3; 6; 1] {"-3"; "-2"; "-1"; "1"; "2"; "3"} ... + [-3; -2; -1; 1; 2; 3]}); +***** assert (nthargout (1:3, @grp2idx, [2 2 3 NaN 2 3]), + {[1; 1; 2; NaN; 1; 2] {"2"; "3"} [2; 3]}) +***** assert (nthargout (1:3, @grp2idx, {"et" "sa" "sa" "" "et"}), + {[1; 2; 2; NaN; 1] {"et"; "sa"} {"et"; "sa"}}) +***** xtest <51928> assert (nthargout (1:3, @grp2idx, ["sci"; "oct"; "sci"; "oct"; "oct"]), + {[1; 2; 1; 2; 2] {"sci"; "oct"} ["sci"; "oct"]}); +!!!!! known bug: https://octave.org/testfailure/?51928 +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + (1) 2 1 Abs err 1 exceeds tol 0 by 1 + (2) 1 2 Abs err 1 exceeds tol 0 by 1 + (3) 2 1 Abs err 1 exceeds tol 0 by 1 + (4) 1 2 Abs err 1 exceeds tol 0 by 1 + (5) 1 2 Abs err 1 exceeds tol 0 by 1 + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] oct sci Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] sci oct Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] osccti soccit Strings don't match +***** xtest <51928> assert (nthargout (1:3, @grp2idx, {"sci"; "oct"; "sci"; "oct"; "oct"}), + {[1; 2; 1; 2; 2] {"sci"; "oct"} {"sci"; "oct"}}); +!!!!! known bug: https://octave.org/testfailure/?51928 +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + (1) 2 1 Abs err 1 exceeds tol 0 by 1 + (2) 1 2 Abs err 1 exceeds tol 0 by 1 + (3) 2 1 Abs err 1 exceeds tol 0 by 1 + (4) 1 2 Abs err 1 exceeds tol 0 by 1 + (5) 1 2 Abs err 1 exceeds tol 0 by 1 + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] oct sci Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] sci oct Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] oct sci Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] sci oct Strings don't match +***** xtest <51928> assert (nthargout (1:3, @grp2idx, {"sa" "et" "et" "" "sa"}), + {[1; 2; 2; NaN; 1] {"sa"; "et"} {"sa"; "et"}}) +!!!!! known bug: https://octave.org/testfailure/?51928 +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + (1) 2 1 Abs err 1 exceeds tol 0 by 1 + (2) 1 2 Abs err 1 exceeds tol 0 by 1 + (3) 1 2 Abs err 1 exceeds tol 0 by 1 + (5) 2 1 Abs err 1 exceeds tol 0 by 1 + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] et sa Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] sa et Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] et sa Strings don't match + +ASSERT errors for: assert (cond {i},expected {i},tol) + + Location | Observed | Expected | Reason + [] sa et Strings don't match +10 tests, 7 passed, 0 known failure, 3 skipped [inst/raylcdf.m] >>>>> /build/octave-statistics-1.4.2/inst/raylcdf.m ***** test @@ -4637,57 +5617,150 @@ expected_p = [0.0000, 0.3935, 0.8647, 0.9889, 0.9997, 1.0000]; assert (p, expected_p, 0.001); 2 tests, 2 passed, 0 known failure, 0 skipped -[inst/tricdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/tricdf.m -***** shared x,y - x = [-1, 0, 0.1, 0.5, 0.9, 1, 2] + 1; - y = [0, 0, 0.02, 0.5, 0.98, 1 1]; -***** assert (tricdf (x, ones (1,7), 2*ones (1,7), 1.5*ones (1,7)), y, eps) -***** assert (tricdf (x, 1*ones (1,7), 2, 1.5), y, eps) -***** assert (tricdf (x, 1, 2*ones (1,7), 1.5), y, eps) -***** assert (tricdf (x, 1, 2, 1.5*ones (1,7)), y, eps) -***** assert (tricdf (x, 1, 2, 1.5), y, eps) -***** assert (tricdf (x, [1, 1, NaN, 1, 1, 1, 1], 2, 1.5), [y(1:2), NaN, y(4:7)], eps) -***** assert (tricdf (x, 1, 2*[1, 1, NaN, 1, 1, 1, 1], 1.5), [y(1:2), NaN, y(4:7)], eps) -***** assert (tricdf (x, 1, 2, 1.5*[1, 1, NaN, 1, 1, 1, 1]), [y(1:2), NaN, y(4:7)], eps) -***** assert (tricdf ([x, NaN], 1, 2, 1.5), [y, NaN], eps) -***** assert (tricdf (single ([x, NaN]), 1, 2, 1.5), single ([y, NaN]), eps('single')) -***** assert (tricdf ([x, NaN], single (1), 2, 1.5), single ([y, NaN]), eps('single')) -***** assert (tricdf ([x, NaN], 1, single (2), 1.5), single ([y, NaN]), eps('single')) -***** assert (tricdf ([x, NaN], 1, 2, single (1.5)), single ([y, NaN]), eps('single')) -***** error tricdf () -***** error tricdf (1) -***** error tricdf (1,2) -***** error tricdf (1,2,3) -***** error tricdf (1,2,3,4,5) -***** error tricdf (1, ones (3), ones (2), ones (2)) -***** error tricdf (1, ones (2), ones (3), ones (2)) -***** error tricdf (1, ones (2), ones (2), ones (3)) -***** error tricdf (i, 2, 2, 2) -***** error tricdf (2, i, 2, 2) -***** error tricdf (2, 2, i, 2) -***** error tricdf (2, 2, 2, i) -25 tests, 25 passed, 0 known failure, 0 skipped -[inst/hygestat.m] ->>>>> /build/octave-statistics-1.4.2/inst/hygestat.m +[inst/copulapdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/copulapdf.m ***** test - t = 4:9; - m = 0:5; - n = 1:6; - [mn, v] = hygestat (t, m, n); - expected_mn = [0.0000, 0.4000, 1.0000, 1.7143, 2.5000, 3.3333]; - expected_v = [0.0000, 0.2400, 0.4000, 0.4898, 0.5357, 0.5556]; - assert (mn, expected_mn, 0.001); - assert (v, expected_v, 0.001); + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + theta = [1; 2]; + p = copulapdf ("Clayton", x, theta); + expected_p = [0.9872; 0.7295]; + assert (p, expected_p, 0.001); ***** test - t = 4:9; - m = 0:5; - [mn, v] = hygestat (t, m, 2); - expected_mn = [0.0000, 0.4000, 0.6667, 0.8571, 1.0000, 1.1111]; - expected_v = [0.0000, 0.2400, 0.3556, 0.4082, 0.4286, 0.4321]; - assert (mn, expected_mn, 0.001); - assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + p = copulapdf ("Gumbel", x, 2); + expected_p = [0.9468; 0.9468]; + assert (p, expected_p, 0.001); +***** test + x = [0.2, 0.6; 0.2, 0.6]; + theta = [1; 2]; + p = copulapdf ("Frank", x, theta); + expected_p = [0.9378; 0.8678]; + assert (p, expected_p, 0.001); +***** test + x = [0.2, 0.6; 0.2, 0.6]; + theta = [0.3; 0.7]; + p = copulapdf ("AMH", x, theta); + expected_p = [0.9540; 0.8577]; + assert (p, expected_p, 0.001); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/trirnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/trirnd.m +***** assert (size (trirnd (1,2,1.5)), [1, 1]) +***** assert (size (trirnd (1*ones (2,1), 2,1.5)), [2, 1]) +***** assert (size (trirnd (1*ones (2,2), 2,1.5)), [2, 2]) +***** assert (size (trirnd (1, 2*ones (2,1), 1.5)), [2, 1]) +***** assert (size (trirnd (1, 2*ones (2,2), 1.5)), [2, 2]) +***** assert (size (trirnd (1, 2, 1.5*ones (2,1))), [2, 1]) +***** assert (size (trirnd (1, 2, 1.5*ones (2,2))), [2, 2]) +***** assert (size (trirnd (1, 2, 1.5, 3)), [3, 3]) +***** assert (size (trirnd (1, 2, 1.5, [4 1])), [4, 1]) +***** assert (size (trirnd (1, 2, 1.5, 4, 1)), [4, 1]) +***** assert (class (trirnd (1,2,1.5)), "double") +***** assert (class (trirnd (single (1),2,1.5)), "single") +***** assert (class (trirnd (single ([1 1]),2,1.5)), "single") +***** assert (class (trirnd (1,single (2),1.5)), "single") +***** assert (class (trirnd (1,single ([2 2]),1.5)), "single") +***** assert (class (trirnd (1,2,single (1.5))), "single") +***** assert (class (trirnd (1,2,single ([1.5 1.5]))), "single") +***** error trirnd () +***** error trirnd (1) +***** error trirnd (1,2) +***** error trirnd (ones (3), 2*ones (2), 1.5*ones (2), 2) +***** error trirnd (ones (2), 2*ones (3), 1.5*ones (2), 2) +***** error trirnd (ones (2), 2*ones (2), 1.5*ones (3), 2) +***** error trirnd (i, 2, 1.5) +***** error trirnd (1, i, 1.5) +***** error trirnd (1, 2, i) +***** error trirnd (1,2,1.5, -1) +***** error trirnd (1,2,1.5, ones (2)) +***** error trirnd (1,2,1.5, [2 -1 2]) +***** error trirnd (1*ones (2),2,1.5, 3) +***** error trirnd (1*ones (2),2,1.5, [3, 2]) +***** error trirnd (1*ones (2),2,1.5, 3, 2) +32 tests, 32 passed, 0 known failure, 0 skipped +[inst/kmeans.m] +>>>>> /build/octave-statistics-1.4.2/inst/kmeans.m +***** error kmeans (rand (3,2), 4); +***** test + samples = 4; + dims = 3; + k = 2; + [cls, c, d, z] = kmeans (rand (samples,dims), k, "start", rand (k,dims, 5), + "emptyAction", "singleton"); + assert (size (cls), [samples, 1]); + assert (size (c), [k, dims]); + assert (size (d), [k, 1]); + assert (size (z), [samples, k]); +***** test + samples = 4; + dims = 3; + k = 2; + [cls, c, d, z] = kmeans (rand (samples,dims), [], "start", rand (k,dims, 5), + "emptyAction", "singleton"); + assert (size (cls), [samples, 1]); + assert (size (c), [k, dims]); + assert (size (d), [k, 1]); + assert (size (z), [samples, k]); +***** test + kmeans (rand (4,3), 2, "start", rand (2,3, 5), "replicates", 5, + "emptyAction", "singleton"); +***** error kmeans (rand (4,3), 2, "start", rand (2,3, 5), "replicates", 1); +***** error kmeans (rand (4,3), 2, "start", rand (2,2)); +***** test + kmeans (rand (3,4), 2, "start", "sample", "emptyAction", "singleton"); +***** test + kmeans (rand (3,4), 2, "start", "plus", "emptyAction", "singleton"); +***** test + kmeans (rand (3,4), 2, "start", "cluster", "emptyAction", "singleton"); +***** test + kmeans (rand (3,4), 2, "start", "uniform", "emptyAction", "singleton"); +***** error kmeans (rand (3,4), 2, "start", "normal"); +***** error kmeans (rand (4,3), 2, "replicates", i); +***** error kmeans (rand (4,3), 2, "replicates", -1); +***** error kmeans (rand (4,3), 2, "replicates", []); +***** error kmeans (rand (4,3), 2, "replicates", [1 2]); +***** error kmeans (rand (4,3), 2, "replicates", "one"); +***** error kmeans (rand (4,3), 2, "MAXITER", i); +***** error kmeans (rand (4,3), 2, "MaxIter", -1); +***** error kmeans (rand (4,3), 2, "maxiter", []); +***** error kmeans (rand (4,3), 2, "maxiter", [1 2]); +***** error kmeans (rand (4,3), 2, "maxiter", "one"); +***** test + kmeans (rand (4,3), 2, "distance", "sqeuclidean", "emptyAction", "singleton"); +***** test + kmeans (rand (4,3), 2, "distance", "cityblock", "emptyAction", "singleton"); +***** test + kmeans (rand (4,3), 2, "distance", "cosine", "emptyAction", "singleton"); +***** test + kmeans (rand (4,3), 2, "distance", "correlation", "emptyAction", "singleton"); +***** test + kmeans (rand (4,3), 2, "distance", "hamming", "emptyAction", "singleton"); +***** error kmeans (rand (4,3), 2, "distance", "manhattan"); +***** error kmeans ([1 0; 1.1 0], 2, "start", eye(2), "emptyaction", "error"); +***** test + kmeans ([1 0; 1.1 0], 2, "start", eye(2), "emptyaction", "singleton"); +***** test + [cls, c] = kmeans ([1 0; 2 0], 2, "start", [8,0;0,8], "emptyaction", "drop"); + assert (cls, [1; 1]); + assert (c, [1.5, 0; NA, NA]); +***** error kmeans ([1 0; 1.1 0], 2, "start", eye(2), "emptyaction", "panic"); +***** demo + ## Generate a two-cluster problem + C1 = randn (100, 2) + 1; + C2 = randn (100, 2) - 1; + data = [C1; C2]; + + ## Perform clustering + [idx, centers] = kmeans (data, 2); + + ## Plot the result + figure; + plot (data (idx==1, 1), data (idx==1, 2), 'ro'); + hold on; + plot (data (idx==2, 1), data (idx==2, 2), 'bs'); + plot (centers (:, 1), centers (:, 2), 'kv', 'markersize', 10); + hold off; +31 tests, 31 passed, 0 known failure, 0 skipped [inst/gevlike.m] >>>>> /build/octave-statistics-1.4.2/inst/gevlike.m ***** test @@ -4727,206 +5800,451 @@ assert (D, expected_D, -0.001); assert (C, expected_C, -0.001); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/tripdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/tripdf.m -***** shared x,y,deps - x = [-1, 0, 0.1, 0.5, 0.9, 1, 2] + 1; - y = [0, 0, 0.4, 2, 0.4, 0, 0]; - deps = 2*eps; -***** assert (tripdf (x, ones (1,7), 2*ones (1,7), 1.5*ones (1,7)), y, deps) -***** assert (tripdf (x, 1*ones (1,7), 2, 1.5), y, deps) -***** assert (tripdf (x, 1, 2*ones (1,7), 1.5), y, deps) -***** assert (tripdf (x, 1, 2, 1.5*ones (1,7)), y, deps) -***** assert (tripdf (x, 1, 2, 1.5), y, deps) -***** assert (tripdf (x, [1, 1, NaN, 1, 1, 1, 1], 2, 1.5), [y(1:2), NaN, y(4:7)], deps) -***** assert (tripdf (x, 1, 2*[1, 1, NaN, 1, 1, 1, 1], 1.5), [y(1:2), NaN, y(4:7)], deps) -***** assert (tripdf (x, 1, 2, 1.5*[1, 1, NaN, 1, 1, 1, 1]), [y(1:2), NaN, y(4:7)], deps) -***** assert (tripdf ([x, NaN], 1, 2, 1.5), [y, NaN], deps) -***** assert (tripdf (single ([x, NaN]), 1, 2, 1.5), single ([y, NaN]), eps('single')) -***** assert (tripdf ([x, NaN], single (1), 2, 1.5), single ([y, NaN]), eps('single')) -***** assert (tripdf ([x, NaN], 1, single (2), 1.5), single ([y, NaN]), eps('single')) -***** assert (tripdf ([x, NaN], 1, 2, single (1.5)), single ([y, NaN]), eps('single')) -***** error tripdf () -***** error tripdf (1) -***** error tripdf (1,2) -***** error tripdf (1,2,3) -***** error tripdf (1,2,3,4,5) -***** error tripdf (1, ones (3), ones (2), ones (2)) -***** error tripdf (1, ones (2), ones (3), ones (2)) -***** error tripdf (1, ones (2), ones (2), ones (3)) -***** error tripdf (i, 2, 2, 2) -***** error tripdf (2, i, 2, 2) -***** error tripdf (2, 2, i, 2) -***** error tripdf (2, 2, 2, i) -25 tests, 25 passed, 0 known failure, 0 skipped -[inst/princomp.m] ->>>>> /build/octave-statistics-1.4.2/inst/princomp.m -***** shared COEFF,SCORE,latent,tsquare,m,x,R,V,lambda,i,S,F +[inst/nansum.m] +>>>>> /build/octave-statistics-1.4.2/inst/nansum.m +***** assert (nansum ([2 4 NaN 7]), 13) +***** assert (nansum ([2 4 NaN Inf]), Inf) +***** assert (nansum ([1 NaN 3; NaN 5 6; 7 8 NaN]), [8 13 9]) +***** assert (nansum ([1 NaN 3; NaN 5 6; 7 8 NaN], 2), [4; 11; 15]) +***** assert (nansum (single ([1 NaN 3; NaN 5 6; 7 8 NaN])), single ([8 13 9])) +***** assert (nansum (single ([1 NaN 3; NaN 5 6; 7 8 NaN]), "double"), [8 13 9]) +***** assert (nansum (uint8 ([2 4 1 7])), 14) +***** assert (nansum (uint8 ([2 4 1 7]), "native"), uint8 (14)) +***** assert (nansum (uint8 ([2 4 1 7])), 14) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/geostat.m] +>>>>> /build/octave-statistics-1.4.2/inst/geostat.m ***** test - x=[7 4 3 - 4 1 8 - 6 3 5 - 8 6 1 - 8 5 7 - 7 2 9 - 5 3 3 - 9 5 8 - 7 4 5 - 8 2 2]; - R = corrcoef (x); - [V, lambda] = eig (R); - [~, i] = sort(diag(lambda), "descend"); #arrange largest PC first - S = V(:, i) * diag(sqrt(diag(lambda)(i))); -***** assert(diag(S(:, 1:2)*S(:, 1:2)'), [0.8662; 0.8420; 0.9876], 1E-4); #contribution of first 2 PCs to each original variable - B = V(:, i) * diag( 1./ sqrt(diag(lambda)(i))); - F = zscore(x)*B; - [COEFF,SCORE,latent,tsquare] = princomp(zscore(x, 1)); -***** assert(tsquare,sumsq(F, 2),1E4*eps); + p = 1 ./ (1:6); + [m, v] = geostat (p); + assert (m, [0, 1, 2, 3, 4, 5], 0.001); + assert (v, [0, 2, 6, 12, 20, 30], 0.001); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/gpcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/gpcdf.m +***** shared x,y1,y2,y3 + x = [-Inf, -1, 0, 1/2, 1, Inf]; + y1 = [0, 0, 0, 0.3934693402873666, 0.6321205588285577, 1]; + y2 = [0, 0, 0, 1/3, 1/2, 1]; + 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, 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, 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, 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) +***** assert (gpcdf (single ([x, NaN]), 0, 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]), 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')) +***** error gpcdf () +***** error gpcdf (1) +***** error gpcdf (1,2) +***** 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 (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) +***** error gpcdf (2, 2, 2, i) +52 tests, 52 passed, 0 known failure, 0 skipped +[inst/pdist.m] +>>>>> /build/octave-statistics-1.4.2/inst/pdist.m +***** shared xy, t, eucl + xy = [0 1; 0 2; 7 6; 5 6]; + t = 1e-3; + eucl = @(v,m) sqrt(sumsq(repmat(v,rows(m),1)-m,2)); +***** assert(pdist(xy), [1.000 8.602 7.071 8.062 6.403 2.000],t); +***** assert(pdist(xy,eucl), [1.000 8.602 7.071 8.062 6.403 2.000],t); +***** assert(pdist(xy,"euclidean"), [1.000 8.602 7.071 8.062 6.403 2.000],t); +***** assert(pdist(xy,"seuclidean"), [0.380 2.735 2.363 2.486 2.070 0.561],t); +***** assert(pdist(xy,"mahalanobis"),[1.384 1.967 2.446 2.384 1.535 2.045],t); +***** assert(pdist(xy,"cityblock"), [1.000 12.00 10.00 11.00 9.000 2.000],t); +***** assert(pdist(xy,"minkowski"), [1.000 8.602 7.071 8.062 6.403 2.000],t); +***** assert(pdist(xy,"minkowski",3),[1.000 7.763 6.299 7.410 5.738 2.000],t); +***** assert(pdist(xy,"cosine"), [0.000 0.349 0.231 0.349 0.231 0.013],t); +***** assert(pdist(xy,"correlation"),[0.000 2.000 0.000 2.000 0.000 2.000],t); +***** assert(pdist(xy,"spearman"), [0.000 2.000 0.000 2.000 0.000 2.000],t); +***** assert(pdist(xy,"hamming"), [0.500 1.000 1.000 1.000 1.000 0.500],t); +***** assert(pdist(xy,"jaccard"), [1.000 1.000 1.000 1.000 1.000 0.500],t); +***** assert(pdist(xy,"chebychev"), [1.000 7.000 5.000 7.000 5.000 2.000],t); +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/poisstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/poisstat.m ***** test - x=[1,2,3;2,1,3]'; - [COEFF,SCORE,latent,tsquare] = princomp(x); - m=[sqrt(2),sqrt(2);sqrt(2),-sqrt(2);-2*sqrt(2),0]/2; - m(:,1) = m(:,1)*sign(COEFF(1,1)); - m(:,2) = m(:,2)*sign(COEFF(1,2)); -***** assert(COEFF,m(1:2,:),10*eps); -***** assert(SCORE,-m,10*eps); -***** assert(latent,[1.5;.5],10*eps); -***** assert(tsquare,[4;4;4]/3,10*eps); + lambda = 1 ./ (1:6); + [m, v] = poisstat (lambda); + assert (m, lambda); + assert (v, lambda); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/mvnpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/mvnpdf.m +***** demo + mu = [0, 0]; + sigma = [1, 0.1; 0.1, 0.5]; + [X, Y] = meshgrid (linspace (-3, 3, 25)); + XY = [X(:), Y(:)]; + Z = mvnpdf (XY, mu, sigma); + mesh (X, Y, reshape (Z, size (X))); + colormap jet ***** test - x=x'; - [COEFF,SCORE,latent,tsquare] = princomp(x); - m=[sqrt(2),sqrt(2),0;-sqrt(2),sqrt(2),0;0,0,2]/2; - m(:,1) = m(:,1)*sign(COEFF(1,1)); - m(:,2) = m(:,2)*sign(COEFF(1,2)); - m(:,3) = m(:,3)*sign(COEFF(3,3)); -***** assert(COEFF,m,10*eps); -***** assert(SCORE(:,1),-m(1:2,1),10*eps); -***** assert(SCORE(:,2:3),zeros(2),10*eps); -***** assert(latent,[1;0;0],10*eps); -***** assert(tsquare,[0.5;0.5],10*eps) + mu = [1,-1]; + sigma = [.9 .4; .4 .3]; + x = [ 0.5 -1.2; -0.5 -1.4; 0 -1.5]; + p = [ 0.41680003660313; 0.10278162359708; 0.27187267524566 ]; + q = mvnpdf (x, mu, sigma); + assert (p, q, 10*eps); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/raylpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/raylpdf.m ***** test - [COEFF,SCORE,latent,tsquare] = princomp(x, "econ"); -***** assert(COEFF,m(:, 1),10*eps); -***** assert(SCORE,-m(1:2,1),10*eps); -***** assert(latent,[1],10*eps); -***** assert(tsquare,[0.5;0.5],10*eps) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/unidstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/unidstat.m + x = 0:0.5:2.5; + sigma = 1:6; + y = raylpdf (x, sigma); + expected_y = [0.0000, 0.1212, 0.1051, 0.0874, 0.0738, 0.0637]; + assert (y, expected_y, 0.001); +***** test + x = 0:0.5:2.5; + y = raylpdf (x, 0.5); + expected_y = [0.0000, 1.2131, 0.5413, 0.0667, 0.0027, 0.0000]; + assert (y, expected_y, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/tstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/tstat.m +***** test + n = 3:8; + [m, v] = tstat (n); + expected_m = [0, 0, 0, 0, 0, 0]; + expected_v = [3.0000, 2.0000, 1.6667, 1.5000, 1.4000, 1.3333]; + assert (m, expected_m); + assert (v, expected_v, 0.001); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/bbsrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/bbsrnd.m +***** 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]) +***** 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") +***** error bbsrnd () +***** error bbsrnd (1) +***** error bbsrnd (1,2) +***** error bbsrnd (ones (3), ones (2), ones (2), 2) +***** error bbsrnd (ones (2), ones (3), ones (2), 2) +***** error bbsrnd (ones (2), ones (2), ones (3), 2) +***** error bbsrnd (i, 2, 3) +***** error bbsrnd (1, i, 3) +***** error bbsrnd (1, 2, i) +***** error bbsrnd (1,2,3, -1) +***** error bbsrnd (1,2,3, ones (2)) +***** error bbsrnd (1,2,3, [2 -1 2]) +***** error bbsrnd (2, 1, ones (2), 3) +***** error bbsrnd (2, 1, ones (2), [3, 2]) +***** error bbsrnd (2, 1, ones (2), 3, 2) +32 tests, 32 passed, 0 known failure, 0 skipped +[inst/nbinstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/nbinstat.m +***** test + n = 1:4; + p = 0.2:0.2:0.8; + [m, v] = nbinstat (n, p); + expected_m = [ 4.0000, 3.0000, 2.0000, 1.0000]; + expected_v = [20.0000, 7.5000, 3.3333, 1.2500]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +***** test + n = 1:4; + [m, v] = nbinstat (n, 0.5); + expected_m = [1, 2, 3, 4]; + expected_v = [2, 4, 6, 8]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/wishrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/wishrnd.m +***** 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]); +***** assert(size (wishrnd (eye(2), 2, [], 3)), [2, 2, 3]); +***** error wishrnd () +***** error wishrnd (1) +***** error wishrnd ([1; 1], 2) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/hmmestimate.m] +>>>>> /build/octave-statistics-1.4.2/inst/hmmestimate.m +***** test + sequence = [1, 2, 1, 1, 1, 2, 2, 1, 2, 3, 3, 3, 3, 2, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 3]; + states = [1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]; + [transprobest, outprobest] = hmmestimate (sequence, states); + expectedtransprob = [0.88889, 0.11111; 0.28571, 0.71429]; + expectedoutprob = [0.16667, 0.33333, 0.50000; 1.00000, 0.00000, 0.00000]; + assert (transprobest, expectedtransprob, 0.001); + assert (outprobest, expectedoutprob, 0.001); +***** test + sequence = {'A', 'B', 'A', 'A', 'A', 'B', 'B', 'A', 'B', 'C', 'C', 'C', 'C', 'B', 'C', 'A', 'A', 'A', 'A', 'C', 'C', 'B', 'C', 'A', 'C'}; + states = {'One', 'One', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'Two', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One'}; + symbols = {'A', 'B', 'C'}; + statenames = {'One', 'Two'}; + [transprobest, outprobest] = hmmestimate (sequence, states, 'symbols', symbols, 'statenames', statenames); + expectedtransprob = [0.88889, 0.11111; 0.28571, 0.71429]; + expectedoutprob = [0.16667, 0.33333, 0.50000; 1.00000, 0.00000, 0.00000]; + assert (transprobest, expectedtransprob, 0.001); + assert (outprobest, expectedoutprob, 0.001); +***** test + sequence = [1, 2, 1, 1, 1, 2, 2, 1, 2, 3, 3, 3, 3, 2, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 3]; + states = [1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]; + pseudotransitions = [8, 2; 4, 6]; + pseudoemissions = [2, 4, 4; 7, 2, 1]; + [transprobest, outprobest] = hmmestimate (sequence, states, 'pseudotransitions', pseudotransitions, 'pseudoemissions', pseudoemissions); + expectedtransprob = [0.85714, 0.14286; 0.35294, 0.64706]; + expectedoutprob = [0.178571, 0.357143, 0.464286; 0.823529, 0.117647, 0.058824]; + assert (transprobest, expectedtransprob, 0.001); + assert (outprobest, expectedoutprob, 0.001); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/binostat.m] +>>>>> /build/octave-statistics-1.4.2/inst/binostat.m ***** test n = 1:6; - [m, v] = unidstat (n); - expected_m = [1.0000, 1.5000, 2.0000, 2.5000, 3.0000, 3.5000]; - expected_v = [0.0000, 0.2500, 0.6667, 1.2500, 2.0000, 2.9167]; + p = 0:0.2:1; + [m, v] = binostat (n, p); + expected_m = [0.00, 0.40, 1.20, 2.40, 4.00, 6.00]; + expected_v = [0.00, 0.32, 0.72, 0.96, 0.80, 0.00]; assert (m, expected_m, 0.001); assert (v, expected_v, 0.001); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/normalise_distribution.m] ->>>>> /build/octave-statistics-1.4.2/inst/normalise_distribution.m ***** test - v = normalise_distribution ( [ 1 2 3 ], [], 1 ); - assert ( v, [ 0 0 0 ] ) + n = 1:6; + [m, v] = binostat (n, 0.5); + expected_m = [0.50, 1.00, 1.50, 2.00, 2.50, 3.00]; + expected_v = [0.25, 0.50, 0.75, 1.00, 1.25, 1.50]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); ***** test - v = normalise_distribution ( [ 1 2 3 ], [], 2 ); - assert ( v, norminv ( [ 1 3 5 ] / 6 ), 3 * eps ) + n = [-Inf -3 5 0.5 3 NaN 100, Inf]; + [m, v] = binostat (n, 0.5); + assert (isnan (m), [true true false true false true false false]) + assert (isnan (v), [true true false true false true false false]) + assert (m(end), Inf); + assert (v(end), Inf); +***** assert (nthargout (1:2, @binostat, 5, []), {[], []}) +***** assert (nthargout (1:2, @binostat, [], 5), {[], []}) +***** assert (nthargout (1:2, @binostat, "", 5), {[], []}) +***** assert (nthargout (1:2, @binostat, true, 5), {NaN, NaN}) +***** assert (nthargout (1:2, @binostat, 5, true), {5, 0}) +***** assert (size (binostat (randi (100, 10, 5, 4), rand (10, 5, 4))), [10 5 4]) +***** assert (size (binostat (randi (100, 10, 5, 4), 7)), [10 5 4]) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/copulacdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/copulacdf.m ***** test - v = normalise_distribution ( [ 1 2 3 ]', [], 2 ); - assert ( v, [ 0 0 0 ]' ) + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + theta = [1; 2]; + p = copulacdf ("Clayton", x, theta); + expected_p = [0.1395; 0.1767]; + assert (p, expected_p, 0.001); ***** test - v = normalise_distribution ( [ 1 2 3 ]' , [], 1 ); - assert ( v, norminv ( [ 1 3 5 ]' / 6 ), 3 * eps ) + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + p = copulacdf ("Gumbel", x, 2); + expected_p = [0.1464; 0.1464]; + assert (p, expected_p, 0.001); ***** test - v = normalise_distribution ( [ 1 1 2 2 3 3 ], [], 2 ); - assert ( v, norminv ( [ 3 3 7 7 11 11 ] / 12 ), 3 * eps ) + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + theta = [1; 2]; + p = copulacdf ("Frank", x, theta); + expected_p = [0.0699; 0.0930]; + assert (p, expected_p, 0.001); ***** test - v = normalise_distribution ( [ 1 1 2 2 3 3 ]', [], 1 ); - assert ( v, norminv ( [ 3 3 7 7 11 11 ]' / 12 ), 3 * eps ) + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + theta = [0.3; 0.7]; + p = copulacdf ("AMH", x, theta); + expected_p = [0.0629; 0.0959]; + assert (p, expected_p, 0.001); ***** test - A = randn ( 10 ); - N = normalise_distribution ( A, @normcdf ); - assert ( A, N, 1000 * eps ) -***** xtest - A = exprnd ( 1, 100 ); - N = normalise_distribution ( A, @ ( x ) ( expcdf ( x, 1 ) ) ); - assert ( mean ( vec ( N ) ), 0, 0.1 ) - assert ( std ( vec ( N ) ), 1, 0.1 ) -***** xtest - A = rand (1000,1); - N = normalise_distribution ( A, "unifcdf" ); - assert ( mean ( vec ( N ) ), 0, 0.1 ) - assert ( std ( vec ( N ) ), 1, 0.1 ) -***** xtest - A = [rand(1000,1), randn( 1000, 1)]; - N = normalise_distribution ( A, { "unifcdf", "normcdf" } ); - assert ( mean ( N ), [ 0, 0 ], 0.1 ) - assert ( std ( N ), [ 1, 1 ], 0.1 ) -***** xtest - A = [rand(1000,1), randn( 1000, 1), exprnd( 1, 1000, 1 )]'; - N = normalise_distribution ( A, { @unifcdf; @normcdf; @( x )( expcdf ( x, 1 ) ) }, 2 ); - assert ( mean ( N, 2 ), [ 0, 0, 0 ]', 0.1 ) - assert ( std ( N, [], 2 ), [ 1, 1, 1 ]', 0.1 ) -***** xtest - A = exprnd ( 1, 1000, 9 ); A ( 300 : 500, 4:6 ) = 17; - N = normalise_distribution ( A ); - assert ( mean ( N ), [ 0 0 0 0.38 0.38 0.38 0 0 0 ], 0.1 ); - assert ( var ( N ), [ 1 1 1 2.59 2.59 2.59 1 1 1 ], 0.1 ); + x = [0.2:0.2:0.6; 0.2:0.1:0.4]; + theta = [0.2, 0.1, 0.1, 0.05]; + p = copulacdf ("FGM", x, theta); + expected_p = [0.0558; 0.0293]; + assert (p, expected_p, 0.001); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/gevcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/gevcdf.m ***** test - fail ("normalise_distribution( zeros ( 3, 4 ), { @unifcdf; @normcdf; @( x )( expcdf ( x, 1 ) ) } )", ... - "Number of distributions does not match data size!"); -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/burrcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/burrcdf.m + x = 0:0.5:2.5; + sigma = 1:6; + k = 1; + mu = 0; + p = gevcdf (x, k, sigma, mu); + expected_p = [0.36788 0.44933 0.47237 0.48323 0.48954 0.49367]; + assert (p, expected_p, 0.001); +***** test + x = -0.5:0.5:2.5; + sigma = 0.5; + k = 1; + mu = 0; + p = gevcdf (x, k, sigma, mu); + expected_p = [0 0.36788 0.60653 0.71653 0.77880 0.81873 0.84648]; + assert (p, expected_p, 0.001); +***** test #check for continuity for k near 0 + x = 1; + sigma = 0.5; + k = -0.03:0.01:0.03; + mu = 0; + p = gevcdf (x, k, sigma, mu); + expected_p = [0.88062 0.87820 0.87580 0.87342 0.87107 0.86874 0.86643]; + assert (p, expected_p, 0.001); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/bbsinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/bbsinv.m +***** shared x,y,f + 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, 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]) +***** 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])) +***** error bbsinv () +***** error bbsinv (1) +***** error bbsinv (1,2,3) +***** error bbsinv (1,2,3,4,5) +***** error bbsinv (ones (3), ones (2), ones(2), ones(2)) +***** 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, 4, 3, 2) +***** error bbsinv (1, i, 3, 2) +***** error bbsinv (1, 4, i, 2) +***** error bbsinv (1, 4, 3, i) +25 tests, 25 passed, 0 known failure, 0 skipped +[inst/mvtpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/mvtpdf.m +***** assert (mvtpdf ([0 0], eye(2), 1), 0.1591549, 1E-7) #dmvt(x = c(0,0), sigma = diag(2), log = FALSE) +***** assert (mvtpdf ([1 0], [1 0.5; 0.5 1], 2), 0.06615947, 1E-7) #dmvt(x = c(1,0), sigma = matrix(c(1, 0.5, 0.5, 1), nrow=2, ncol=2), df = 2, log = FALSE) +***** assert (mvtpdf ([1 0.4 0; 1.2 0.5 0.5; 1.4 0.6 1], [1 0.5 0.3; 0.5 1 0.6; 0.3 0.6 1], [5 6 7]), [0.04713313 0.03722421 0.02069011]', 1E-7) #dmvt(x = c(1,0.4,0), sigma = matrix(c(1, 0.5, 0.3, 0.5, 1, 0.6, 0.3, 0.6, 1), nrow=3, ncol=3), df = 5, log = FALSE); dmvt(x = c(1.2,0.5,0.5), sigma = matrix(c(1, 0.5, 0.3, 0.5, 1, 0.6, 0.3, 0.6, 1), nrow=3, ncol=3), df = 6, log = FALSE); dmvt(x = c(1.4,0.6,1), sigma = matrix(c(1, 0.5, 0.3, 0.5, 1, 0.6, 0.3, 0.6, 1), nrow=3, ncol=3), df = 7, log = FALSE) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/expstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/expstat.m +***** test + l = 1:6; + [m, v] = expstat (l); + assert (m, [1, 2, 3, 4, 5, 6], 0.001); + assert (v, [1, 4, 9, 16, 25, 36], 0.001); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/burrpdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/burrpdf.m ***** shared x,y x = [-1, 0, 1, 2, Inf]; - y = [0, 0, 1/2, 2/3, 1]; -***** assert (burrcdf (x, ones(1,5), ones (1,5), ones (1,5)), y, eps) -***** assert (burrcdf (x, 1, 1, 1), y, eps) -***** assert (burrcdf (x, [1, 1, NaN, 1, 1], 1, 1), [y(1:2), NaN, y(4:5)], eps) -***** assert (burrcdf (x, 1, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)], eps) -***** assert (burrcdf (x, 1, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)], eps) -***** assert (burrcdf ([x, NaN], 1, 1, 1), [y, NaN], eps) -***** assert (burrcdf (single ([x, NaN]), 1, 1, 1), single ([y, NaN]), eps('single')) -***** assert (burrcdf ([x, NaN], single (1), 1, 1), single ([y, NaN]), eps('single')) -***** assert (burrcdf ([x, NaN], 1, single (1), 1), single ([y, NaN]), eps('single')) -***** assert (burrcdf ([x, NaN], 1, 1, single (1)), single ([y, NaN]), eps('single')) -***** error burrcdf () -***** error burrcdf (1) -***** error burrcdf (1,2) -***** error burrcdf (1,2,3) -***** error burrcdf (1,2,3,4,5) -***** error burrcdf (ones (3), ones (2), ones(2), ones(2)) -***** error burrcdf (ones (2), ones (3), ones(2), ones(2)) -***** error burrcdf (ones (2), ones (2), ones(3), ones(2)) -***** error burrcdf (ones (2), ones (2), ones(2), ones(3)) -***** error burrcdf (i, 2, 2, 2) -***** error burrcdf (2, i, 2, 2) -***** error burrcdf (2, 2, i, 2) -***** error burrcdf (2, 2, 2, i) + y = [0, 0, 1/4, 1/9, 0]; +***** assert (burrpdf (x, ones(1,5), ones (1,5), ones (1,5)), y) +***** assert (burrpdf (x, 1, 1, 1), y) +***** assert (burrpdf (x, [1, 1, NaN, 1, 1], 1, 1), [y(1:2), NaN, y(4:5)]) +***** assert (burrpdf (x, 1, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)]) +***** assert (burrpdf (x, 1, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)]) +***** assert (burrpdf ([x, NaN], 1, 1, 1), [y, NaN]) +***** assert (burrpdf (single ([x, NaN]), 1, 1, 1), single ([y, NaN])) +***** assert (burrpdf ([x, NaN], single (1), 1, 1), single ([y, NaN])) +***** assert (burrpdf ([x, NaN], 1, single (1), 1), single ([y, NaN])) +***** assert (burrpdf ([x, NaN], 1, 1, single (1)), single ([y, NaN])) +***** error burrpdf () +***** error burrpdf (1) +***** error burrpdf (1,2) +***** error burrpdf (1,2,3) +***** error burrpdf (1,2,3,4,5) +***** error burrpdf (ones (3), ones (2), ones(2), ones(2)) +***** error burrpdf (ones (2), ones (3), ones(2), ones(2)) +***** error burrpdf (ones (2), ones (2), ones(3), ones(2)) +***** error burrpdf (ones (2), ones (2), ones(2), ones(3)) +***** error burrpdf (i, 2, 2, 2) +***** error burrpdf (2, i, 2, 2) +***** error burrpdf (2, 2, i, 2) +***** error burrpdf (2, 2, 2, i) 23 tests, 23 passed, 0 known failure, 0 skipped -[inst/nakacdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/nakacdf.m +[inst/bbscdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/bbscdf.m ***** shared x,y x = [-1, 0, 1, 2, Inf]; - y = [0, 0, 0.63212055882855778, 0.98168436111126578, 1]; -***** assert (nakacdf (x, ones (1,5), ones (1,5)), y, eps) -***** assert (nakacdf (x, 1, 1), y, eps) -***** assert (nakacdf (x, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)]) -***** assert (nakacdf (x, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)]) -***** assert (nakacdf ([x, NaN], 1, 1), [y, NaN], eps) -***** assert (nakacdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps('single')) -***** assert (nakacdf ([x, NaN], single (1), 1), single ([y, NaN]), eps('single')) -***** assert (nakacdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps('single')) -***** error nakacdf () -***** error nakacdf (1) -***** error nakacdf (1,2) -***** error nakacdf (1,2,3,4) -***** error nakacdf (ones (3), ones (2), ones(2)) -***** error nakacdf (ones (2), ones (3), ones(2)) -***** error nakacdf (ones (2), ones (2), ones(3)) -***** error nakacdf (i, 2, 2) -***** error nakacdf (2, i, 2) -***** error nakacdf (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped + y = [0, 0, 1/2, 0.76024993890652337, 1]; +***** 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) +***** 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')) +***** error bbscdf () +***** error bbscdf (1) +***** error bbscdf (1,2,3) +***** error bbscdf (1,2,3,4,5) +***** error bbscdf (ones (3), ones (2), ones(2), ones(2)) +***** 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, 4, 3, 2) +***** error bbscdf (1, i, 3, 2) +***** error bbscdf (1, 4, i, 2) +***** error bbscdf (1, 4, 3, i) +25 tests, 25 passed, 0 known failure, 0 skipped [inst/regress.m] >>>>> /build/octave-statistics-1.4.2/inst/regress.m ***** test @@ -4970,69 +6288,88 @@ regress at line 134 column 7 __test__ at line 33 column 28 test at line 677 column 11 - /tmp/tmp.19uGFJGj62 at line 822 column 31 + /tmp/tmp.Y1onalYaSM at line 1230 column 31 1 test, 1 passed, 0 known failure, 0 skipped -[inst/crossval.m] ->>>>> /build/octave-statistics-1.4.2/inst/crossval.m +[inst/normalise_distribution.m] +>>>>> /build/octave-statistics-1.4.2/inst/normalise_distribution.m ***** test - load fisheriris.txt - y = fisheriris(:, 2); - X = [ones(size(y)) fisheriris(:, 3:5)]; - f = @(X1, y1, X2, y2) meansq (y2 - X2*regress(y1, X1)); - results0 = crossval (f, X, y); - results1 = crossval (f, X, y, 'KFold', 10); - folds = 5; - results2 = crossval (f, X, y, 'KFold', folds); - results3 = crossval (f, X, y, 'Partition', cvpartition (numel (y), 'KFold', folds)); - results4 = crossval (f, X, y, 'LeaveOut', 1); - mcreps = 2; n_holdout = 20; - results5 = crossval (f, X, y, 'HoldOut', n_holdout, 'mcreps', mcreps); - - ## ensure equal representation of iris species in the training set -- tends - ## to slightly reduce cross-validation mean square error - results6 = crossval (f, X, y, 'KFold', 5, 'stratify', fisheriris(:, 1)); - - assert (results0, results1); - assert (results2, results3); - assert (size(results4), [1 numel(y)]); - assert (mean(results4), 4.5304, 1E-4); - assert (size(results5), [mcreps 1]); -warning: load: '/build/octave-statistics-1.4.2/debian/octave-statistics/usr/share/octave/packages/statistics-1.4.2/fisheriris.txt' found by searching load path -warning: called from - __test__ at line 3 column 2 - test at line 677 column 11 - /tmp/tmp.19uGFJGj62 at line 830 column 31 - -warning: strmatch is obsolete; use strncmp or strcmp instead -1 test, 1 passed, 0 known failure, 0 skipped -[inst/gamstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/gamstat.m + v = normalise_distribution ( [ 1 2 3 ], [], 1 ); + assert ( v, [ 0 0 0 ] ) ***** test - a = 1:6; - b = 1:0.2:2; - [m, v] = gamstat (a, b); - expected_m = [1.00, 2.40, 4.20, 6.40, 9.00, 12.00]; - expected_v = [1.00, 2.88, 5.88, 10.24, 16.20, 24.00]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); + v = normalise_distribution ( [ 1 2 3 ], [], 2 ); + assert ( v, norminv ( [ 1 3 5 ] / 6 ), 3 * eps ) ***** test - a = 1:6; - [m, v] = gamstat (a, 1.5); - expected_m = [1.50, 3.00, 4.50, 6.00, 7.50, 9.00]; - expected_v = [2.25, 4.50, 6.75, 9.00, 11.25, 13.50]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/gevfit.m] ->>>>> /build/octave-statistics-1.4.2/inst/gevfit.m + v = normalise_distribution ( [ 1 2 3 ]', [], 2 ); + assert ( v, [ 0 0 0 ]' ) ***** test - data = 1:50; - [pfit, pci] = gevfit (data); - expected_p = [-0.44 15.19 21.53]'; - expected_pu = [-0.13 19.31 26.49]'; - assert (pfit, expected_p, 0.1); - assert (pci(:, 2), expected_pu, 0.1); + v = normalise_distribution ( [ 1 2 3 ]' , [], 1 ); + assert ( v, norminv ( [ 1 3 5 ]' / 6 ), 3 * eps ) +***** test + v = normalise_distribution ( [ 1 1 2 2 3 3 ], [], 2 ); + assert ( v, norminv ( [ 3 3 7 7 11 11 ] / 12 ), 3 * eps ) +***** test + v = normalise_distribution ( [ 1 1 2 2 3 3 ]', [], 1 ); + assert ( v, norminv ( [ 3 3 7 7 11 11 ]' / 12 ), 3 * eps ) +***** test + A = randn ( 10 ); + N = normalise_distribution ( A, @normcdf ); + assert ( A, N, 1000 * eps ) +***** xtest + A = exprnd ( 1, 100 ); + N = normalise_distribution ( A, @ ( x ) ( expcdf ( x, 1 ) ) ); + assert ( mean ( vec ( N ) ), 0, 0.1 ) + assert ( std ( vec ( N ) ), 1, 0.1 ) +***** xtest + A = rand (1000,1); + N = normalise_distribution ( A, "unifcdf" ); + assert ( mean ( vec ( N ) ), 0, 0.1 ) + assert ( std ( vec ( N ) ), 1, 0.1 ) +***** xtest + A = [rand(1000,1), randn( 1000, 1)]; + N = normalise_distribution ( A, { "unifcdf", "normcdf" } ); + assert ( mean ( N ), [ 0, 0 ], 0.1 ) + assert ( std ( N ), [ 1, 1 ], 0.1 ) +***** xtest + A = [rand(1000,1), randn( 1000, 1), exprnd( 1, 1000, 1 )]'; + N = normalise_distribution ( A, { @unifcdf; @normcdf; @( x )( expcdf ( x, 1 ) ) }, 2 ); + assert ( mean ( N, 2 ), [ 0, 0, 0 ]', 0.1 ) + assert ( std ( N, [], 2 ), [ 1, 1, 1 ]', 0.1 ) +***** xtest + A = exprnd ( 1, 1000, 9 ); A ( 300 : 500, 4:6 ) = 17; + N = normalise_distribution ( A ); + assert ( mean ( N ), [ 0 0 0 0.38 0.38 0.38 0 0 0 ], 0.1 ); + assert ( var ( N ), [ 1 1 1 2.59 2.59 2.59 1 1 1 ], 0.1 ); +***** test + fail ("normalise_distribution( zeros ( 3, 4 ), { @unifcdf; @normcdf; @( x )( expcdf ( x, 1 ) ) } )", ... + "Number of distributions does not match data size!"); +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/chi2stat.m] +>>>>> /build/octave-statistics-1.4.2/inst/chi2stat.m +***** test + n = 1:6; + [m, v] = chi2stat (n); + assert (m, n); + assert (v, [2, 4, 6, 8, 10, 12], 0.001); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/pdist2.m] +>>>>> /build/octave-statistics-1.4.2/inst/pdist2.m +***** function dist = euclidean_distance (x, y) + [m, p] = size (X); + [n, p] = size (Y); + D = zeros (m, n); + for i = 1:n + d = X - repmat (Y(i,:), [m 1]); + D(:,i) = sumsq (d, 2); + endfor +***** endfunction +***** test + x = [1 1 1; 2 2 2; 3 3 3]; + y = [0 0 0; 1 2 3; 0 2 4; 4 7 1]; + d = sqrt([ 3 5 11 45 + 12 2 8 30 + 27 5 11 21]); + assert (pdist2 (x, y), d) 1 test, 1 passed, 0 known failure, 0 skipped [inst/combnk.m] >>>>> /build/octave-statistics-1.4.2/inst/combnk.m @@ -5053,124 +6390,101 @@ c = combnk ("hello", 2); assert (c, ["lo"; "lo"; "ll"; "eo"; "el"; "el"; "ho"; "hl"; "hl"; "he"]); 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/mahal.m] ->>>>> /build/octave-statistics-1.4.2/inst/mahal.m -***** error mahal () -***** error mahal (1, 2, 3) -***** error mahal ("A", "B") -***** error mahal ([1, 2], ["A", "B"]) -***** error mahal (ones (2, 2, 2)) -***** error mahal (ones (2, 2), ones (2, 2, 2)) -***** error mahal (ones (2, 2), ones (2, 3)) -***** test - X = [1 0; 0 1; 1 1; 0 0]; - assert (mahal (X, X), [1.5; 1.5; 1.5; 1.5], 10*eps) - assert (mahal (X, X+1), [7.5; 7.5; 1.5; 13.5], 10*eps) -***** assert (mahal ([true; true], [false; true]), [0.5; 0.5], eps) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/gevcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/gevcdf.m +[inst/hmmgenerate.m] +>>>>> /build/octave-statistics-1.4.2/inst/hmmgenerate.m ***** test - x = 0:0.5:2.5; - sigma = 1:6; - k = 1; - mu = 0; - p = gevcdf (x, k, sigma, mu); - expected_p = [0.36788 0.44933 0.47237 0.48323 0.48954 0.49367]; - assert (p, expected_p, 0.001); + len = 25; + transprob = [0.8, 0.2; 0.4, 0.6]; + outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; + [sequence, states] = hmmgenerate (len, transprob, outprob); + assert (length (sequence), len); + assert (length (states), len); + assert (min (sequence) >= 1); + assert (max (sequence) <= columns (outprob)); + assert (min (states) >= 1); + assert (max (states) <= rows (transprob)); ***** test - x = -0.5:0.5:2.5; - sigma = 0.5; - k = 1; - mu = 0; - p = gevcdf (x, k, sigma, mu); - expected_p = [0 0.36788 0.60653 0.71653 0.77880 0.81873 0.84648]; - assert (p, expected_p, 0.001); -***** test #check for continuity for k near 0 - x = 1; - sigma = 0.5; - k = -0.03:0.01:0.03; - mu = 0; - p = gevcdf (x, k, sigma, mu); - expected_p = [0.88062 0.87820 0.87580 0.87342 0.87107 0.86874 0.86643]; - assert (p, expected_p, 0.001); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mvtpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/mvtpdf.m -***** assert (mvtpdf ([0 0], eye(2), 1), 0.1591549, 1E-7) #dmvt(x = c(0,0), sigma = diag(2), log = FALSE) -***** assert (mvtpdf ([1 0], [1 0.5; 0.5 1], 2), 0.06615947, 1E-7) #dmvt(x = c(1,0), sigma = matrix(c(1, 0.5, 0.5, 1), nrow=2, ncol=2), df = 2, log = FALSE) -***** assert (mvtpdf ([1 0.4 0; 1.2 0.5 0.5; 1.4 0.6 1], [1 0.5 0.3; 0.5 1 0.6; 0.3 0.6 1], [5 6 7]), [0.04713313 0.03722421 0.02069011]', 1E-7) #dmvt(x = c(1,0.4,0), sigma = matrix(c(1, 0.5, 0.3, 0.5, 1, 0.6, 0.3, 0.6, 1), nrow=3, ncol=3), df = 5, log = FALSE); dmvt(x = c(1.2,0.5,0.5), sigma = matrix(c(1, 0.5, 0.3, 0.5, 1, 0.6, 0.3, 0.6, 1), nrow=3, ncol=3), df = 6, log = FALSE); dmvt(x = c(1.4,0.6,1), sigma = matrix(c(1, 0.5, 0.3, 0.5, 1, 0.6, 0.3, 0.6, 1), nrow=3, ncol=3), df = 7, log = FALSE) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/bbspdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/bbspdf.m -***** shared x,y - x = [-1, 0, 1, 2, Inf]; - y = [0, 0, 0.3989422804014327, 0.1647717335503959, 0]; -***** 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) -***** 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')) -***** error bbspdf () -***** error bbspdf (1) -***** error bbspdf (1,2,3) -***** error bbspdf (1,2,3,4,5) -***** error bbspdf (ones (3), ones (2), ones(2), ones(2)) -***** 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, 4, 3, 2) -***** error bbspdf (1, i, 3, 2) -***** error bbspdf (1, 4, i, 2) -***** error bbspdf (1, 4, 3, i) + len = 25; + transprob = [0.8, 0.2; 0.4, 0.6]; + outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; + symbols = {'A', 'B', 'C'}; + statenames = {'One', 'Two'}; + [sequence, states] = hmmgenerate (len, transprob, outprob, 'symbols', symbols, 'statenames', statenames); + assert (length (sequence), len); + assert (length (states), len); + assert (strcmp (sequence, 'A') + strcmp (sequence, 'B') + strcmp (sequence, 'C') == ones (1, len)); + assert (strcmp (states, 'One') + strcmp (states, 'Two') == ones (1, len)); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/tripdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/tripdf.m +***** shared x,y,deps + x = [-1, 0, 0.1, 0.5, 0.9, 1, 2] + 1; + y = [0, 0, 0.4, 2, 0.4, 0, 0]; + deps = 2*eps; +***** assert (tripdf (x, ones (1,7), 2*ones (1,7), 1.5*ones (1,7)), y, deps) +***** assert (tripdf (x, 1*ones (1,7), 2, 1.5), y, deps) +***** assert (tripdf (x, 1, 2*ones (1,7), 1.5), y, deps) +***** assert (tripdf (x, 1, 2, 1.5*ones (1,7)), y, deps) +***** assert (tripdf (x, 1, 2, 1.5), y, deps) +***** assert (tripdf (x, [1, 1, NaN, 1, 1, 1, 1], 2, 1.5), [y(1:2), NaN, y(4:7)], deps) +***** assert (tripdf (x, 1, 2*[1, 1, NaN, 1, 1, 1, 1], 1.5), [y(1:2), NaN, y(4:7)], deps) +***** assert (tripdf (x, 1, 2, 1.5*[1, 1, NaN, 1, 1, 1, 1]), [y(1:2), NaN, y(4:7)], deps) +***** assert (tripdf ([x, NaN], 1, 2, 1.5), [y, NaN], deps) +***** assert (tripdf (single ([x, NaN]), 1, 2, 1.5), single ([y, NaN]), eps('single')) +***** assert (tripdf ([x, NaN], single (1), 2, 1.5), single ([y, NaN]), eps('single')) +***** assert (tripdf ([x, NaN], 1, single (2), 1.5), single ([y, NaN]), eps('single')) +***** assert (tripdf ([x, NaN], 1, 2, single (1.5)), single ([y, NaN]), eps('single')) +***** error tripdf () +***** error tripdf (1) +***** error tripdf (1,2) +***** error tripdf (1,2,3) +***** error tripdf (1,2,3,4,5) +***** error tripdf (1, ones (3), ones (2), ones (2)) +***** error tripdf (1, ones (2), ones (3), ones (2)) +***** error tripdf (1, ones (2), ones (2), ones (3)) +***** error tripdf (i, 2, 2, 2) +***** error tripdf (2, i, 2, 2) +***** error tripdf (2, 2, i, 2) +***** error tripdf (2, 2, 2, i) 25 tests, 25 passed, 0 known failure, 0 skipped -[inst/pdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/pdf.m +[inst/randsample.m] +>>>>> /build/octave-statistics-1.4.2/inst/randsample.m ***** test - assert(pdf ('norm', 1, 0, 1), normpdf (1, 0, 1)) + n = 20; + k = 5; + x = randsample(n, k); + assert (size(x), [1 k]); + x = randsample(n, k, true); + assert (size(x), [1 k]); + x = randsample(n, k, false); + assert (size(x), [1 k]); + x = randsample(n, k, true, ones(n, 1)); + assert (size(x), [1 k]); + x = randsample(1:n, k); + assert (size(x), [1 k]); + x = randsample(1:n, k, true); + assert (size(x), [1 k]); + x = randsample(1:n, k, false); + assert (size(x), [1 k]); + x = randsample(1:n, k, true, ones(n, 1)); + assert (size(x), [1 k]); + x = randsample((1:n)', k); + assert (size(x), [k 1]); + x = randsample((1:n)', k, true); + assert (size(x), [k 1]); + x = randsample((1:n)', k, false); + assert (size(x), [k 1]); + x = randsample((1:n)', k, true, ones(n, 1)); + assert (size(x), [k 1]); + n = 10; + k = 100; + x = randsample(n, k, true, 1:n); + assert (size(x), [1 k]); + x = randsample((1:n)', k, true); + assert (size(x), [k 1]); + x = randsample(k, k, false, 1:k); + assert (size(x), [1 k]); 1 test, 1 passed, 0 known failure, 0 skipped -[inst/squareform.m] ->>>>> /build/octave-statistics-1.4.2/inst/squareform.m -***** shared v, m - v = 1:6; - m = [0 1 2 3;1 0 4 5;2 4 0 6;3 5 6 0]; -***** assert (squareform (v), m) -***** assert (squareform (squareform (v)), v) -***** assert (squareform (m), v) -***** assert (squareform (v'), m) -***** assert (squareform (1), [0 1;1 0]) -***** assert (squareform (1, "tomatrix"), [0 1; 1 0]) -***** assert (squareform (0, "tovector"), zeros (1, 0)) -***** warning squareform ([0 1 2; 3 0 4; 5 6 0]); -***** test - for c = {@single, @double, @uint8, @uint32, @uint64} - f = c{1}; - assert (squareform (f (v)), f (m)) - assert (squareform (f (m)), f (v)) - endfor -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/raylpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/raylpdf.m -***** test - x = 0:0.5:2.5; - sigma = 1:6; - y = raylpdf (x, sigma); - expected_y = [0.0000, 0.1212, 0.1051, 0.0874, 0.0738, 0.0637]; - assert (y, expected_y, 0.001); -***** test - x = 0:0.5:2.5; - y = raylpdf (x, 0.5); - expected_y = [0.0000, 1.2131, 0.5413, 0.0667, 0.0027, 0.0000]; - assert (y, expected_y, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped [inst/linkage.m] >>>>> /build/octave-statistics-1.4.2/inst/linkage.m ***** shared x, t @@ -5190,7 +6504,7 @@ linkage at line 169 column 5 __test__ at line 3 column 2 test at line 677 column 11 - /tmp/tmp.19uGFJGj62 at line 918 column 31 + /tmp/tmp.Y1onalYaSM at line 1294 column 31 ***** warning linkage (pdist (x), "median"); ***** test warning off clustering @@ -5201,296 +6515,175 @@ linkage at line 169 column 5 __test__ at line 3 column 2 test at line 677 column 11 - /tmp/tmp.19uGFJGj62 at line 918 column 31 + /tmp/tmp.Y1onalYaSM at line 1294 column 31 ***** assert (cond (linkage (pdist (x), "ward")), 17.195198,t); ***** assert (cond (linkage(x,"ward","euclidean")), 17.195198,t); ***** assert (cond (linkage(x,"ward",{"euclidean"})), 17.195198,t); ***** assert (cond (linkage(x,"ward",{"minkowski",2})),17.195198,t); 12 tests, 12 passed, 0 known failure, 0 skipped -[inst/nansum.m] ->>>>> /build/octave-statistics-1.4.2/inst/nansum.m -***** assert (nansum ([2 4 NaN 7]), 13) -***** assert (nansum ([2 4 NaN Inf]), Inf) -***** assert (nansum ([1 NaN 3; NaN 5 6; 7 8 NaN]), [8 13 9]) -***** assert (nansum ([1 NaN 3; NaN 5 6; 7 8 NaN], 2), [4; 11; 15]) -***** assert (nansum (single ([1 NaN 3; NaN 5 6; 7 8 NaN])), single ([8 13 9])) -***** assert (nansum (single ([1 NaN 3; NaN 5 6; 7 8 NaN]), "double"), [8 13 9]) -***** assert (nansum (uint8 ([2 4 1 7])), 14) -***** assert (nansum (uint8 ([2 4 1 7]), "native"), uint8 (14)) -***** assert (nansum (uint8 ([2 4 1 7])), 14) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/hist3.m] ->>>>> /build/octave-statistics-1.4.2/inst/hist3.m -***** demo - X = [ - 1 1 - 1 1 - 1 10 - 1 10 - 5 5 - 5 5 - 5 5 - 5 5 - 5 5 - 7 3 - 7 3 - 7 3 - 10 10 - 10 10]; - hist3 (X) +[inst/crossval.m] +>>>>> /build/octave-statistics-1.4.2/inst/crossval.m ***** test - N_exp = [ 0 0 0 5 20 - 0 0 10 15 0 - 0 15 10 0 0 - 20 5 0 0 0]; + load fisheriris.txt + y = fisheriris(:, 2); + X = [ones(size(y)) fisheriris(:, 3:5)]; + f = @(X1, y1, X2, y2) meansq (y2 - X2*regress(y1, X1)); + results0 = crossval (f, X, y); + results1 = crossval (f, X, y, 'KFold', 10); + folds = 5; + results2 = crossval (f, X, y, 'KFold', folds); + results3 = crossval (f, X, y, 'Partition', cvpartition (numel (y), 'KFold', folds)); + results4 = crossval (f, X, y, 'LeaveOut', 1); + mcreps = 2; n_holdout = 20; + results5 = crossval (f, X, y, 'HoldOut', n_holdout, 'mcreps', mcreps); - n = 100; - x = [1:n]'; - y = [n:-1:1]'; - D = [x y]; - N = hist3 (D, [4 5]); - assert (N, N_exp); -***** test - N_exp = [0 0 0 0 1 - 0 0 0 0 1 - 0 0 0 0 1 - 1 1 1 1 93]; + ## ensure equal representation of iris species in the training set -- tends + ## to slightly reduce cross-validation mean square error + results6 = crossval (f, X, y, 'KFold', 5, 'stratify', fisheriris(:, 1)); - n = 100; - x = [1:n]'; - y = [n:-1:1]'; - D = [x y]; - C{1} = [1 1.7 3 4]; - C{2} = [1:5]; - N = hist3 (D, C); - assert (N, N_exp); -***** test - D = [1 1; 3 1; 3 3; 3 1]; - [c, nn] = hist3 (D, {0:4, 0:4}); - exp_c = zeros (5); - exp_c([7 9 19]) = [1 2 1]; - assert (c, exp_c); - assert (nn, {0:4, 0:4}); -***** test - for i = 10 - assert (size (hist3 (rand (9, 2), "Edges", {[0:.2:1]; [0:.2:1]})), [6 6]) - endfor -***** test - edge_1 = linspace (0, 10, 10); - edge_2 = linspace (0, 50, 10); - [c, nn] = hist3 ([1:10; 1:5:50]', "Edges", {edge_1, edge_2}); - exp_c = zeros (10, 10); - exp_c([1 12 13 24 35 46 57 68 79 90]) = 1; - assert (c, exp_c); + assert (results0, results1); + assert (results2, results3); + assert (size(results4), [1 numel(y)]); + assert (mean(results4), 4.5304, 1E-4); + assert (size(results5), [mcreps 1]); +warning: load: '/build/octave-statistics-1.4.2/debian/octave-statistics/usr/share/octave/packages/statistics-1.4.2/fisheriris.txt' found by searching load path +warning: called from + __test__ at line 3 column 2 + test at line 677 column 11 + /tmp/tmp.Y1onalYaSM at line 1302 column 31 - assert (nn{1}, edge_1 + edge_1(2)/2, eps*10^4) - assert (nn{2}, edge_2 + edge_2(2)/2, eps*10^4) -***** shared X - X = [ - 5 2 - 5 3 - 1 4 - 5 3 - 4 4 - 1 2 - 2 3 - 3 3 - 5 4 - 5 3]; -***** test - N = zeros (10); - N([1 10 53 56 60 91 98 100]) = [1 1 1 1 3 1 1 1]; - C = {(1.2:0.4:4.8), (2.1:0.2:3.9)}; - assert (nthargout ([1 2], @hist3, X), {N C}, eps*10^3) -***** test - N = zeros (5, 7); - N([1 5 17 18 20 31 34 35]) = [1 1 1 1 3 1 1 1]; - C = {(1.4:0.8:4.6), ((2+(1/7)):(2/7):(4-(1/7)))}; - assert (nthargout ([1 2], @hist3, X, [5 7]), {N C}, eps*10^3) - assert (nthargout ([1 2], @hist3, X, "Nbins", [5 7]), {N C}, eps*10^3) -***** test - N = [0 1 0; 0 1 0; 0 0 1; 0 0 0]; - C = {(2:5), (2.5:1:4.5)}; - assert (nthargout ([1 2], @hist3, X, "Edges", {(1.5:4.5), (2:4)}), {N C}) -***** test - N = [0 0 1 0 1 0; 0 0 0 1 0 0; 0 0 1 4 2 0]; - C = {(1.2:3.2), (0:5)}; - assert (nthargout ([1 2], @hist3, X, "Ctrs", C), {N C}) - assert (nthargout ([1 2], @hist3, X, C), {N C}) +warning: strmatch is obsolete; use strncmp or strcmp instead +1 test, 1 passed, 0 known failure, 0 skipped +[inst/stepwisefit.m] +>>>>> /build/octave-statistics-1.4.2/inst/stepwisefit.m ***** test - [~, C] = hist3 (rand (10, 2), "Edges", {[0 .05 .15 .35 .55 .95], - [-1 .05 .07 .2 .3 .5 .89 1.2]}); - C_exp = {[ 0.025 0.1 0.25 0.45 0.75 1.15], ... - [-0.475 0.06 0.135 0.25 0.4 0.695 1.045 1.355]}; - assert (C, C_exp, eps*10^2) + % Sample data from Draper and Smith (n = 13, k = 4) + X = [7 1 11 11 7 11 3 1 2 21 1 11 10; ... + 26 29 56 31 52 55 71 31 54 47 40 66 68; ... + 6 15 8 8 6 9 17 22 18 4 23 9 8; ... + 60 52 20 47 33 22 6 44 22 26 34 12 12]'; + y = [78.5 74.3 104.3 87.6 95.9 109.2 102.7 72.5 93.1 115.9 83.8 113.3 109.4]'; + [X_use, b, bint, r, rint, stats] = stepwisefit(y, X); + assert(X_use, [4 1]) + assert(b, regress(y, [ones(size(y)) X(:, X_use)], 0.05)) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/gprnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/gprnd.m +***** assert (size (gprnd (0,1,0)), [1, 1]) +***** 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 (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]) +***** assert (class (gprnd (0,1,0)), "double") +***** 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 (single (0), 1, 0)), "single") +***** assert (class (gprnd (single ([0 0]), 1, 0)), "single") +***** error gprnd () +***** error gprnd (1) +***** error gprnd (1,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 (0,1, zeros (2), 3) +***** error gprnd (0,1, zeros (2), [3, 2]) +***** error gprnd (0,1, zeros (2), 3, 2) +52 tests, 52 passed, 0 known failure, 0 skipped +[inst/raylinv.m] +>>>>> /build/octave-statistics-1.4.2/inst/raylinv.m ***** test - Xv = repmat ([1:10]', [1 2]); - - ## Test Centers - assert (hist3 (Xv, "Ctrs", {1:10, 1:10}), eye (10)) - - N_exp = eye (6); - N_exp([1 end]) = 3; - assert (hist3 (Xv, "Ctrs", {3:8, 3:8}), N_exp) - - N_exp = zeros (8, 6); - N_exp([1 2 11 20 29 38 47 48]) = [2 1 1 1 1 1 1 2]; - assert (hist3 (Xv, "Ctrs", {2:9, 3:8}), N_exp) - - ## Test Edges - assert (hist3 (Xv, "Edges", {1:10, 1:10}), eye (10)) - assert (hist3 (Xv, "Edges", {3:8, 3:8}), eye (6)) - assert (hist3 (Xv, "Edges", {2:9, 3:8}), [zeros(1, 6); eye(6); zeros(1, 6)]) - - N_exp = zeros (14); - N_exp(3:12, 3:12) = eye (10); - assert (hist3 (Xv, "Edges", {-1:12, -1:12}), N_exp) - - ## Test for Nbins - assert (hist3 (Xv), eye (10)) - assert (hist3 (Xv, [10 10]), eye (10)) - assert (hist3 (Xv, "nbins", [10 10]), eye (10)) - assert (hist3 (Xv, [5 5]), eye (5) * 2) - - N_exp = zeros (7, 5); - N_exp([1 9 10 18 26 27 35]) = [2 1 1 2 1 1 2]; - assert (hist3 (Xv, [7 5]), N_exp) -***** test # bug #51059 - D = [1 1; NaN 2; 3 1; 3 3; 1 NaN; 3 1]; - [c, nn] = hist3 (D, {0:4, 0:4}); - exp_c = zeros (5); - exp_c([7 9 19]) = [1 2 1]; - assert (c, exp_c) - assert (nn, {0:4, 0:4}) + p = 0:0.1:0.5; + sigma = 1:6; + x = raylinv (p, sigma); + expected_x = [0.0000, 0.9181, 2.0041, 3.3784, 5.0538, 7.0645]; + assert (x, expected_x, 0.001); ***** test - [c, nn] = hist3 ([1 8]); - exp_c = zeros (10, 10); - exp_c(6, 6) = 1; - exp_nn = {-4:5, 3:12}; - assert (c, exp_c) - assert (nn, exp_nn, eps) - - [c, nn] = hist3 ([1 8], [10 11]); - exp_c = zeros (10, 11); - exp_c(6, 6) = 1; - exp_nn = {-4:5, 3:13}; - assert (c, exp_c) - assert (nn, exp_nn, eps) + p = 0:0.1:0.5; + x = raylinv (p, 0.5); + expected_x = [0.0000, 0.2295, 0.3340, 0.4223, 0.5054, 0.5887]; + assert (x, expected_x, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/hygestat.m] +>>>>> /build/octave-statistics-1.4.2/inst/hygestat.m ***** test - [c, nn] = hist3 ([1 NaN; 2 3; 6 9; 8 NaN]); - exp_c = zeros (10, 10); - exp_c(2, 1) = 1; - exp_c(8, 10) = 1; - exp_nn = {linspace(1.35, 7.65, 10) linspace(3.3, 8.7, 10)}; - assert (c, exp_c) - assert (nn, exp_nn, eps*100) + t = 4:9; + m = 0:5; + n = 1:6; + [mn, v] = hygestat (t, m, n); + expected_mn = [0.0000, 0.4000, 1.0000, 1.7143, 2.5000, 3.3333]; + expected_v = [0.0000, 0.2400, 0.4000, 0.4898, 0.5357, 0.5556]; + assert (mn, expected_mn, 0.001); + assert (v, expected_v, 0.001); ***** test - [c, nn] = hist3 ([1 NaN; 2 NaN; 6 NaN; 8 NaN]); - exp_c = zeros (10, 10); - exp_nn = {linspace(1.35, 7.65, 10) NaN(1, 10)}; - assert (c, exp_c) - assert (nn, exp_nn, eps*100) + t = 4:9; + m = 0:5; + [mn, v] = hygestat (t, m, 2); + expected_mn = [0.0000, 0.4000, 0.6667, 0.8571, 1.0000, 1.1111]; + expected_v = [0.0000, 0.2400, 0.3556, 0.4082, 0.4286, 0.4321]; + assert (mn, expected_mn, 0.001); + assert (v, expected_v, 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/mnrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/mnrnd.m ***** test - [c, nn] = hist3 ([1 NaN; NaN 3; NaN 9; 8 NaN]); - exp_c = zeros (10, 10); - exp_nn = {linspace(1.35, 7.65, 10) linspace(3.3, 8.7, 10)}; - assert (c, exp_c) - assert (nn, exp_nn, eps*100) -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/burrinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/burrinv.m -***** shared x,y - x = [-Inf, -1, 0, 1/2, 1, 2, Inf]; - y = [NaN, NaN, 0, 1 , Inf, NaN, NaN]; -***** assert (burrinv (x, ones (1,7), ones (1,7), ones(1,7)), y, eps) -***** assert (burrinv (x, 1, 1, 1), y, eps) -***** assert (burrinv (x, [1, 1, 1, NaN, 1, 1, 1], 1, 1), [y(1:3), NaN, y(5:7)], eps) -***** assert (burrinv (x, 1, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) -***** assert (burrinv (x, 1, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) -***** assert (burrinv ([x, NaN], 1, 1, 1), [y, NaN], eps) -***** assert (burrinv (single ([x, NaN]), 1, 1, 1), single ([y, NaN]), eps('single')) -***** assert (burrinv ([x, NaN], single (1), 1, 1), single ([y, NaN]), eps('single')) -***** assert (burrinv ([x, NaN], 1, single (1), 1), single ([y, NaN]), eps('single')) -***** assert (burrinv ([x, NaN], 1, 1, single (1)), single ([y, NaN]), eps('single')) -***** error burrinv () -***** error burrinv (1) -***** error burrinv (1,2) -***** error burrinv (1,2,3) -***** error burrinv (1,2,3,4,5) -***** error burrinv (ones (3), ones (2), ones(2), ones(2)) -***** error burrinv (ones (2), ones (3), ones(2), ones(2)) -***** error burrinv (ones (2), ones (2), ones(3), ones(2)) -***** error burrinv (ones (2), ones (2), ones(2), ones(3)) -***** error burrinv (i, 2, 2, 2) -***** error burrinv (2, i, 2, 2) -***** error burrinv (2, 2, i, 2) -***** error burrinv (2, 2, 2, i) -23 tests, 23 passed, 0 known failure, 0 skipped -[inst/hmmviterbi.m] ->>>>> /build/octave-statistics-1.4.2/inst/hmmviterbi.m + n = 10; + p = [0.2, 0.5, 0.3]; + x = mnrnd (n, p); + assert (size (x), size (p)); + assert (all (x >= 0)); + assert (all (round (x) == x)); + assert (sum (x) == n); ***** test - sequence = [1, 2, 1, 1, 1, 2, 2, 1, 2, 3, 3, 3, 3, 2, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 3]; - transprob = [0.8, 0.2; 0.4, 0.6]; - outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; - vpath = hmmviterbi (sequence, transprob, outprob); - expected = [1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]; - assert (vpath, expected); + n = 10 * ones (3, 1); + p = [0.2, 0.5, 0.3]; + x = mnrnd (n, p); + assert (size (x), [length(n), length(p)]); + assert (all (x >= 0)); + assert (all (round (x) == x)); + assert (all (sum (x, 2) == n)); ***** test - sequence = {'A', 'B', 'A', 'A', 'A', 'B', 'B', 'A', 'B', 'C', 'C', 'C', 'C', 'B', 'C', 'A', 'A', 'A', 'A', 'C', 'C', 'B', 'C', 'A', 'C'}; - transprob = [0.8, 0.2; 0.4, 0.6]; - outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; - symbols = {'A', 'B', 'C'}; - statenames = {'One', 'Two'}; - vpath = hmmviterbi (sequence, transprob, outprob, 'symbols', symbols, 'statenames', statenames); - expected = {'One', 'One', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'Two', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One'}; - assert (vpath, expected); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/trirnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/trirnd.m -***** assert (size (trirnd (1,2,1.5)), [1, 1]) -***** assert (size (trirnd (1*ones (2,1), 2,1.5)), [2, 1]) -***** assert (size (trirnd (1*ones (2,2), 2,1.5)), [2, 2]) -***** assert (size (trirnd (1, 2*ones (2,1), 1.5)), [2, 1]) -***** assert (size (trirnd (1, 2*ones (2,2), 1.5)), [2, 2]) -***** assert (size (trirnd (1, 2, 1.5*ones (2,1))), [2, 1]) -***** assert (size (trirnd (1, 2, 1.5*ones (2,2))), [2, 2]) -***** assert (size (trirnd (1, 2, 1.5, 3)), [3, 3]) -***** assert (size (trirnd (1, 2, 1.5, [4 1])), [4, 1]) -***** assert (size (trirnd (1, 2, 1.5, 4, 1)), [4, 1]) -***** assert (class (trirnd (1,2,1.5)), "double") -***** assert (class (trirnd (single (1),2,1.5)), "single") -***** assert (class (trirnd (single ([1 1]),2,1.5)), "single") -***** assert (class (trirnd (1,single (2),1.5)), "single") -***** assert (class (trirnd (1,single ([2 2]),1.5)), "single") -***** assert (class (trirnd (1,2,single (1.5))), "single") -***** assert (class (trirnd (1,2,single ([1.5 1.5]))), "single") -***** error trirnd () -***** error trirnd (1) -***** error trirnd (1,2) -***** error trirnd (ones (3), 2*ones (2), 1.5*ones (2), 2) -***** error trirnd (ones (2), 2*ones (3), 1.5*ones (2), 2) -***** error trirnd (ones (2), 2*ones (2), 1.5*ones (3), 2) -***** error trirnd (i, 2, 1.5) -***** error trirnd (1, i, 1.5) -***** error trirnd (1, 2, i) -***** error trirnd (1,2,1.5, -1) -***** error trirnd (1,2,1.5, ones (2)) -***** error trirnd (1,2,1.5, [2 -1 2]) -***** error trirnd (1*ones (2),2,1.5, 3) -***** error trirnd (1*ones (2),2,1.5, [3, 2]) -***** error trirnd (1*ones (2),2,1.5, 3, 2) -32 tests, 32 passed, 0 known failure, 0 skipped -[inst/wishpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/wishpdf.m -***** assert(wishpdf(4, 3, 3.1), 0.07702496, 1E-7); -***** assert(wishpdf([2 -0.3;-0.3 4], [1 0.3;0.3 1], 4), 0.004529741, 1E-7); -***** assert(wishpdf([6 2 5; 2 10 -5; 5 -5 25], [9 5 5; 5 10 -8; 5 -8 22], 5.1), 4.474865e-10, 1E-15); -***** error wishpdf () -***** error wishpdf (1, 2) -***** error wishpdf (1, 2, 0) -***** error wishpdf (1, 2) -7 tests, 7 passed, 0 known failure, 0 skipped + n = (1:2)'; + p = [0.2, 0.5, 0.3; 0.1, 0.1, 0.8]; + x = mnrnd (n, p); + assert (size (x), size (p)); + assert (all (x >= 0)); + assert (all (round (x) == x)); + assert (all (sum (x, 2) == n)); +3 tests, 3 passed, 0 known failure, 0 skipped [inst/gpinv.m] >>>>> /build/octave-statistics-1.4.2/inst/gpinv.m ***** shared x,y1,y2,y3 @@ -5551,271 +6744,17 @@ ***** error gpinv (2, 2, i, 2) ***** error gpinv (2, 2, 2, i) 52 tests, 52 passed, 0 known failure, 0 skipped -[inst/copulapdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/copulapdf.m -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - theta = [1; 2]; - p = copulapdf ("Clayton", x, theta); - expected_p = [0.9872; 0.7295]; - assert (p, expected_p, 0.001); -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - p = copulapdf ("Gumbel", x, 2); - expected_p = [0.9468; 0.9468]; - assert (p, expected_p, 0.001); -***** test - x = [0.2, 0.6; 0.2, 0.6]; - theta = [1; 2]; - p = copulapdf ("Frank", x, theta); - expected_p = [0.9378; 0.8678]; - assert (p, expected_p, 0.001); -***** test - x = [0.2, 0.6; 0.2, 0.6]; - theta = [0.3; 0.7]; - p = copulapdf ("AMH", x, theta); - expected_p = [0.9540; 0.8577]; - assert (p, expected_p, 0.001); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/cdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/cdf.m -***** test - assert(cdf ('norm', 1, 0, 1), normcdf (1, 0, 1)) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/mvnpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/mvnpdf.m -***** demo - mu = [0, 0]; - sigma = [1, 0.1; 0.1, 0.5]; - [X, Y] = meshgrid (linspace (-3, 3, 25)); - XY = [X(:), Y(:)]; - Z = mvnpdf (XY, mu, sigma); - mesh (X, Y, reshape (Z, size (X))); - colormap jet -***** test - mu = [1,-1]; - sigma = [.9 .4; .4 .3]; - x = [ 0.5 -1.2; -0.5 -1.4; 0 -1.5]; - p = [ 0.41680003660313; 0.10278162359708; 0.27187267524566 ]; - q = mvnpdf (x, mu, sigma); - assert (p, q, 10*eps); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/bbsrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/bbsrnd.m -***** 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]) -***** 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") -***** error bbsrnd () -***** error bbsrnd (1) -***** error bbsrnd (1,2) -***** error bbsrnd (ones (3), ones (2), ones (2), 2) -***** error bbsrnd (ones (2), ones (3), ones (2), 2) -***** error bbsrnd (ones (2), ones (2), ones (3), 2) -***** error bbsrnd (i, 2, 3) -***** error bbsrnd (1, i, 3) -***** error bbsrnd (1, 2, i) -***** error bbsrnd (1,2,3, -1) -***** error bbsrnd (1,2,3, ones (2)) -***** error bbsrnd (1,2,3, [2 -1 2]) -***** error bbsrnd (2, 1, ones (2), 3) -***** error bbsrnd (2, 1, ones (2), [3, 2]) -***** error bbsrnd (2, 1, ones (2), 3, 2) -32 tests, 32 passed, 0 known failure, 0 skipped -[inst/hmmgenerate.m] ->>>>> /build/octave-statistics-1.4.2/inst/hmmgenerate.m -***** test - len = 25; - transprob = [0.8, 0.2; 0.4, 0.6]; - outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; - [sequence, states] = hmmgenerate (len, transprob, outprob); - assert (length (sequence), len); - assert (length (states), len); - assert (min (sequence) >= 1); - assert (max (sequence) <= columns (outprob)); - assert (min (states) >= 1); - assert (max (states) <= rows (transprob)); -***** test - len = 25; - transprob = [0.8, 0.2; 0.4, 0.6]; - outprob = [0.2, 0.4, 0.4; 0.7, 0.2, 0.1]; - symbols = {'A', 'B', 'C'}; - statenames = {'One', 'Two'}; - [sequence, states] = hmmgenerate (len, transprob, outprob, 'symbols', symbols, 'statenames', statenames); - assert (length (sequence), len); - assert (length (states), len); - assert (strcmp (sequence, 'A') + strcmp (sequence, 'B') + strcmp (sequence, 'C') == ones (1, len)); - assert (strcmp (states, 'One') + strcmp (states, 'Two') == ones (1, len)); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/raylinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/raylinv.m -***** test - p = 0:0.1:0.5; - sigma = 1:6; - x = raylinv (p, sigma); - expected_x = [0.0000, 0.9181, 2.0041, 3.3784, 5.0538, 7.0645]; - assert (x, expected_x, 0.001); -***** test - p = 0:0.1:0.5; - x = raylinv (p, 0.5); - expected_x = [0.0000, 0.2295, 0.3340, 0.4223, 0.5054, 0.5887]; - assert (x, expected_x, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/burrpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/burrpdf.m -***** shared x,y - x = [-1, 0, 1, 2, Inf]; - y = [0, 0, 1/4, 1/9, 0]; -***** assert (burrpdf (x, ones(1,5), ones (1,5), ones (1,5)), y) -***** assert (burrpdf (x, 1, 1, 1), y) -***** assert (burrpdf (x, [1, 1, NaN, 1, 1], 1, 1), [y(1:2), NaN, y(4:5)]) -***** assert (burrpdf (x, 1, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)]) -***** assert (burrpdf (x, 1, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)]) -***** assert (burrpdf ([x, NaN], 1, 1, 1), [y, NaN]) -***** assert (burrpdf (single ([x, NaN]), 1, 1, 1), single ([y, NaN])) -***** assert (burrpdf ([x, NaN], single (1), 1, 1), single ([y, NaN])) -***** assert (burrpdf ([x, NaN], 1, single (1), 1), single ([y, NaN])) -***** assert (burrpdf ([x, NaN], 1, 1, single (1)), single ([y, NaN])) -***** error burrpdf () -***** error burrpdf (1) -***** error burrpdf (1,2) -***** error burrpdf (1,2,3) -***** error burrpdf (1,2,3,4,5) -***** error burrpdf (ones (3), ones (2), ones(2), ones(2)) -***** error burrpdf (ones (2), ones (3), ones(2), ones(2)) -***** error burrpdf (ones (2), ones (2), ones(3), ones(2)) -***** error burrpdf (ones (2), ones (2), ones(2), ones(3)) -***** error burrpdf (i, 2, 2, 2) -***** error burrpdf (2, i, 2, 2) -***** error burrpdf (2, 2, i, 2) -***** error burrpdf (2, 2, 2, i) -23 tests, 23 passed, 0 known failure, 0 skipped -[inst/normstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/normstat.m -***** test - m = 1:6; - s = 0.2:0.2:1.2; - [mn, v] = normstat (m, s); - expected_v = [0.0400, 0.1600, 0.3600, 0.6400, 1.0000, 1.4400]; - assert (mn, m); - assert (v, expected_v, 0.001); -***** test - s = 0.2:0.2:1.2; - [mn, v] = normstat (0, s); - expected_mn = [0, 0, 0, 0, 0, 0]; - expected_v = [0.0400, 0.1600, 0.3600, 0.6400, 1.0000, 1.4400]; - assert (mn, expected_mn, 0.001); - assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/cmdscale.m] ->>>>> /build/octave-statistics-1.4.2/inst/cmdscale.m -***** shared m, n, X, D - m = randi(100) + 1; n = randi(100) + 1; X = rand(m, n); D = pdist(X); -***** assert(norm(pdist(cmdscale(D))), norm(D), sqrt(eps)) -***** assert(norm(pdist(cmdscale(squareform(D)))), norm(D), sqrt(eps)) -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/nakarnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/nakarnd.m -***** assert (size (nakarnd (1,1)), [1, 1]) -***** assert (size (nakarnd (ones (2,1), 1)), [2, 1]) -***** assert (size (nakarnd (ones (2,2), 1)), [2, 2]) -***** assert (size (nakarnd (1, ones (2,1))), [2, 1]) -***** assert (size (nakarnd (1, ones (2,2))), [2, 2]) -***** assert (size (nakarnd (1,1, 3)), [3, 3]) -***** assert (size (nakarnd (1,1, [4 1])), [4, 1]) -***** assert (size (nakarnd (1,1, 4, 1)), [4, 1]) -***** assert (class (nakarnd (1,1)), "double") -***** assert (class (nakarnd (single (1),1)), "single") -***** assert (class (nakarnd (single ([1 1]),1)), "single") -***** assert (class (nakarnd (1,single (1))), "single") -***** assert (class (nakarnd (1,single ([1 1]))), "single") -***** error nakarnd () -***** error nakarnd (1) -***** error nakarnd (zeros (3), ones (2)) -***** error nakarnd (zeros (2), ones (3)) -***** error nakarnd (i, 2) -***** error nakarnd (1, i) -***** error nakarnd (1,2, -1) -***** error nakarnd (1,2, ones (2)) -***** error nakarnd (1, 2, [2 -1 2]) -***** error nakarnd (1,2, 1, ones (2)) -***** error nakarnd (1,2, 1, -1) -***** error nakarnd (ones (2,2), 2, 3) -***** error nakarnd (ones (2,2), 2, [3, 2]) -***** error nakarnd (ones (2,2), 2, 2, 3) -27 tests, 27 passed, 0 known failure, 0 skipped -[inst/runstest.m] ->>>>> /build/octave-statistics-1.4.2/inst/runstest.m -***** test - data = [-213 -564 -35 -15 141 115 -420 -360 203 -338 -431 194 -220 -513 154 -125 -559 92 -21 -579 -52 99 -543 -175 162 -457 -346 204 -300 -474 164 -107 -572 -8 83 -541 -224 180 -420 -374 201 -236 -531 83 27 -564 -112 131 -507 -254 199 -311 -495 143 -46 -579 -90 136 -472 -338 202 -287 -477 169 -124 -568 17 48 -568 -135 162 -430 -422 172 -74 -577 -13 92 -534 -243 194 -355 -465 156 -81 -578 -64 139 -449 -384 193 -198 -538 110 -44 -577 -6 66 -552 -164 161 -460 -344 205 -281 -504 134 -28 -576 -118 156 -437 -381 200 -220 -540 83 11 -568 -160 172 -414 -408 188 -125 -572 -32 139 -492 -321 205 -262 -504 142 -83 -574 0 48 -571 -106 137 -501 -266 190 -391 -406 194 -186 -553 83 -13 -577 -49 103 -515 -280 201 300 -506 131 -45 -578 -80 138 -462 -361 201 -211 -554 32 74 -533 -235 187 -372 -442 182 -147 -566 25 68 -535 -244 194 -351 -463 174 -125 -570 15 72 -550 -190 172 -424 -385 198 -218 -536 96]; #NIST beam deflection data, http://www.itl.nist.gov/div898/handbook/eda/section4/eda425.htm - [h, p, stats] = runstest (data); - expected_h = true; - expected_p = 0.0070646; - expected_z = 2.6938; - assert (h, expected_h); - assert (p, expected_p, 1E-6); - assert (stats.z, expected_z, 1E-4); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/bbscdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/bbscdf.m -***** shared x,y - x = [-1, 0, 1, 2, Inf]; - y = [0, 0, 1/2, 0.76024993890652337, 1]; -***** 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) -***** 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')) -***** error bbscdf () -***** error bbscdf (1) -***** error bbscdf (1,2,3) -***** error bbscdf (1,2,3,4,5) -***** error bbscdf (ones (3), ones (2), ones(2), ones(2)) -***** 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, 4, 3, 2) -***** error bbscdf (1, i, 3, 2) -***** error bbscdf (1, 4, i, 2) -***** error bbscdf (1, 4, 3, i) -25 tests, 25 passed, 0 known failure, 0 skipped -[inst/tests/kruskal_wallis_test.m] ->>>>> /build/octave-statistics-1.4.2/inst/tests/kruskal_wallis_test.m -***** assert (abs (kruskal_wallis_test ([86 86], [74]) - 0.157299207050285) < 0.0000000000001) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/tests/kolmogorov_smirnov_test.m] ->>>>> /build/octave-statistics-1.4.2/inst/tests/kolmogorov_smirnov_test.m -***** assert (kolmogorov_smirnov_test (0:100, "unif", 0, 100), 1.0, eps) -***** assert (kolmogorov_smirnov_test (0:100, "logistic"), 0) -***** assert (kolmogorov_smirnov_test (50:100, "unif", 0, 50, "<")) -***** error kolmogorov_smirnov_test (1) -***** error kolmogorov_smirnov_test ({}, "unif", 2, 4) -***** error - kolmogorov_smirnov_test (1, "not_a_dist"); -***** error - kolmogorov_smirnov_test (1, "unif", 2, 4, "foo"); -7 tests, 7 passed, 0 known failure, 0 skipped +[inst/iwishrnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/iwishrnd.m +***** assert(size (iwishrnd (1,2,1)), [1, 1]); +***** assert(size (iwishrnd ([],2,1)), [1, 1]); +***** assert(size (iwishrnd ([3 1; 1 3], 2.00001, [], 1)), [2, 2]); +***** assert(size (iwishrnd (eye(2), 2, [], 3)), [2, 2, 3]); +***** error iwishrnd () +***** error iwishrnd (1) +***** error iwishrnd ([-3 1; 1 3],1) +***** error iwishrnd ([1; 1],1) +8 tests, 8 passed, 0 known failure, 0 skipped [inst/tests/sign_test.m] >>>>> /build/octave-statistics-1.4.2/inst/tests/sign_test.m ***** error sign_test () @@ -5825,6 +6764,39 @@ ***** assert (sign_test (ones(1,10), zeros(1,10), '<'), 0) ***** assert (sign_test (ones(1,10), zeros(1,10), '>'), 1) 6 tests, 6 passed, 0 known failure, 0 skipped +[inst/tests/z_test.m] +>>>>> /build/octave-statistics-1.4.2/inst/tests/z_test.m +***** test + ## Two-sided (also the default option) + x = rand (10,1); n = length (x); + u0 = 0.5; v = 1/12; # true mean, var + pval = z_test (x, u0, v, "!="); + if (mean (x) >= u0) + zval = abs (norminv (0.5*pval)); + else + zval = -abs (norminv (0.5*pval)); + endif + unew = zval * sqrt (v/n) + u0; + assert (mean (x), unew, 100*eps); +***** test + x = rand (10,1); n = length (x); + u0 = 0.5; v = 1/12; + pval = z_test (x, u0, v, ">"); + zval = norminv (1-pval); + unew = zval * sqrt (v/n) + u0; + assert (mean (x), unew, 100*eps); +***** test + x = rand (10,1); n = length (x); + u0 = 0.5; v = 1/12; + pval = z_test (x, u0, v, "<"); + zval = norminv (pval); + unew = zval * sqrt (v/n) + u0; + assert (mean (x), unew, 100*eps); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/tests/kruskal_wallis_test.m] +>>>>> /build/octave-statistics-1.4.2/inst/tests/kruskal_wallis_test.m +***** assert (abs (kruskal_wallis_test ([86 86], [74]) - 0.157299207050285) < 0.0000000000001) +1 test, 1 passed, 0 known failure, 0 skipped [inst/tests/z_test_2.m] >>>>> /build/octave-statistics-1.4.2/inst/tests/z_test_2.m ***** test @@ -5876,6 +6848,18 @@ delmu = mean (x) - mean (y); assert (delmu, unew, 100*eps); 6 tests, 6 passed, 0 known failure, 0 skipped +[inst/tests/kolmogorov_smirnov_test.m] +>>>>> /build/octave-statistics-1.4.2/inst/tests/kolmogorov_smirnov_test.m +***** assert (kolmogorov_smirnov_test (0:100, "unif", 0, 100), 1.0, eps) +***** assert (kolmogorov_smirnov_test (0:100, "logistic"), 0) +***** assert (kolmogorov_smirnov_test (50:100, "unif", 0, 50, "<")) +***** error kolmogorov_smirnov_test (1) +***** error kolmogorov_smirnov_test ({}, "unif", 2, 4) +***** error + kolmogorov_smirnov_test (1, "not_a_dist"); +***** error + kolmogorov_smirnov_test (1, "unif", 2, 4, "foo"); +7 tests, 7 passed, 0 known failure, 0 skipped [inst/tests/t_test.m] >>>>> /build/octave-statistics-1.4.2/inst/tests/t_test.m ***** xtest @@ -5906,443 +6890,108 @@ unew = tval * std(x)/sqrt(n) + u0; assert (mean (x), unew, 1e6*eps); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/tests/z_test.m] ->>>>> /build/octave-statistics-1.4.2/inst/tests/z_test.m -***** test - ## Two-sided (also the default option) - x = rand (10,1); n = length (x); - u0 = 0.5; v = 1/12; # true mean, var - pval = z_test (x, u0, v, "!="); - if (mean (x) >= u0) - zval = abs (norminv (0.5*pval)); - else - zval = -abs (norminv (0.5*pval)); - endif - unew = zval * sqrt (v/n) + u0; - assert (mean (x), unew, 100*eps); -***** test - x = rand (10,1); n = length (x); - u0 = 0.5; v = 1/12; - pval = z_test (x, u0, v, ">"); - zval = norminv (1-pval); - unew = zval * sqrt (v/n) + u0; - assert (mean (x), unew, 100*eps); -***** test - x = rand (10,1); n = length (x); - u0 = 0.5; v = 1/12; - pval = z_test (x, u0, v, "<"); - zval = norminv (pval); - unew = zval * sqrt (v/n) + u0; - assert (mean (x), unew, 100*eps); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/caseread.m] ->>>>> /build/octave-statistics-1.4.2/inst/caseread.m -***** shared n, casereadfile - n = ["a ";"bcd";"ef "]; - casereadfile = file_in_loadpath("test/caseread.dat"); -***** assert (caseread (casereadfile), n); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/mnrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/mnrnd.m -***** test - n = 10; - p = [0.2, 0.5, 0.3]; - x = mnrnd (n, p); - assert (size (x), size (p)); - assert (all (x >= 0)); - assert (all (round (x) == x)); - assert (sum (x) == n); -***** test - n = 10 * ones (3, 1); - p = [0.2, 0.5, 0.3]; - x = mnrnd (n, p); - assert (size (x), [length(n), length(p)]); - assert (all (x >= 0)); - assert (all (round (x) == x)); - assert (all (sum (x, 2) == n)); -***** test - n = (1:2)'; - p = [0.2, 0.5, 0.3; 0.1, 0.1, 0.8]; - x = mnrnd (n, p); - assert (size (x), size (p)); - assert (all (x >= 0)); - assert (all (round (x) == x)); - assert (all (sum (x, 2) == n)); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/iwishrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/iwishrnd.m -***** assert(size (iwishrnd (1,2,1)), [1, 1]); -***** assert(size (iwishrnd ([],2,1)), [1, 1]); -***** assert(size (iwishrnd ([3 1; 1 3], 2.00001, [], 1)), [2, 2]); -***** assert(size (iwishrnd (eye(2), 2, [], 3)), [2, 2, 3]); -***** error iwishrnd () -***** error iwishrnd (1) -***** error iwishrnd ([-3 1; 1 3],1) -***** error iwishrnd ([1; 1],1) -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/hmmestimate.m] ->>>>> /build/octave-statistics-1.4.2/inst/hmmestimate.m -***** test - sequence = [1, 2, 1, 1, 1, 2, 2, 1, 2, 3, 3, 3, 3, 2, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 3]; - states = [1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]; - [transprobest, outprobest] = hmmestimate (sequence, states); - expectedtransprob = [0.88889, 0.11111; 0.28571, 0.71429]; - expectedoutprob = [0.16667, 0.33333, 0.50000; 1.00000, 0.00000, 0.00000]; - assert (transprobest, expectedtransprob, 0.001); - assert (outprobest, expectedoutprob, 0.001); -***** test - sequence = {'A', 'B', 'A', 'A', 'A', 'B', 'B', 'A', 'B', 'C', 'C', 'C', 'C', 'B', 'C', 'A', 'A', 'A', 'A', 'C', 'C', 'B', 'C', 'A', 'C'}; - states = {'One', 'One', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'One', 'Two', 'Two', 'Two', 'Two', 'One', 'One', 'One', 'One', 'One', 'One'}; - symbols = {'A', 'B', 'C'}; - statenames = {'One', 'Two'}; - [transprobest, outprobest] = hmmestimate (sequence, states, 'symbols', symbols, 'statenames', statenames); - expectedtransprob = [0.88889, 0.11111; 0.28571, 0.71429]; - expectedoutprob = [0.16667, 0.33333, 0.50000; 1.00000, 0.00000, 0.00000]; - assert (transprobest, expectedtransprob, 0.001); - assert (outprobest, expectedoutprob, 0.001); +[inst/mahal.m] +>>>>> /build/octave-statistics-1.4.2/inst/mahal.m +***** error mahal () +***** error mahal (1, 2, 3) +***** error mahal ("A", "B") +***** error mahal ([1, 2], ["A", "B"]) +***** error mahal (ones (2, 2, 2)) +***** error mahal (ones (2, 2), ones (2, 2, 2)) +***** error mahal (ones (2, 2), ones (2, 3)) ***** test - sequence = [1, 2, 1, 1, 1, 2, 2, 1, 2, 3, 3, 3, 3, 2, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 3]; - states = [1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1]; - pseudotransitions = [8, 2; 4, 6]; - pseudoemissions = [2, 4, 4; 7, 2, 1]; - [transprobest, outprobest] = hmmestimate (sequence, states, 'pseudotransitions', pseudotransitions, 'pseudoemissions', pseudoemissions); - expectedtransprob = [0.85714, 0.14286; 0.35294, 0.64706]; - expectedoutprob = [0.178571, 0.357143, 0.464286; 0.823529, 0.117647, 0.058824]; - assert (transprobest, expectedtransprob, 0.001); - assert (outprobest, expectedoutprob, 0.001); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/nakainv.m] ->>>>> /build/octave-statistics-1.4.2/inst/nakainv.m -***** shared x,y - x = [-Inf, -1, 0, 1/2, 1, 2, Inf]; - y = [NaN, NaN, 0, 0.83255461115769769, Inf, NaN, NaN]; -***** assert (nakainv (x, ones (1,7), ones (1,7)), y, eps) -***** assert (nakainv (x, 1, 1), y, eps) -***** assert (nakainv (x, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) -***** assert (nakainv (x, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) -***** assert (nakainv ([x, NaN], 1, 1), [y, NaN], eps) -***** assert (nakainv (single ([x, NaN]), 1, 1), single ([y, NaN])) -***** assert (nakainv ([x, NaN], single (1), 1), single ([y, NaN])) -***** assert (nakainv ([x, NaN], 1, single (1)), single ([y, NaN])) -***** error nakainv () -***** error nakainv (1) -***** error nakainv (1,2) -***** error nakainv (1,2,3,4) -***** error nakainv (ones (3), ones (2), ones(2)) -***** error nakainv (ones (2), ones (3), ones(2)) -***** error nakainv (ones (2), ones (2), ones(3)) -***** error nakainv (i, 2, 2) -***** error nakainv (2, i, 2) -***** error nakainv (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/nakapdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/nakapdf.m + X = [1 0; 0 1; 1 1; 0 0]; + assert (mahal (X, X), [1.5; 1.5; 1.5; 1.5], 10*eps) + assert (mahal (X, X+1), [7.5; 7.5; 1.5; 13.5], 10*eps) +***** assert (mahal ([true; true], [false; true]), [0.5; 0.5], eps) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/burrcdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/burrcdf.m ***** shared x,y x = [-1, 0, 1, 2, Inf]; - y = [0, 0, 0.73575888234288467, 0.073262555554936715, 0]; -***** assert (nakapdf (x, ones (1,5), ones (1,5)), y, eps) -***** assert (nakapdf (x, 1, 1), y, eps) -***** assert (nakapdf (x, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)], eps) -***** assert (nakapdf (x, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)], eps) -***** assert (nakapdf ([x, NaN], 1, 1), [y, NaN], eps) -***** assert (nakapdf (single ([x, NaN]), 1, 1), single ([y, NaN])) -***** assert (nakapdf ([x, NaN], single (1), 1), single ([y, NaN])) -***** assert (nakapdf ([x, NaN], 1, single (1)), single ([y, NaN])) -***** error nakapdf () -***** error nakapdf (1) -***** error nakapdf (1,2) -***** error nakapdf (1,2,3,4) -***** error nakapdf (ones (3), ones (2), ones(2)) -***** error nakapdf (ones (2), ones (3), ones(2)) -***** error nakapdf (ones (2), ones (2), ones(3)) -***** error nakapdf (i, 2, 2) -***** error nakapdf (2, i, 2) -***** error nakapdf (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/stepwisefit.m] ->>>>> /build/octave-statistics-1.4.2/inst/stepwisefit.m + y = [0, 0, 1/2, 2/3, 1]; +***** assert (burrcdf (x, ones(1,5), ones (1,5), ones (1,5)), y, eps) +***** assert (burrcdf (x, 1, 1, 1), y, eps) +***** assert (burrcdf (x, [1, 1, NaN, 1, 1], 1, 1), [y(1:2), NaN, y(4:5)], eps) +***** assert (burrcdf (x, 1, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)], eps) +***** assert (burrcdf (x, 1, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)], eps) +***** assert (burrcdf ([x, NaN], 1, 1, 1), [y, NaN], eps) +***** assert (burrcdf (single ([x, NaN]), 1, 1, 1), single ([y, NaN]), eps('single')) +***** assert (burrcdf ([x, NaN], single (1), 1, 1), single ([y, NaN]), eps('single')) +***** assert (burrcdf ([x, NaN], 1, single (1), 1), single ([y, NaN]), eps('single')) +***** assert (burrcdf ([x, NaN], 1, 1, single (1)), single ([y, NaN]), eps('single')) +***** error burrcdf () +***** error burrcdf (1) +***** error burrcdf (1,2) +***** error burrcdf (1,2,3) +***** error burrcdf (1,2,3,4,5) +***** error burrcdf (ones (3), ones (2), ones(2), ones(2)) +***** error burrcdf (ones (2), ones (3), ones(2), ones(2)) +***** error burrcdf (ones (2), ones (2), ones(3), ones(2)) +***** error burrcdf (ones (2), ones (2), ones(2), ones(3)) +***** error burrcdf (i, 2, 2, 2) +***** error burrcdf (2, i, 2, 2) +***** error burrcdf (2, 2, i, 2) +***** error burrcdf (2, 2, 2, i) +23 tests, 23 passed, 0 known failure, 0 skipped +[inst/jackknife.m] +>>>>> /build/octave-statistics-1.4.2/inst/jackknife.m ***** test - % Sample data from Draper and Smith (n = 13, k = 4) - X = [7 1 11 11 7 11 3 1 2 21 1 11 10; ... - 26 29 56 31 52 55 71 31 54 47 40 66 68; ... - 6 15 8 8 6 9 17 22 18 4 23 9 8; ... - 60 52 20 47 33 22 6 44 22 26 34 12 12]'; - y = [78.5 74.3 104.3 87.6 95.9 109.2 102.7 72.5 93.1 115.9 83.8 113.3 109.4]'; - [X_use, b, bint, r, rint, stats] = stepwisefit(y, X); - assert(X_use, [4 1]) - assert(b, regress(y, [ones(size(y)) X(:, X_use)], 0.05)) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/gevfit_lmom.m] ->>>>> /build/octave-statistics-1.4.2/inst/gevfit_lmom.m -***** xtest <31070> - data = 1:50; - [pfit, pci] = gevfit_lmom (data); - expected_p = [-0.28 15.01 20.22]'; - assert (pfit, expected_p, 0.1); + ##Example from Quenouille, Table 1 + d=[0.18 4.00 1.04 0.85 2.14 1.01 3.01 2.33 1.57 2.19]; + jackstat = jackknife ( @(x) 1/mean(x), d ); + assert ( 10 / mean(d) - 9 * mean(jackstat), 0.5240, 1e-5 ); +***** demo + for k = 1:1000 + x=rand(10,1); + s(k)=std(x); + jackstat=jackknife(@std,x); + j(k)=10*std(x) - 9*mean(jackstat); + end + figure();hist([s',j'], 0:sqrt(1/12)/10:2*sqrt(1/12)) +***** demo + for k = 1:1000 + x=randn(1,50); + y=rand(1,50); + jackstat=jackknife(@(x) std(x{1})/std(x{2}),y,x); + j(k)=50*std(y)/std(x) - 49*mean(jackstat); + v(k)=sumsq((50*std(y)/std(x) - 49*jackstat) - j(k)) / (50 * 49); + end + t=(j-sqrt(1/12))./sqrt(v); + figure();plot(sort(tcdf(t,49)),"-;Almost linear mapping indicates good fit with t-distribution.;") 1 test, 1 passed, 0 known failure, 0 skipped -[inst/mvtrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/mvtrnd.m -***** test - sigma = [1, 0.5; 0.5, 1]; - nu = 3; - n = 10; - x = mvtrnd (sigma, nu, n); - assert (size (x), [10, 2]); -***** test - sigma = [1, 0.5; 0.5, 1]; - nu = [2; 3]; - n = 2; - x = mvtrnd (sigma, nu, 2); - assert (size (x), [2, 2]); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/tblread.m] ->>>>> /build/octave-statistics-1.4.2/inst/tblread.m -***** shared d, v, c, tblreadspacefile, tblreadtabfile - d = [1 2;3 4]; - v = ["a ";"bc"]; - c = ["de";"f "]; - tblreadspacefile = file_in_loadpath("test/tblread-space.dat"); - tblreadtabfile = file_in_loadpath("test/tblread-tab.dat"); -***** test - [dt vt ct] = tblread (tblreadspacefile); - assert (dt, d); - assert (vt, v); - assert (ct, c); -***** test - [dt vt ct] = tblread (tblreadspacefile, " "); - assert (dt, d); - assert (vt, v); - assert (ct, c); -***** test - [dt vt ct] = tblread (tblreadspacefile, "space"); - assert (dt, d); - assert (vt, v); - assert (ct, c); -***** test - [dt vt ct] = tblread (tblreadtabfile, "tab"); - assert (dt, d); - assert (vt, v); - assert (ct, c); -***** test - [dt vt ct] = tblread (tblreadtabfile, "\t"); - assert (dt, d); - assert (vt, v); - assert (ct, c); -***** test - [dt vt ct] = tblread (tblreadtabfile, '\t'); - assert (dt, d); - assert (vt, v); - assert (ct, c); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/grp2idx.m] ->>>>> /build/octave-statistics-1.4.2/inst/grp2idx.m -***** test - in = [true false false true]; - out = {[2; 1; 1; 2] {"0"; "1"} [false; true]}; - assert (nthargout (1:3, @grp2idx, in), out) - assert (nthargout (1:3, @grp2idx, in), nthargout (1:3, @grp2idx, in')) -***** test - assert (nthargout (1:3, @grp2idx, [false true]), - {[1; 2] {"0"; "1"} [false; true]}); - assert (nthargout (1:3, @grp2idx, [true false]), - {[2; 1] {"0"; "1"} [false; true]}); -***** assert (nthargout (1:3, @grp2idx, ["oct"; "sci"; "oct"; "oct"; "sci"]), - {[1; 2; 1; 1; 2] {"oct"; "sci"} ["oct"; "sci"]}); -***** assert (nthargout (1:3, @grp2idx, {"oct"; "sci"; "oct"; "oct"; "sci"}), - {[1; 2; 1; 1; 2] {"oct"; "sci"} {"oct"; "sci"}}); -***** assert (nthargout (1:3, @grp2idx, [ 1 -3 -2 -3 -3 2 1 -1 3 -3]), - {[4; 1; 2; 1; 1; 5; 4; 3; 6; 1] {"-3"; "-2"; "-1"; "1"; "2"; "3"} ... - [-3; -2; -1; 1; 2; 3]}); -***** assert (nthargout (1:3, @grp2idx, [2 2 3 NaN 2 3]), - {[1; 1; 2; NaN; 1; 2] {"2"; "3"} [2; 3]}) -***** assert (nthargout (1:3, @grp2idx, {"et" "sa" "sa" "" "et"}), - {[1; 2; 2; NaN; 1] {"et"; "sa"} {"et"; "sa"}}) -***** xtest <51928> assert (nthargout (1:3, @grp2idx, ["sci"; "oct"; "sci"; "oct"; "oct"]), - {[1; 2; 1; 2; 2] {"sci"; "oct"} ["sci"; "oct"]}); -!!!!! known bug: https://octave.org/testfailure/?51928 -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - (1) 2 1 Abs err 1 exceeds tol 0 by 1 - (2) 1 2 Abs err 1 exceeds tol 0 by 1 - (3) 2 1 Abs err 1 exceeds tol 0 by 1 - (4) 1 2 Abs err 1 exceeds tol 0 by 1 - (5) 1 2 Abs err 1 exceeds tol 0 by 1 - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] oct sci Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] sci oct Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] osccti soccit Strings don't match -***** xtest <51928> assert (nthargout (1:3, @grp2idx, {"sci"; "oct"; "sci"; "oct"; "oct"}), - {[1; 2; 1; 2; 2] {"sci"; "oct"} {"sci"; "oct"}}); -!!!!! known bug: https://octave.org/testfailure/?51928 -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - (1) 2 1 Abs err 1 exceeds tol 0 by 1 - (2) 1 2 Abs err 1 exceeds tol 0 by 1 - (3) 2 1 Abs err 1 exceeds tol 0 by 1 - (4) 1 2 Abs err 1 exceeds tol 0 by 1 - (5) 1 2 Abs err 1 exceeds tol 0 by 1 - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] oct sci Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] sci oct Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] oct sci Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] sci oct Strings don't match -***** xtest <51928> assert (nthargout (1:3, @grp2idx, {"sa" "et" "et" "" "sa"}), - {[1; 2; 2; NaN; 1] {"sa"; "et"} {"sa"; "et"}}) -!!!!! known bug: https://octave.org/testfailure/?51928 -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - (1) 2 1 Abs err 1 exceeds tol 0 by 1 - (2) 1 2 Abs err 1 exceeds tol 0 by 1 - (3) 1 2 Abs err 1 exceeds tol 0 by 1 - (5) 2 1 Abs err 1 exceeds tol 0 by 1 - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] et sa Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] sa et Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] et sa Strings don't match - -ASSERT errors for: assert (cond {i},expected {i},tol) - - Location | Observed | Expected | Reason - [] sa et Strings don't match -10 tests, 7 passed, 0 known failure, 3 skipped -[inst/copulacdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/copulacdf.m -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - theta = [1; 2]; - p = copulacdf ("Clayton", x, theta); - expected_p = [0.1395; 0.1767]; - assert (p, expected_p, 0.001); -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - p = copulacdf ("Gumbel", x, 2); - expected_p = [0.1464; 0.1464]; - assert (p, expected_p, 0.001); -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - theta = [1; 2]; - p = copulacdf ("Frank", x, theta); - expected_p = [0.0699; 0.0930]; - assert (p, expected_p, 0.001); -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - theta = [0.3; 0.7]; - p = copulacdf ("AMH", x, theta); - expected_p = [0.0629; 0.0959]; - assert (p, expected_p, 0.001); -***** test - x = [0.2:0.2:0.6; 0.2:0.1:0.4]; - theta = [0.2, 0.1, 0.1, 0.05]; - p = copulacdf ("FGM", x, theta); - expected_p = [0.0558; 0.0293]; - assert (p, expected_p, 0.001); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/base/cloglog.m] ->>>>> /build/octave-statistics-1.4.2/inst/base/cloglog.m -***** assert (cloglog (0), -Inf) -***** assert (cloglog (1), Inf) -***** assert (cloglog (1/e), 0) -***** error cloglog () -***** error cloglog (1, 2) -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/base/ppplot.m] ->>>>> /build/octave-statistics-1.4.2/inst/base/ppplot.m -***** error ppplot () -***** error ppplot (ones (2,2)) -***** error ppplot (1, 2) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/base/logit.m] ->>>>> /build/octave-statistics-1.4.2/inst/base/logit.m -***** test - p = [0.01:0.01:0.99]; - assert (logit (p), log (p ./ (1-p)), 25*eps); -***** assert (logit ([-1, 0, 0.5, 1, 2]), [NaN, -Inf, 0, +Inf, NaN]) -***** error logit () -***** error logit (1, 2) -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/base/crosstab.m] ->>>>> /build/octave-statistics-1.4.2/inst/base/crosstab.m -***** error crosstab () -***** error crosstab (1) -***** error crosstab (1, 2, 3) -***** error crosstab (ones (2), [1 1]) -***** error crosstab ([1 1], ones (2)) -***** error crosstab ({true, true}, [1 1]) -***** error crosstab ([1 1], {true, true}) -***** error crosstab ([1], [1 1]) -***** error crosstab ([1 1], [1]) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/base/probit.m] ->>>>> /build/octave-statistics-1.4.2/inst/base/probit.m -***** assert (probit ([-1, 0, 0.5, 1, 2]), [NaN, -Inf, 0, Inf, NaN]) -***** error probit () -***** error probit (1, 2) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/base/qqplot.m] ->>>>> /build/octave-statistics-1.4.2/inst/base/qqplot.m -***** error qqplot () -***** error qqplot ({1}) -***** error qqplot (ones (2,2)) -***** error qqplot (1, "foobar") -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/lognstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/lognstat.m +[inst/betastat.m] +>>>>> /build/octave-statistics-1.4.2/inst/betastat.m ***** test - mu = 0:0.2:1; - sigma = 0.2:0.2:1.2; - [m, v] = lognstat (mu, sigma); - expected_m = [1.0202, 1.3231, 1.7860, 2.5093, 3.6693, 5.5845]; - expected_v = [0.0425, 0.3038, 1.3823, 5.6447, 23.1345, 100.4437]; - assert (m, expected_m, 0.001); + a = -2:6; + b = 0.4:0.2:2; + [m, v] = betastat (a, b); + expected_m = [NaN NaN NaN 1/2 2/3.2 3/4.4 4/5.6 5/6.8 6/8]; + expected_v = [NaN NaN NaN 0.0833, 0.0558, 0.0402, 0.0309, 0.0250, 0.0208]; + assert (m, expected_m, eps*100); assert (v, expected_v, 0.001); ***** test - sigma = 0.2:0.2:1.2; - [m, v] = lognstat (0, sigma); - expected_m = [1.0202, 1.0833, 1.1972, 1.3771, 1.6487, 2.0544]; - expected_v = [0.0425, 0.2036, 0.6211, 1.7002, 4.6708, 13.5936]; - assert (m, expected_m, 0.001); + a = -2:1:6; + [m, v] = betastat (a, 1.5); + expected_m = [NaN NaN NaN 1/2.5 2/3.5 3/4.5 4/5.5 5/6.5 6/7.5]; + expected_v = [NaN NaN NaN 0.0686, 0.0544, 0.0404, 0.0305, 0.0237, 0.0188]; + assert (m, expected_m); assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped +***** test + a = [14 Inf 10 NaN 10]; + b = [12 9 NaN Inf 12]; + [m, v] = betastat (a, b); + expected_m = [14/26 NaN NaN NaN 10/22]; + expected_v = [168/18252 NaN NaN NaN 120/11132]; + assert (m, expected_m); + assert (v, expected_v); +***** assert (nthargout (1:2, @betastat, 5, []), {[], []}) +***** assert (nthargout (1:2, @betastat, [], 5), {[], []}) +***** assert (nthargout (1:2, @betastat, "", 5), {[], []}) +***** assert (nthargout (1:2, @betastat, true, 5), {1/6, 5/252}) +***** assert (size (betastat (rand (10, 5, 4), rand (10, 5, 4))), [10 5 4]) +***** assert (size (betastat (rand (10, 5, 4), 7)), [10 5 4]) +9 tests, 9 passed, 0 known failure, 0 skipped [inst/gevpdf.m] >>>>> /build/octave-statistics-1.4.2/inst/gevpdf.m ***** test @@ -6370,59 +7019,62 @@ expected_y = [0.23820 0.23764 0.23704 0.23641 0.23576 0.23508 0.23438]; assert (y, expected_y, 0.001); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/betastat.m] ->>>>> /build/octave-statistics-1.4.2/inst/betastat.m +[inst/caseread.m] +>>>>> /build/octave-statistics-1.4.2/inst/caseread.m +***** shared n, casereadfile + n = ["a ";"bcd";"ef "]; + casereadfile = file_in_loadpath("test/caseread.dat"); +***** assert (caseread (casereadfile), n); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/copularnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/copularnd.m ***** test - a = -2:6; - b = 0.4:0.2:2; - [m, v] = betastat (a, b); - expected_m = [NaN NaN NaN 1/2 2/3.2 3/4.4 4/5.6 5/6.8 6/8]; - expected_v = [NaN NaN NaN 0.0833, 0.0558, 0.0402, 0.0309, 0.0250, 0.0208]; - assert (m, expected_m, eps*100); - assert (v, expected_v, 0.001); + theta = 0.5; + x = copularnd ("Gaussian", theta); + assert (size (x), [1, 2]); + assert (all ((x >= 0) & (x <= 1))); ***** test - a = -2:1:6; - [m, v] = betastat (a, 1.5); - expected_m = [NaN NaN NaN 1/2.5 2/3.5 3/4.5 4/5.5 5/6.5 6/7.5]; - expected_v = [NaN NaN NaN 0.0686, 0.0544, 0.0404, 0.0305, 0.0237, 0.0188]; - assert (m, expected_m); - assert (v, expected_v, 0.001); + theta = 0.5; + nu = 2; + x = copularnd ("t", theta, nu); + assert (size (x), [1, 2]); + assert (all ((x >= 0) & (x <= 1))); ***** test - a = [14 Inf 10 NaN 10]; - b = [12 9 NaN Inf 12]; - [m, v] = betastat (a, b); - expected_m = [14/26 NaN NaN NaN 10/22]; - expected_v = [168/18252 NaN NaN NaN 120/11132]; - assert (m, expected_m); - assert (v, expected_v); -***** assert (nthargout (1:2, @betastat, 5, []), {[], []}) -***** assert (nthargout (1:2, @betastat, [], 5), {[], []}) -***** assert (nthargout (1:2, @betastat, "", 5), {[], []}) -***** assert (nthargout (1:2, @betastat, true, 5), {1/6, 5/252}) -***** assert (size (betastat (rand (10, 5, 4), rand (10, 5, 4))), [10 5 4]) -***** assert (size (betastat (rand (10, 5, 4), 7)), [10 5 4]) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/binotest.m] ->>>>> /build/octave-statistics-1.4.2/inst/binotest.m -***** demo - % flip a coin 1000 times, showing 475 heads - % Hypothesis: coin is fair, i.e. p=1/2 - [h,p_val,ci] = binotest(475,1000,0.5) - % Result: h = 0 : null hypothesis not rejected, coin could be fair - % P value 0.12, i.e. hypothesis not rejected for alpha up to 12% - % 0.444 <= p <= 0.506 with 95% confidence -***** demo - % flip a coin 100 times, showing 65 heads - % Hypothesis: coin shows less than 50% heads, i.e. p<=1/2 - [h,p_val,ci] = binotest(65,100,0.5,'tail','left','alpha',0.01) - % Result: h = 1 : null hypothesis is rejected, i.e. coin shows more heads than tails - % P value 0.0018, i.e. hypothesis not rejected for alpha up to 0.18% - % 0 <= p <= 0.76 with 99% confidence -***** test #example from https://en.wikipedia.org/wiki/Binomial_test - [h,p_val,ci] = binotest (51,235,1/6); - assert (p_val, 0.0437, 0.00005) - [h,p_val,ci] = binotest (51,235,1/6,'tail','left'); - assert (p_val, 0.027, 0.0005) + theta = 0.5; + x = copularnd ("Clayton", theta); + assert (size (x), [1, 2]); + assert (all ((x >= 0) & (x <= 1))); +***** test + theta = 0.5; + n = 2; + x = copularnd ("Clayton", theta, n); + assert (size (x), [n, 2]); + assert (all ((x >= 0) & (x <= 1))); +***** test + theta = [1; 2]; + n = 2; + d = 3; + x = copularnd ("Clayton", theta, n, d); + assert (size (x), [n, d]); + assert (all ((x >= 0) & (x <= 1))); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/unidstat.m] +>>>>> /build/octave-statistics-1.4.2/inst/unidstat.m +***** test + n = 1:6; + [m, v] = unidstat (n); + expected_m = [1.0000, 1.5000, 2.0000, 2.5000, 3.0000, 3.5000]; + expected_v = [0.0000, 0.2500, 0.6667, 1.2500, 2.0000, 2.9167]; + assert (m, expected_m, 0.001); + assert (v, expected_v, 0.001); +1 test, 1 passed, 0 known failure, 0 skipped +[inst/gevfit_lmom.m] +>>>>> /build/octave-statistics-1.4.2/inst/gevfit_lmom.m +***** xtest <31070> + data = 1:50; + [pfit, pci] = gevfit_lmom (data); + expected_p = [-0.28 15.01 20.22]'; + assert (pfit, expected_p, 0.1); 1 test, 1 passed, 0 known failure, 0 skipped [inst/burrrnd.m] >>>>> /build/octave-statistics-1.4.2/inst/burrrnd.m @@ -6459,283 +7111,65 @@ ***** error burrrnd (4*ones (2),2,2, [3, 2]) ***** error burrrnd (4*ones (2),2,2, 3, 2) 32 tests, 32 passed, 0 known failure, 0 skipped -[inst/jackknife.m] ->>>>> /build/octave-statistics-1.4.2/inst/jackknife.m -***** test - ##Example from Quenouille, Table 1 - d=[0.18 4.00 1.04 0.85 2.14 1.01 3.01 2.33 1.57 2.19]; - jackstat = jackknife ( @(x) 1/mean(x), d ); - assert ( 10 / mean(d) - 9 * mean(jackstat), 0.5240, 1e-5 ); -***** demo - for k = 1:1000 - x=rand(10,1); - s(k)=std(x); - jackstat=jackknife(@std,x); - j(k)=10*std(x) - 9*mean(jackstat); - end - figure();hist([s',j'], 0:sqrt(1/12)/10:2*sqrt(1/12)) -***** demo - for k = 1:1000 - x=randn(1,50); - y=rand(1,50); - jackstat=jackknife(@(x) std(x{1})/std(x{2}),y,x); - j(k)=50*std(y)/std(x) - 49*mean(jackstat); - v(k)=sumsq((50*std(y)/std(x) - 49*jackstat) - j(k)) / (50 * 49); - end - t=(j-sqrt(1/12))./sqrt(v); - figure();plot(sort(tcdf(t,49)),"-;Almost linear mapping indicates good fit with t-distribution.;") -1 test, 1 passed, 0 known failure, 0 skipped -[inst/tstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/tstat.m -***** test - n = 3:8; - [m, v] = tstat (n); - expected_m = [0, 0, 0, 0, 0, 0]; - expected_v = [3.0000, 2.0000, 1.6667, 1.5000, 1.4000, 1.3333]; - assert (m, expected_m); - assert (v, expected_v, 0.001); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/poisstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/poisstat.m -***** test - lambda = 1 ./ (1:6); - [m, v] = poisstat (lambda); - assert (m, lambda); - assert (v, lambda); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/gmdistribution.m] ->>>>> /build/octave-statistics-1.4.2/inst/gmdistribution.m -***** test - mu = eye(2); - Sigma = eye(2); - GM = gmdistribution (mu, Sigma); - density = GM.pdf ([0 0; 1 1]); - assert (density(1) - density(2), 0, 1e-6); - - [idx, nlogl, P, logpdf,M] = cluster (GM, eye(2)); - assert (idx, [1; 2]); - [idx2,nlogl2,P2,logpdf2] = GM.cluster (eye(2)); - assert (nlogl - nlogl2, 0, 1e-6); - [idx3,nlogl3,P3] = cluster (GM, eye(2)); - assert (P - P3, zeros (2), 1e-6); - [idx4,nlogl4] = cluster (GM, eye(2)); - assert (size (nlogl4), [1 1]); - idx5 = cluster (GM, eye(2)); - assert (idx - idx5, zeros (2,1)); - - D = GM.mahal ([1;0]); - assert (D - M(1,:), zeros (1,2), 1e-6); - - P = GM.posterior ([0 1]); - assert (P - P2(2,:), zeros (1,2), 1e-6); - - R = GM.random(20); - assert (size(R), [20, 2]); - - R = GM.random(); - assert (size(R), [1, 2]); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/gpcdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/gpcdf.m -***** shared x,y1,y2,y3 - x = [-Inf, -1, 0, 1/2, 1, Inf]; - y1 = [0, 0, 0, 0.3934693402873666, 0.6321205588285577, 1]; - y2 = [0, 0, 0, 1/3, 1/2, 1]; - 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, 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, 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, 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) -***** assert (gpcdf (single ([x, NaN]), 0, 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]), 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')) -***** error gpcdf () -***** error gpcdf (1) -***** error gpcdf (1,2) -***** 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 (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) -***** error gpcdf (2, 2, 2, i) -52 tests, 52 passed, 0 known failure, 0 skipped -[inst/mvnrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/mvnrnd.m -***** shared m, n, C, rho - m = 10; n = 3; rho = 0.4; C = rho*ones(n, n) + (1 - rho)*eye(n); -***** assert(size(mvnrnd(0, C, m)), [m n]) -***** assert(size(mvnrnd(zeros(1, n), C, m)), [m n]) -***** assert(size(mvnrnd(zeros(n, 1), C, m)), [m n]) -***** assert(size(mvnrnd(zeros(m, n), C, m)), [m n]) -***** assert(size(mvnrnd(zeros(m, n), C)), [m n]) -***** assert(size(mvnrnd(zeros(1, n), C)), [1 n]) -***** assert(size(mvnrnd(zeros(n, 1), C)), [1 n]) -***** error(mvnrnd(zeros(m+1, n), C, m)) -***** error(mvnrnd(zeros(1, n+1), C, m)) -***** error(mvnrnd(zeros(n+1, 1), C, m)) -***** error(mvnrnd(zeros(m, n), eye(n+1), m)) -***** error(mvnrnd(zeros(m, n), eye(n+1, n), m)) -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/raylstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/raylstat.m -***** test - sigma = 1:6; - [m, v] = raylstat (sigma); - expected_m = [1.2533, 2.5066, 3.7599, 5.0133, 6.2666, 7.5199]; - expected_v = [0.4292, 1.7168, 3.8628, 6.8673, 10.7301, 15.4513]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/fstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/fstat.m -***** test - m = 1:6; - n = 5:10; - [mn, v] = fstat (m, n); - expected_mn = [1.6667, 1.5000, 1.4000, 1.3333, 1.2857, 1.2500]; - expected_v = [22.2222, 6.7500, 3.4844, 2.2222, 1.5869, 1.2153]; - assert (mn, expected_mn, 0.001); - assert (v, expected_v, 0.001); -***** test - m = 1:6; - [mn, v] = fstat (m, 5); - expected_mn = [1.6667, 1.6667, 1.6667, 1.6667, 1.6667, 1.6667]; - expected_v = [22.2222, 13.8889, 11.1111, 9.7222, 8.8889, 8.3333]; - assert (mn, expected_mn, 0.001); - assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/canoncorr.m] ->>>>> /build/octave-statistics-1.4.2/inst/canoncorr.m -***** shared X,Y,A,B,r,U,V,k - k = 10; - X = [1:k; sin(1:k); cos(1:k)]'; Y = [tan(1:k); tanh((1:k)/k)]'; - [A,B,r,U,V,stats] = canoncorr (X,Y); -***** assert (A, [-0.329229 0.072908; 0.074870 1.389318; -0.069302 -0.024109], 1E-6); -***** assert (B, [-0.017086 -0.398402; -4.475049 -0.824538], 1E-6); -***** assert (r, [0.99590 0.26754], 1E-5); -***** assert (U, center(X) * A, 10*eps); -***** assert (V, center(Y) * B, 10*eps); -***** assert (cov(U), eye(size(U, 2)), 10*eps); -***** assert (cov(V), eye(size(V, 2)), 10*eps); - rand ("state", 1); [A,B,r] = canoncorr (rand(5, 10),rand(5, 20)); -***** assert (r, ones(1, 5), 10*eps); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/gprnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/gprnd.m -***** assert (size (gprnd (0,1,0)), [1, 1]) -***** 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 (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]) -***** assert (class (gprnd (0,1,0)), "double") -***** 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 (single (0), 1, 0)), "single") -***** assert (class (gprnd (single ([0 0]), 1, 0)), "single") -***** error gprnd () -***** error gprnd (1) -***** error gprnd (1,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 (0,1, zeros (2), 3) -***** error gprnd (0,1, zeros (2), [3, 2]) -***** error gprnd (0,1, zeros (2), 3, 2) -52 tests, 52 passed, 0 known failure, 0 skipped -[inst/nbinstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/nbinstat.m -***** test - n = 1:4; - p = 0.2:0.2:0.8; - [m, v] = nbinstat (n, p); - expected_m = [ 4.0000, 3.0000, 2.0000, 1.0000]; - expected_v = [20.0000, 7.5000, 3.3333, 1.2500]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); +[inst/nakapdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/nakapdf.m +***** shared x,y + x = [-1, 0, 1, 2, Inf]; + y = [0, 0, 0.73575888234288467, 0.073262555554936715, 0]; +***** assert (nakapdf (x, ones (1,5), ones (1,5)), y, eps) +***** assert (nakapdf (x, 1, 1), y, eps) +***** assert (nakapdf (x, [1, 1, NaN, 1, 1], 1), [y(1:2), NaN, y(4:5)], eps) +***** assert (nakapdf (x, 1, [1, 1, NaN, 1, 1]), [y(1:2), NaN, y(4:5)], eps) +***** assert (nakapdf ([x, NaN], 1, 1), [y, NaN], eps) +***** assert (nakapdf (single ([x, NaN]), 1, 1), single ([y, NaN])) +***** assert (nakapdf ([x, NaN], single (1), 1), single ([y, NaN])) +***** assert (nakapdf ([x, NaN], 1, single (1)), single ([y, NaN])) +***** error nakapdf () +***** error nakapdf (1) +***** error nakapdf (1,2) +***** error nakapdf (1,2,3,4) +***** error nakapdf (ones (3), ones (2), ones(2)) +***** error nakapdf (ones (2), ones (3), ones(2)) +***** error nakapdf (ones (2), ones (2), ones(3)) +***** error nakapdf (i, 2, 2) +***** error nakapdf (2, i, 2) +***** error nakapdf (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/cdf.m] +>>>>> /build/octave-statistics-1.4.2/inst/cdf.m ***** test - n = 1:4; - [m, v] = nbinstat (n, 0.5); - expected_m = [1, 2, 3, 4]; - expected_v = [2, 4, 6, 8]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/nanvar.m] ->>>>> /build/octave-statistics-1.4.2/inst/nanvar.m -***** shared x - x = [1 2 nan 3 4 5]; -***** assert (nanvar (x), var (x(! isnan (x))), 10*eps) + assert(cdf ('norm', 1, 0, 1), normcdf (1, 0, 1)) 1 test, 1 passed, 0 known failure, 0 skipped +[inst/nakarnd.m] +>>>>> /build/octave-statistics-1.4.2/inst/nakarnd.m +***** assert (size (nakarnd (1,1)), [1, 1]) +***** assert (size (nakarnd (ones (2,1), 1)), [2, 1]) +***** assert (size (nakarnd (ones (2,2), 1)), [2, 2]) +***** assert (size (nakarnd (1, ones (2,1))), [2, 1]) +***** assert (size (nakarnd (1, ones (2,2))), [2, 2]) +***** assert (size (nakarnd (1,1, 3)), [3, 3]) +***** assert (size (nakarnd (1,1, [4 1])), [4, 1]) +***** assert (size (nakarnd (1,1, 4, 1)), [4, 1]) +***** assert (class (nakarnd (1,1)), "double") +***** assert (class (nakarnd (single (1),1)), "single") +***** assert (class (nakarnd (single ([1 1]),1)), "single") +***** assert (class (nakarnd (1,single (1))), "single") +***** assert (class (nakarnd (1,single ([1 1]))), "single") +***** error nakarnd () +***** error nakarnd (1) +***** error nakarnd (zeros (3), ones (2)) +***** error nakarnd (zeros (2), ones (3)) +***** error nakarnd (i, 2) +***** error nakarnd (1, i) +***** error nakarnd (1,2, -1) +***** error nakarnd (1,2, ones (2)) +***** error nakarnd (1, 2, [2 -1 2]) +***** error nakarnd (1,2, 1, ones (2)) +***** error nakarnd (1,2, 1, -1) +***** error nakarnd (ones (2,2), 2, 3) +***** error nakarnd (ones (2,2), 2, [3, 2]) +***** error nakarnd (ones (2,2), 2, 2, 3) +27 tests, 27 passed, 0 known failure, 0 skipped [inst/gppdf.m] >>>>> /build/octave-statistics-1.4.2/inst/gppdf.m ***** shared x,y1,y2,y3 @@ -6795,397 +7229,6 @@ ***** error gppdf (2, 2, i, 2) ***** error gppdf (2, 2, 2, i) 51 tests, 51 passed, 0 known failure, 0 skipped -[inst/casewrite.m] ->>>>> /build/octave-statistics-1.4.2/inst/casewrite.m -***** test - fname = [tempname() ".dat"]; - unwind_protect - s = ["a ";"bcd";"ef "]; - casewrite (s, fname) - names = caseread (fname); - unwind_protect_cleanup - unlink (fname); - end_unwind_protect - assert(names, s); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/gevinv.m] ->>>>> /build/octave-statistics-1.4.2/inst/gevinv.m -***** test - p = 0.1:0.1:0.9; - k = 0; - sigma = 1; - mu = 0; - x = gevinv (p, k, sigma, mu); - c = gevcdf(x, k, sigma, mu); - assert (c, p, 0.001); -***** test - p = 0.1:0.1:0.9; - k = 1; - sigma = 1; - mu = 0; - x = gevinv (p, k, sigma, mu); - c = gevcdf(x, k, sigma, mu); - assert (c, p, 0.001); -***** test - p = 0.1:0.1:0.9; - k = 0.3; - sigma = 1; - mu = 0; - x = gevinv (p, k, sigma, mu); - c = gevcdf(x, k, sigma, mu); - assert (c, p, 0.001); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/mnpdf.m] ->>>>> /build/octave-statistics-1.4.2/inst/mnpdf.m -***** test - x = [1, 4, 2]; - p = [0.2, 0.5, 0.3]; - y = mnpdf (x, p); - assert (y, 0.11812, 0.001); -***** test - x = [1, 4, 2; 1, 0, 9]; - p = [0.2, 0.5, 0.3; 0.1, 0.1, 0.8]; - y = mnpdf (x, p); - assert (y, [0.11812; 0.13422], 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/copularnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/copularnd.m -***** test - theta = 0.5; - x = copularnd ("Gaussian", theta); - assert (size (x), [1, 2]); - assert (all ((x >= 0) & (x <= 1))); -***** test - theta = 0.5; - nu = 2; - x = copularnd ("t", theta, nu); - assert (size (x), [1, 2]); - assert (all ((x >= 0) & (x <= 1))); -***** test - theta = 0.5; - x = copularnd ("Clayton", theta); - assert (size (x), [1, 2]); - assert (all ((x >= 0) & (x <= 1))); -***** test - theta = 0.5; - n = 2; - x = copularnd ("Clayton", theta, n); - assert (size (x), [n, 2]); - assert (all ((x >= 0) & (x <= 1))); -***** test - theta = [1; 2]; - n = 2; - d = 3; - x = copularnd ("Clayton", theta, n, d); - assert (size (x), [n, d]); - assert (all ((x >= 0) & (x <= 1))); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/gevrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/gevrnd.m -***** assert(size (gevrnd (1,2,1)), [1, 1]); -***** assert(size (gevrnd (ones(2,1), 2, 1)), [2, 1]); -***** assert(size (gevrnd (ones(2,2), 2, 1)), [2, 2]); -***** assert(size (gevrnd (1, 2*ones(2,1), 1)), [2, 1]); -***** assert(size (gevrnd (1, 2*ones(2,2), 1)), [2, 2]); -***** assert(size (gevrnd (1, 2, 1, 3)), [3, 3]); -***** assert(size (gevrnd (1, 2, 1, [4 1])), [4, 1]); -***** assert(size (gevrnd (1, 2, 1, 4, 1)), [4, 1]); -***** error gevrnd () -***** error gevrnd (1, 2) -***** error gevrnd (ones(3),ones(2),1) -***** error gevrnd (ones(2),ones(3),1) -***** error gevrnd (i, 2, 1) -***** error gevrnd (2, i, 1) -***** error gevrnd (2, 0, 1) -***** error gevrnd (1,2, 1, -1) -***** error gevrnd (1,2, 1, ones(2)) -***** error gevrnd (1,2, 1, [2 -1 2]) -***** error gevrnd (1,2, 1, 1, ones(2)) -***** error gevrnd (1,2, 1, 1, -1) -***** error gevrnd (ones(2,2), 2, 1, 3) -***** error gevrnd (ones(2,2), 2, 1, [3, 2]) -***** error gevrnd (ones(2,2), 2, 1, 2, 3) -23 tests, 23 passed, 0 known failure, 0 skipped -[inst/raylrnd.m] ->>>>> /build/octave-statistics-1.4.2/inst/raylrnd.m -***** test - sigma = 1:6; - x = raylrnd (sigma); - assert (size (x), size (sigma)); - assert (all (x >= 0)); -***** test - sigma = 0.5; - sz = [2, 3]; - x = raylrnd (sigma, sz); - assert (size (x), sz); - assert (all (x >= 0)); -***** test - sigma = 0.5; - r = 2; - c = 3; - x = raylrnd (sigma, r, c); - assert (size (x), [r, c]); - assert (all (x >= 0)); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/wblstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/wblstat.m -***** test - scale = 3:8; - shape = 1:6; - [m, v] = wblstat (scale, shape); - expected_m = [3.0000, 3.5449, 4.4649, 5.4384, 6.4272, 7.4218]; - expected_v = [9.0000, 3.4336, 2.6333, 2.3278, 2.1673, 2.0682]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); -***** test - shape = 1:6; - [m, v] = wblstat (6, shape); - expected_m = [ 6.0000, 5.3174, 5.3579, 5.4384, 5.5090, 5.5663]; - expected_v = [36.0000, 7.7257, 3.7920, 2.3278, 1.5923, 1.1634]; - assert (m, expected_m, 0.001); - assert (v, expected_v, 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/expstat.m] ->>>>> /build/octave-statistics-1.4.2/inst/expstat.m -***** test - l = 1:6; - [m, v] = expstat (l); - assert (m, [1, 2, 3, 4, 5, 6], 0.001); - assert (v, [1, 4, 9, 16, 25, 36], 0.001); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/pdist.m] ->>>>> /build/octave-statistics-1.4.2/inst/pdist.m -***** shared xy, t, eucl - xy = [0 1; 0 2; 7 6; 5 6]; - t = 1e-3; - eucl = @(v,m) sqrt(sumsq(repmat(v,rows(m),1)-m,2)); -***** assert(pdist(xy), [1.000 8.602 7.071 8.062 6.403 2.000],t); -***** assert(pdist(xy,eucl), [1.000 8.602 7.071 8.062 6.403 2.000],t); -***** assert(pdist(xy,"euclidean"), [1.000 8.602 7.071 8.062 6.403 2.000],t); -***** assert(pdist(xy,"seuclidean"), [0.380 2.735 2.363 2.486 2.070 0.561],t); -***** assert(pdist(xy,"mahalanobis"),[1.384 1.967 2.446 2.384 1.535 2.045],t); -***** assert(pdist(xy,"cityblock"), [1.000 12.00 10.00 11.00 9.000 2.000],t); -***** assert(pdist(xy,"minkowski"), [1.000 8.602 7.071 8.062 6.403 2.000],t); -***** assert(pdist(xy,"minkowski",3),[1.000 7.763 6.299 7.410 5.738 2.000],t); -***** assert(pdist(xy,"cosine"), [0.000 0.349 0.231 0.349 0.231 0.013],t); -***** assert(pdist(xy,"correlation"),[0.000 2.000 0.000 2.000 0.000 2.000],t); -***** assert(pdist(xy,"spearman"), [0.000 2.000 0.000 2.000 0.000 2.000],t); -***** assert(pdist(xy,"hamming"), [0.500 1.000 1.000 1.000 1.000 0.500],t); -***** assert(pdist(xy,"jaccard"), [1.000 1.000 1.000 1.000 1.000 0.500],t); -***** assert(pdist(xy,"chebychev"), [1.000 7.000 5.000 7.000 5.000 2.000],t); -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/sigma_pts.m] ->>>>> /build/octave-statistics-1.4.2/inst/sigma_pts.m -***** demo - K = [1 0.5; 0.5 1]; # covaraince matrix - # calculate and build associated ellipse - [R,S,~] = svd (K); - theta = atan2 (R(2,1), R(1,1)); - v = sqrt (diag (S)); - v = v .* [cos(theta) sin(theta); -sin(theta) cos(theta)]; - t = linspace (0, 2*pi, 100).'; - xe = v(1,1) * cos (t) + v(2,1) * sin (t); - ye = v(1,2) * cos (t) + v(2,2) * sin (t); - - figure(1); clf; hold on - # Plot ellipse and axes - line ([0 0; v(:,1).'],[0 0; v(:,2).']) - plot (xe,ye,'-r'); - - col = 'rgb'; - l = [-1.8 -1 1.5]; - for li = 1:3 - p = sigma_pts (2, [], K, l(li)); - tmp = plot (p(2:end,1), p(2:end,2), ['x' col(li)], ... - p(1,1), p(1,2), ['o' col(li)]); - h(li) = tmp(1); - endfor - hold off - axis image - legend (h, arrayfun (@(x) sprintf ("l:%.2g", x), l, "unif", 0)); -***** test - p = sigma_pts (5); - assert (mean (p), zeros(1,5), sqrt(eps)); - assert (cov (p), eye(5), sqrt(eps)); -***** test - m = randn(1, 5); - p = sigma_pts (5, m); - assert (mean (p), m, sqrt(eps)); - assert (cov (p), eye(5), sqrt(eps)); -***** test - x = linspace (0,1,5); - K = exp (- (x.' - x).^2/ 0.5); - p = sigma_pts (5, [], K); - assert (mean (p), zeros(1,5), sqrt(eps)); - assert (cov (p), K, sqrt(eps)); -***** error sigma_pts(2,1); -***** error sigma_pts(2,[],1); -***** error sigma_pts(2,1,1); -***** error sigma_pts(2,[0.5 0.5],[-1 0; 0 0]); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/randsample.m] ->>>>> /build/octave-statistics-1.4.2/inst/randsample.m -***** test - n = 20; - k = 5; - x = randsample(n, k); - assert (size(x), [1 k]); - x = randsample(n, k, true); - assert (size(x), [1 k]); - x = randsample(n, k, false); - assert (size(x), [1 k]); - x = randsample(n, k, true, ones(n, 1)); - assert (size(x), [1 k]); - x = randsample(1:n, k); - assert (size(x), [1 k]); - x = randsample(1:n, k, true); - assert (size(x), [1 k]); - x = randsample(1:n, k, false); - assert (size(x), [1 k]); - x = randsample(1:n, k, true, ones(n, 1)); - assert (size(x), [1 k]); - x = randsample((1:n)', k); - assert (size(x), [k 1]); - x = randsample((1:n)', k, true); - assert (size(x), [k 1]); - x = randsample((1:n)', k, false); - assert (size(x), [k 1]); - x = randsample((1:n)', k, true, ones(n, 1)); - assert (size(x), [k 1]); - n = 10; - k = 100; - x = randsample(n, k, true, 1:n); - assert (size(x), [1 k]); - x = randsample((1:n)', k, true); - assert (size(x), [k 1]); - x = randsample(k, k, false, 1:k); - assert (size(x), [1 k]); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/tblwrite.m] ->>>>> /build/octave-statistics-1.4.2/inst/tblwrite.m -***** shared privpath - privpath = [fileparts(which('tblwrite')) filesep() 'private']; -***** test - addpath (privpath,'-end') - [d err] = tbl_delim (" "); - assert (d, " "); - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ("space"); - assert (d, " "); - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ("tab"); - assert (d, sprintf ("\t")); - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ("comma"); - assert (d, ","); - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ("semi"); - assert (d, ";"); - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ("bar"); - assert (d, "|"); - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ("x"); - assert (d, "x"); - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ('\r'); - assert (d, sprintf ('\r')) - assert (err, ""); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ("bars"); - assert (isnan (d)); - assert (! isempty (err)); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim (""); - assert (isnan (d)); - assert (! isempty (err)); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim (5); - assert (isnan (d)); - assert (! isempty (err)); - rmpath (privpath); -***** test - addpath (privpath,'-end') - [d err] = tbl_delim ({"."}); - assert (isnan (d)); - assert (! isempty (err)); - rmpath (privpath); -***** shared d, v, c, tempfilename - d = [1 2;3 4]; - v = ["a ";"bc"]; - c = ["de";"f "]; - tempfilename = tempname; -***** test - tblwrite (d, v, c, tempfilename); - [dt vt ct] = tblread (tempfilename, " "); - assert (dt, d); - assert (vt, v); - assert (ct, c); - delete (tempfilename); -***** test - tblwrite (d, v, c, tempfilename, " "); - [dt vt ct] = tblread (tempfilename, " "); - assert (dt, d); - assert (vt, v); - assert (ct, c); - delete (tempfilename); -***** test - tblwrite (d, v, c, tempfilename, "space"); - [dt vt ct] = tblread (tempfilename); - assert (dt, d); - assert (vt, v); - assert (ct, c); - delete (tempfilename); -***** test - tblwrite (d, v, c, tempfilename, "tab"); - [dt vt ct] = tblread (tempfilename, "tab"); - assert (dt, d); - assert (vt, v); - assert (ct, c); - delete (tempfilename); -***** test - tblwrite (d, v, c, tempfilename, "\t"); - [dt vt ct] = tblread (tempfilename, "\t"); - assert (dt, d); - assert (vt, v); - assert (ct, c); - delete (tempfilename); -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/geostat.m] ->>>>> /build/octave-statistics-1.4.2/inst/geostat.m -***** test - p = 1 ./ (1:6); - [m, v] = geostat (p); - assert (m, [0, 1, 2, 3, 4, 5], 0.001); - assert (v, [0, 2, 6, 12, 20, 30], 0.001); -1 test, 1 passed, 0 known failure, 0 skipped [inst/triinv.m] >>>>> /build/octave-statistics-1.4.2/inst/triinv.m ***** shared x,y @@ -7217,14 +7260,6 @@ ***** error triinv (2, 2, i, 2) ***** error triinv (2, 2, 2, i) 25 tests, 25 passed, 0 known failure, 0 skipped -[inst/chi2stat.m] ->>>>> /build/octave-statistics-1.4.2/inst/chi2stat.m -***** test - n = 1:6; - [m, v] = chi2stat (n); - assert (m, n); - assert (v, [2, 4, 6, 8, 10, 12], 0.001); -1 test, 1 passed, 0 known failure, 0 skipped Checking C++ files ... Summary: 2437 tests, 2434 passed, 0 known failures, 3 skipped dh_installdocs -O--buildsystem=octave @@ -7259,12 +7294,14 @@ dpkg-buildpackage: info: binary-only upload (no source included) dpkg-genchanges: info: not including original source code in upload I: copying local configuration +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/13458/tmp/hooks/B01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/22006 and its subdirectories -I: Current time: Mon Aug 14 21:00:48 -12 2023 -I: pbuilder-time-stamp: 1692090048 +I: removing directory /srv/workspace/pbuilder/13458 and its subdirectories +I: Current time: Tue Aug 15 23:22:25 +14 2023 +I: pbuilder-time-stamp: 1692091345