Diff of the two buildlogs: -- --- b1/build.log 2023-11-03 15:51:49.972498830 +0000 +++ b2/build.log 2023-11-03 16:16:13.554897548 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Fri Nov 3 03:24:43 -12 2023 -I: pbuilder-time-stamp: 1699025083 +I: Current time: Sat Nov 4 05:52:03 +14 2023 +I: pbuilder-time-stamp: 1699026723 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/bookworm-reproducible-base.tgz] I: copying local configuration @@ -16,7 +16,7 @@ I: copying [./octave-statistics_1.5.3.orig.tar.gz] I: copying [./octave-statistics_1.5.3-2.debian.tar.xz] I: Extracting source -gpgv: Signature made Wed Feb 8 18:48:48 2023 -12 +gpgv: Signature made Thu Feb 9 20:48:48 2023 +14 gpgv: using RSA key 3F464391498FE874BDB5D98F2124AA1983785C90 gpgv: issuer "rafael@debian.org" gpgv: Can't check signature: No public key @@ -29,135 +29,167 @@ dpkg-source: info: applying test-hygecdf-tolerance.patch I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/17228/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/27275/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 Nov 4 05:52 /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/27275/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/27275/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build/reproducible-path' - 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 parallel=3 ' - DISTRIBUTION='bookworm' - HOME='/root' - HOST_ARCH='armhf' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:. + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="2" [2]="15" [3]="1" [4]="release" [5]="arm-unknown-linux-gnueabihf") + BASH_VERSION='5.2.15(1)-release' + BUILDDIR=/build/reproducible-path + 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 parallel=4 ' + DIRSTACK=() + DISTRIBUTION=bookworm + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=arm + HOST_ARCH=armhf IFS=' ' - INVOCATION_ID='f68e4b30048342a9aacb9b89f87efd1d' - 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='17228' - PS1='# ' - PS2='> ' + INVOCATION_ID=1c993f7cd5df42468158cb20a66cd6ce + 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=27275 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.PMtu9glM/pbuilderrc_hyN5 --distribution bookworm --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/bookworm-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.PMtu9glM/b1 --logfile b1/build.log octave-statistics_1.5.3-2.dsc' - SUDO_GID='114' - SUDO_UID='110' - 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.PMtu9glM/pbuilderrc_ROjZ --distribution bookworm --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/bookworm-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.PMtu9glM/b2 --logfile b2/build.log octave-statistics_1.5.3-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 jtx1b 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-13-armmp-lpae #1 SMP Debian 6.1.55-1 (2023-09-29) armv7l GNU/Linux I: ls -l /bin total 4964 - -rwxr-xr-x 1 root root 838488 Apr 23 2023 bash - -rwxr-xr-x 3 root root 67144 Sep 18 2022 bunzip2 - -rwxr-xr-x 3 root root 67144 Sep 18 2022 bzcat - lrwxrwxrwx 1 root root 6 Sep 18 2022 bzcmp -> bzdiff - -rwxr-xr-x 1 root root 2225 Sep 18 2022 bzdiff - lrwxrwxrwx 1 root root 6 Sep 18 2022 bzegrep -> bzgrep - -rwxr-xr-x 1 root root 4893 Nov 27 2021 bzexe - lrwxrwxrwx 1 root root 6 Sep 18 2022 bzfgrep -> bzgrep - -rwxr-xr-x 1 root root 3775 Sep 18 2022 bzgrep - -rwxr-xr-x 3 root root 67144 Sep 18 2022 bzip2 - -rwxr-xr-x 1 root root 67112 Sep 18 2022 bzip2recover - lrwxrwxrwx 1 root root 6 Sep 18 2022 bzless -> bzmore - -rwxr-xr-x 1 root root 1297 Sep 18 2022 bzmore - -rwxr-xr-x 1 root root 67632 Sep 20 2022 cat - -rwxr-xr-x 1 root root 67676 Sep 20 2022 chgrp - -rwxr-xr-x 1 root root 67644 Sep 20 2022 chmod - -rwxr-xr-x 1 root root 67684 Sep 20 2022 chown - -rwxr-xr-x 1 root root 133532 Sep 20 2022 cp - -rwxr-xr-x 1 root root 132868 Jan 5 2023 dash - -rwxr-xr-x 1 root root 133220 Sep 20 2022 date - -rwxr-xr-x 1 root root 67732 Sep 20 2022 dd - -rwxr-xr-x 1 root root 68104 Sep 20 2022 df - -rwxr-xr-x 1 root root 133632 Sep 20 2022 dir - -rwxr-xr-x 1 root root 59128 Mar 22 2023 dmesg - lrwxrwxrwx 1 root root 8 Dec 19 2022 dnsdomainname -> hostname - lrwxrwxrwx 1 root root 8 Dec 19 2022 domainname -> hostname - -rwxr-xr-x 1 root root 67560 Sep 20 2022 echo - -rwxr-xr-x 1 root root 41 Jan 24 2023 egrep - -rwxr-xr-x 1 root root 67548 Sep 20 2022 false - -rwxr-xr-x 1 root root 41 Jan 24 2023 fgrep - -rwxr-xr-x 1 root root 55748 Mar 22 2023 findmnt - -rwsr-xr-x 1 root root 26208 Mar 22 2023 fusermount - -rwxr-xr-x 1 root root 128608 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 64220 Apr 9 2022 gzip - -rwxr-xr-x 1 root root 67032 Dec 19 2022 hostname - -rwxr-xr-x 1 root root 67720 Sep 20 2022 ln - -rwxr-xr-x 1 root root 35132 Mar 22 2023 login - -rwxr-xr-x 1 root root 133632 Sep 20 2022 ls - -rwxr-xr-x 1 root root 136808 Mar 22 2023 lsblk - -rwxr-xr-x 1 root root 67800 Sep 20 2022 mkdir - -rwxr-xr-x 1 root root 67764 Sep 20 2022 mknod - -rwxr-xr-x 1 root root 67596 Sep 20 2022 mktemp - -rwxr-xr-x 1 root root 38504 Mar 22 2023 more - -rwsr-xr-x 1 root root 38496 Mar 22 2023 mount - -rwxr-xr-x 1 root root 9824 Mar 22 2023 mountpoint - -rwxr-xr-x 1 root root 133532 Sep 20 2022 mv - lrwxrwxrwx 1 root root 8 Dec 19 2022 nisdomainname -> hostname - lrwxrwxrwx 1 root root 14 Apr 2 2023 pidof -> /sbin/killall5 - -rwxr-xr-x 1 root root 67608 Sep 20 2022 pwd - lrwxrwxrwx 1 root root 4 Apr 23 2023 rbash -> bash - -rwxr-xr-x 1 root root 67600 Sep 20 2022 readlink - -rwxr-xr-x 1 root root 67672 Sep 20 2022 rm - -rwxr-xr-x 1 root root 67600 Sep 20 2022 rmdir - -rwxr-xr-x 1 root root 14152 Jul 28 11:46 run-parts - -rwxr-xr-x 1 root root 133372 Jan 5 2023 sed - lrwxrwxrwx 1 root root 4 Jan 5 2023 sh -> dash - -rwxr-xr-x 1 root root 67584 Sep 20 2022 sleep - -rwxr-xr-x 1 root root 67644 Sep 20 2022 stty - -rwsr-xr-x 1 root root 50800 Mar 22 2023 su - -rwxr-xr-x 1 root root 67584 Sep 20 2022 sync - -rwxr-xr-x 1 root root 336764 Apr 6 2023 tar - -rwxr-xr-x 1 root root 9800 Jul 28 11:46 tempfile - -rwxr-xr-x 1 root root 133224 Sep 20 2022 touch - -rwxr-xr-x 1 root root 67548 Sep 20 2022 true - -rwxr-xr-x 1 root root 9768 Mar 22 2023 ulockmgr_server - -rwsr-xr-x 1 root root 22108 Mar 22 2023 umount - -rwxr-xr-x 1 root root 67572 Sep 20 2022 uname - -rwxr-xr-x 2 root root 2346 Apr 9 2022 uncompress - -rwxr-xr-x 1 root root 133632 Sep 20 2022 vdir - -rwxr-xr-x 1 root root 42608 Mar 22 2023 wdctl - lrwxrwxrwx 1 root root 8 Dec 19 2022 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 6460 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 8103 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/17228/tmp/hooks/D02_print_environment finished + -rwxr-xr-x 1 root root 838488 Apr 24 2023 bash + -rwxr-xr-x 3 root root 67144 Sep 19 2022 bunzip2 + -rwxr-xr-x 3 root root 67144 Sep 19 2022 bzcat + lrwxrwxrwx 1 root root 6 Sep 19 2022 bzcmp -> bzdiff + -rwxr-xr-x 1 root root 2225 Sep 19 2022 bzdiff + lrwxrwxrwx 1 root root 6 Sep 19 2022 bzegrep -> bzgrep + -rwxr-xr-x 1 root root 4893 Nov 28 2021 bzexe + lrwxrwxrwx 1 root root 6 Sep 19 2022 bzfgrep -> bzgrep + -rwxr-xr-x 1 root root 3775 Sep 19 2022 bzgrep + -rwxr-xr-x 3 root root 67144 Sep 19 2022 bzip2 + -rwxr-xr-x 1 root root 67112 Sep 19 2022 bzip2recover + lrwxrwxrwx 1 root root 6 Sep 19 2022 bzless -> bzmore + -rwxr-xr-x 1 root root 1297 Sep 19 2022 bzmore + -rwxr-xr-x 1 root root 67632 Sep 21 2022 cat + -rwxr-xr-x 1 root root 67676 Sep 21 2022 chgrp + -rwxr-xr-x 1 root root 67644 Sep 21 2022 chmod + -rwxr-xr-x 1 root root 67684 Sep 21 2022 chown + -rwxr-xr-x 1 root root 133532 Sep 21 2022 cp + -rwxr-xr-x 1 root root 132868 Jan 6 2023 dash + -rwxr-xr-x 1 root root 133220 Sep 21 2022 date + -rwxr-xr-x 1 root root 67732 Sep 21 2022 dd + -rwxr-xr-x 1 root root 68104 Sep 21 2022 df + -rwxr-xr-x 1 root root 133632 Sep 21 2022 dir + -rwxr-xr-x 1 root root 59128 Mar 23 2023 dmesg + lrwxrwxrwx 1 root root 8 Dec 20 2022 dnsdomainname -> hostname + lrwxrwxrwx 1 root root 8 Dec 20 2022 domainname -> hostname + -rwxr-xr-x 1 root root 67560 Sep 21 2022 echo + -rwxr-xr-x 1 root root 41 Jan 25 2023 egrep + -rwxr-xr-x 1 root root 67548 Sep 21 2022 false + -rwxr-xr-x 1 root root 41 Jan 25 2023 fgrep + -rwxr-xr-x 1 root root 55748 Mar 23 2023 findmnt + -rwsr-xr-x 1 root root 26208 Mar 23 2023 fusermount + -rwxr-xr-x 1 root root 128608 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 64220 Apr 10 2022 gzip + -rwxr-xr-x 1 root root 67032 Dec 20 2022 hostname + -rwxr-xr-x 1 root root 67720 Sep 21 2022 ln + -rwxr-xr-x 1 root root 35132 Mar 23 2023 login + -rwxr-xr-x 1 root root 133632 Sep 21 2022 ls + -rwxr-xr-x 1 root root 136808 Mar 23 2023 lsblk + -rwxr-xr-x 1 root root 67800 Sep 21 2022 mkdir + -rwxr-xr-x 1 root root 67764 Sep 21 2022 mknod + -rwxr-xr-x 1 root root 67596 Sep 21 2022 mktemp + -rwxr-xr-x 1 root root 38504 Mar 23 2023 more + -rwsr-xr-x 1 root root 38496 Mar 23 2023 mount + -rwxr-xr-x 1 root root 9824 Mar 23 2023 mountpoint + -rwxr-xr-x 1 root root 133532 Sep 21 2022 mv + lrwxrwxrwx 1 root root 8 Dec 20 2022 nisdomainname -> hostname + lrwxrwxrwx 1 root root 14 Apr 3 2023 pidof -> /sbin/killall5 + -rwxr-xr-x 1 root root 67608 Sep 21 2022 pwd + lrwxrwxrwx 1 root root 4 Apr 24 2023 rbash -> bash + -rwxr-xr-x 1 root root 67600 Sep 21 2022 readlink + -rwxr-xr-x 1 root root 67672 Sep 21 2022 rm + -rwxr-xr-x 1 root root 67600 Sep 21 2022 rmdir + -rwxr-xr-x 1 root root 14152 Jul 29 13:46 run-parts + -rwxr-xr-x 1 root root 133372 Jan 6 2023 sed + lrwxrwxrwx 1 root root 9 Nov 4 05:52 sh -> /bin/bash + -rwxr-xr-x 1 root root 67584 Sep 21 2022 sleep + -rwxr-xr-x 1 root root 67644 Sep 21 2022 stty + -rwsr-xr-x 1 root root 50800 Mar 23 2023 su + -rwxr-xr-x 1 root root 67584 Sep 21 2022 sync + -rwxr-xr-x 1 root root 336764 Apr 7 2023 tar + -rwxr-xr-x 1 root root 9800 Jul 29 13:46 tempfile + -rwxr-xr-x 1 root root 133224 Sep 21 2022 touch + -rwxr-xr-x 1 root root 67548 Sep 21 2022 true + -rwxr-xr-x 1 root root 9768 Mar 23 2023 ulockmgr_server + -rwsr-xr-x 1 root root 22108 Mar 23 2023 umount + -rwxr-xr-x 1 root root 67572 Sep 21 2022 uname + -rwxr-xr-x 2 root root 2346 Apr 10 2022 uncompress + -rwxr-xr-x 1 root root 133632 Sep 21 2022 vdir + -rwxr-xr-x 1 root root 42608 Mar 23 2023 wdctl + lrwxrwxrwx 1 root root 8 Dec 20 2022 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 6460 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 8103 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/27275/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -711,7 +743,7 @@ Get: 507 http://deb.debian.org/debian bookworm/main armhf dh-octave-autopkgtest all 1.2.7 [9364 B] Get: 508 http://deb.debian.org/debian bookworm/main armhf dh-octave all 1.2.7 [22.8 kB] Get: 509 http://deb.debian.org/debian bookworm/main armhf octave-io armhf 2.6.4-3 [198 kB] -Fetched 171 MB in 22s (7790 kB/s) +Fetched 171 MB in 5s (32.5 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package netbase. (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 ... 19288 files and directories currently installed.) @@ -2799,7 +2831,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/reproducible-path/octave-statistics-1.5.3/ && 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.5.3-2_source.changes +I: user script /srv/workspace/pbuilder/27275/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for bookworm +I: user script /srv/workspace/pbuilder/27275/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/reproducible-path/octave-statistics-1.5.3/ && 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.5.3-2_source.changes dpkg-buildpackage: info: source package octave-statistics dpkg-buildpackage: info: source version 1.5.3-2 dpkg-buildpackage: info: source distribution unstable @@ -2832,10 +2868,10 @@ octave --no-gui --no-history --silent --no-init-file --no-window-system /usr/share/dh-octave/install-pkg.m /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/lib/arm-linux-gnueabihf/octave/packages make[1]: Entering directory '/build/reproducible-path/octave-statistics-1.5.3/src' /usr/bin/mkoctfile --verbose libsvmread.cc -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security libsvmread.cc -o /tmp/oct-YOXhXz.o -g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o libsvmread.oct /tmp/oct-YOXhXz.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security libsvmread.cc -o /tmp/oct-XcB5fQ.o +g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o libsvmread.oct /tmp/oct-XcB5fQ.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro /usr/bin/mkoctfile --verbose libsvmwrite.cc -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security libsvmwrite.cc -o /tmp/oct-ACN6vc.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security libsvmwrite.cc -o /tmp/oct-WFn4Id.o libsvmwrite.cc: In function 'void write(std::string, ColumnVector, SparseMatrix)': libsvmwrite.cc:75:25: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'std::size_t' {aka 'unsigned int'} [-Wformat=] 75 | fprintf(fp ," %lu:%g", (size_t)ir[k]+1, samples[k]); @@ -2843,20 +2879,20 @@ | | | | long unsigned int std::size_t {aka unsigned int} | %u -g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o libsvmwrite.oct /tmp/oct-ACN6vc.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro +g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o libsvmwrite.oct /tmp/oct-WFn4Id.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro /usr/bin/mkoctfile --verbose svmpredict.cc svm.cpp svm_model_octave.cc -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svmpredict.cc -o /tmp/oct-bLHFsx.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm.cpp -o /tmp/oct-73fmiJ.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm_model_octave.cc -o /tmp/oct-fbFVKi.o -g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o svmpredict.oct /tmp/oct-bLHFsx.o /tmp/oct-73fmiJ.o /tmp/oct-fbFVKi.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svmpredict.cc -o /tmp/oct-I9UOgZ.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm.cpp -o /tmp/oct-TVdXvW.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm_model_octave.cc -o /tmp/oct-hJBXhU.o +g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o svmpredict.oct /tmp/oct-I9UOgZ.o /tmp/oct-TVdXvW.o /tmp/oct-hJBXhU.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro /usr/bin/mkoctfile --verbose svmtrain.cc svm.cpp svm_model_octave.cc -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svmtrain.cc -o /tmp/oct-c8R6Ps.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm.cpp -o /tmp/oct-xmeb79.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm_model_octave.cc -o /tmp/oct-93ZWEM.o -g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o svmtrain.oct /tmp/oct-c8R6Ps.o /tmp/oct-xmeb79.o /tmp/oct-93ZWEM.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svmtrain.cc -o /tmp/oct-nVudB7.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm.cpp -o /tmp/oct-cGEOiI.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security svm_model_octave.cc -o /tmp/oct-AzShKM.o +g++ -I/usr/include/octave-7.3.0/octave/.. -I/usr/include/octave-7.3.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-statistics-1.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -o svmtrain.oct /tmp/oct-nVudB7.o /tmp/oct-cGEOiI.o /tmp/oct-AzShKM.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/arm-linux-gnueabihf -shared -Wl,-Bsymbolic -Wl,-z,relro make[1]: Leaving directory '/build/reproducible-path/octave-statistics-1.5.3/src' copyfile /build/reproducible-path/octave-statistics-1.5.3/./src/libsvmread.oct /build/reproducible-path/octave-statistics-1.5.3/./src/libsvmwrite.oct /build/reproducible-path/octave-statistics-1.5.3/./src/svmpredict.oct /build/reproducible-path/octave-statistics-1.5.3/./src/svmtrain.oct /build/reproducible-path/octave-statistics-1.5.3/./src/libsvmread.cc-tst /build/reproducible-path/octave-statistics-1.5.3/./src/libsvmwrite.cc-tst /build/reproducible-path/octave-statistics-1.5.3/./src/svmpredict.cc-tst /build/reproducible-path/octave-statistics-1.5.3/./src/svmtrain.cc-tst /build/reproducible-path/octave-statistics-1.5.3/./inst/arm-unknown-linux-gnueabihf-api-v57 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/mean.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/std.m shadows a core library function warning: called from /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/PKG_ADD at line 11 column 3 doc_cache_create>gen_doc_cache_in_dir at line 146 column 5 @@ -2876,7 +2912,7 @@ pkg at line 612 column 9 /usr/share/dh-octave/install-pkg.m at line 38 column 1 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/var.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/mean.m shadows a core library function warning: called from /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/PKG_ADD at line 11 column 3 doc_cache_create>gen_doc_cache_in_dir at line 146 column 5 @@ -2886,7 +2922,7 @@ pkg at line 612 column 9 /usr/share/dh-octave/install-pkg.m at line 38 column 1 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/std.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/var.m shadows a core library function warning: called from /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/PKG_ADD at line 11 column 3 doc_cache_create>gen_doc_cache_in_dir at line 146 column 5 @@ -2896,7 +2932,7 @@ pkg at line 612 column 9 /usr/share/dh-octave/install-pkg.m at line 38 column 1 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/mean.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/std.m shadows a core library function warning: called from doc_cache_create>gen_doc_cache_in_dir at line 146 column 5 doc_cache_create at line 62 column 12 @@ -2914,7 +2950,7 @@ pkg at line 612 column 9 /usr/share/dh-octave/install-pkg.m at line 38 column 1 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/var.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/mean.m shadows a core library function warning: called from doc_cache_create>gen_doc_cache_in_dir at line 146 column 5 doc_cache_create at line 62 column 12 @@ -2923,7 +2959,7 @@ pkg at line 612 column 9 /usr/share/dh-octave/install-pkg.m at line 38 column 1 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/std.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/var.m shadows a core library function warning: called from doc_cache_create>gen_doc_cache_in_dir at line 146 column 5 doc_cache_create at line 62 column 12 @@ -2936,819 +2972,47 @@ dh_octave_check -O--buildsystem=octave Checking package... Checking m files ... -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/mean.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/std.m shadows a core library function warning: called from - /tmp/tmp.82E11Krx1T at line 12 column 1 + /tmp/tmp.vT34KPeaaR at line 12 column 1 warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/median.m shadows a core library function warning: called from - /tmp/tmp.82E11Krx1T at line 12 column 1 + /tmp/tmp.vT34KPeaaR at line 12 column 1 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/var.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/mean.m shadows a core library function warning: called from - /tmp/tmp.82E11Krx1T at line 12 column 1 + /tmp/tmp.vT34KPeaaR at line 12 column 1 -warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/std.m shadows a core library function +warning: function /build/reproducible-path/octave-statistics-1.5.3/debian/octave-statistics/usr/share/octave/packages/statistics-1.5.3/shadow9/var.m shadows a core library function warning: called from - /tmp/tmp.82E11Krx1T at line 12 column 1 + /tmp/tmp.vT34KPeaaR at line 12 column 1 -[inst/fillmissing.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/fillmissing.m -***** assert (fillmissing ([1 2 3], "constant", 99), [1 2 3]) -***** assert (fillmissing ([1 2 NaN], "constant", 99), [1 2 99]) -***** assert (fillmissing ([NaN 2 NaN], "constant", 99), [99 2 99]) -***** assert (fillmissing ([1 2 3]', "constant", 99), [1 2 3]') -***** assert (fillmissing ([1 2 NaN]', "constant", 99), [1 2 99]') -***** assert (fillmissing ([1 2 3; 4 5 6], "constant", 99), [1 2 3; 4 5 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "constant", 99), [1 2 99; 4 99 6]) -***** assert (fillmissing ([NaN 2 NaN; 4 NaN 6], "constant", [97, 98, 99]), [97 2 99; 4 98 6]) -***** test - x = cat (3, [1, 2, NaN; 4, NaN, 6], [NaN, 2, 3; 4, 5, NaN]); - y = cat (3, [1, 2, 99; 4, 99, 6], [99, 2, 3; 4, 5, 99]); - assert (fillmissing (x, "constant", 99), y); - y = cat (3, [1, 2, 96; 4, 95, 6], [97, 2, 3; 4, 5, 99]); - assert (fillmissing (x, "constant", [94:99]), y); - assert (fillmissing (x, "constant", [94:99]'), y); - assert (fillmissing (x, "constant", permute ([94:99], [1 3 2])), y); - assert (fillmissing (x, "constant", [94, 96, 98; 95, 97, 99]), y); - assert (fillmissing (x, "constant", [94:99], 1), y); - y = cat (3, [1, 2, 96; 4, 97, 6], [98, 2, 3; 4, 5, 99]); - assert (fillmissing (x, "constant", [96:99], 2), y); - y = cat (3, [1, 2, 98; 4, 97, 6], [94, 2, 3; 4, 5, 99]); - assert (fillmissing (x, "constant", [94:99], 3), y); - y = cat (3, [1, 2, 92; 4, 91, 6], [94, 2, 3; 4, 5, 99]); - assert (fillmissing (x, "constant", [88:99], 99), y); -***** test - x = reshape([1:24],4,3,2); - x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; - y = x; - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [94 95 95 96 96 97 97 98 99 99]; - assert (fillmissing (x, "constant", [94:99], 1), y); - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [92 93 94 92 95 97 99 98 97 98]; - assert (fillmissing (x, "constant", [92:99], 2), y); - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [88 93 94 96 99 89 91 94 97 98]; - assert (fillmissing (x, "constant", [88:99], 3), y); - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [76 81 82 84 87 89 91 94 97 98]; - assert (fillmissing (x, "constant", [76:99], 99), y); -***** assert (fillmissing ([1 2 3], "constant", 99, "endvalues", 88), [1 2 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", 88), [1 99 3]) -***** assert (fillmissing ([1 2 NaN], "constant", 99, "endvalues", 88), [1 2 88]) -***** assert (fillmissing ([NaN 2 3], "constant", 99, "endvalues", 88), [88 2 3]) -***** assert (fillmissing ([NaN NaN 3], "constant", 99, "endvalues", 88), [88 88 3]) -***** assert (fillmissing ([1 NaN NaN], "constant", 99, "endvalues", 88), [1 88 88]) -***** assert (fillmissing ([NaN 2 NaN], "constant", 99, "endvalues", 88), [88 2 88]) -***** assert (fillmissing ([NaN 2 NaN]', "constant", 99, "endvalues", 88), [88 2 88]') -***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 99, "endvalues", 88), [1 99 3 99 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "constant", 99, "endvalues", 88), [1 99 99 99 5]) -***** assert (fillmissing ([NaN NaN NaN NaN 5], "constant", 99, "endvalues", 88), [88 88 88 88 5]) -***** assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, "endvalues", 88), [1 99 3 4 88]) -***** assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, 1, "endvalues", 88), [1 88 3 4 88]) -***** assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, 1, "endvalues", "extrap"), [1 99 3 4 99]) -***** test - x = reshape ([1:24], 3, 4, 2); - y = x; - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y([1,2,5,6,10,13,16,18,19,20,21,22])= 88; y([8])=99; - assert (fillmissing (x, "constant", 99, "endvalues", 88), y); - assert (fillmissing (x, "constant", 99, 1, "endvalues", 88), y); - y = x; y([1,2,5,8,10,13,16,19,22])= 88; y([6,18,20,21])=99; - assert (fillmissing (x, "constant", 99, 2, "endvalues", 88), y); - y(y==99) = 88; - assert (fillmissing (x, "constant", 99, 3, "endvalues", 88), y); - assert (fillmissing (x, "constant", 99, 4, "endvalues", 88), y); - assert (fillmissing (x, "constant", 99, 99, "endvalues", 88), y); - y([8]) = 94; - assert (fillmissing (x, "constant", [92:99], 1, "endvalues", 88), y); - y([6,8,18,20,21]) = [96,88,99,98,99]; - assert (fillmissing (x, "constant", [94:99], 2, "endvalues", 88), y); - y = x; y(isnan(y)) = 88; - assert (fillmissing (x, "constant", [88:99], 3, "endvalues", 88), y); - y = x; y(isnan(y)) = [82,82,83,83,94,85,86,87,87,88,88,88,89]; - assert (fillmissing (x, "constant", [92:99], 1, "endvalues", [82:89]), y); - y = x; y(isnan(y)) = [84,85,85,96,85,84,87,87,99,87,98,99,87]; - assert (fillmissing (x, "constant", [94:99], 2, "endvalues", [84:89]), y); - y = x; y(isnan(y)) = [68,69,72,73,75,77,68,71,73,74,75,76,77]; - assert (fillmissing (x, "constant", [88:99], 3, "endvalues", [68:79]), y); - assert (fillmissing (x, "constant", [88:93;94:99]', 3, "endvalues", [68:73;74:79]'), y) -***** test - x = reshape([1:24],4,3,2); - x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; - y = x; - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [94 95 95 96 96 97 97 98 99 99]; - assert (fillmissing (x, "constant", [94:99], 1), y); - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [92 93 94 92 95 97 99 98 97 98]; - assert (fillmissing (x, "constant", [92:99], 2), y); - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [88 93 94 96 99 89 91 94 97 98]; - assert (fillmissing (x, "constant", [88:99], 3), y); - y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [76 81 82 84 87 89 91 94 97 98]; - assert (fillmissing (x, "constant", [76:99], 99), y); -***** assert (fillmissing ([1 2 3], "previous"), [1 2 3]) -***** assert (fillmissing ([1 2 3], "next"), [1 2 3]) -***** assert (fillmissing ([1 2 3]', "previous"), [1 2 3]') -***** assert (fillmissing ([1 2 3]', "next"), [1 2 3]') -***** assert (fillmissing ([1 2 NaN], "previous"), [1 2 2]) -***** assert (fillmissing ([1 2 NaN], "next"), [1 2 NaN]) -***** assert (fillmissing ([NaN 2 NaN], "previous"), [NaN 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "next"), [2 2 NaN]) -***** assert (fillmissing ([1 NaN 3], "previous"), [1 1 3]) -***** assert (fillmissing ([1 NaN 3], "next"), [1 3 3]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 1), [1 2 NaN; 4 2 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 2), [1 2 2; 4 4 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 3), [1 2 NaN; 4 NaN 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 1), [1 2 6; 4 NaN 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 2), [1 2 NaN; 4 6 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 3), [1 2 NaN; 4 NaN 6]) -***** test - x = reshape([1:24],4,3,2); - x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; - y = x; - y([1, 6, 7, 9, 14, 19, 22, 23]) = [2 8 8 10 15 20 24 24]; - assert (fillmissing (x, "next", 1), y); - y = x; - y([1, 6, 7, 14, 16]) = [5, 10, 11, 18, 20]; - assert (fillmissing (x, "next", 2), y); - y = x; - y([1, 6, 9, 12]) = [13 18 21 24]; - assert (fillmissing (x, "next", 3), y); - assert (fillmissing (x, "next", 99), x); - y = x; - y([6, 7, 12, 14, 16, 19, 22, 23]) = [5 5 11 13 15 18 21 21]; - assert (fillmissing (x, "previous", 1), y); - y = x; - y([6, 7, 9, 12, 19, 22, 23]) = [2 3 5 8 15 18 15]; - assert (fillmissing (x, "previous", 2), y); - y = x; - y([14, 16, 22, 23]) = [2 4 10 11]; - assert (fillmissing (x, "previous", 3), y); - assert (fillmissing (x, "previous", 99), x); -***** assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "previous"), [1 2 3]) -***** assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "next"), [1 2 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "previous"), [1 0 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "next"), [1 0 3]) -***** assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "previous"), [1 2 2]) -***** assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "next"), [1 2 NaN]) -***** assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "previous"), [1 1 1]) -***** assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "next"), [1 NaN NaN]) -***** assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "previous"), [NaN 2 3]) -***** assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "next"), [2 2 3]) -***** assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "previous"), [NaN NaN 3]) -***** assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "next"), [3 3 3]) -***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "previous"), [NaN NaN NaN]) -***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "next"), [NaN NaN NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "previous"), [NaN 2 0 4 4]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "next"), [2 2 0 4 NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "previous"), [NaN 2 NaN 4 NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "next"), [NaN 2 NaN 4 NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "previous"), [NaN 2 0 4 4]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "next"), [2 2 0 4 NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "previous"), [NaN 2 NaN 4 NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "next"), [NaN 2 NaN 4 NaN]) -***** test - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([5,6,8,18])=[4,4,0,17]; - assert (fillmissing (x, "constant", 0, "endvalues", "previous"), y); - assert (fillmissing (x, "constant", 0, 1, "endvalues", "previous"), y); - y = x; - y([6,10,18,20,21])=[0,7,0,0,0]; - assert (fillmissing (x, "constant", 0, 2, "endvalues", "previous"), y); - y = x; - y([16,19,21])=[4,7,9]; - assert (fillmissing (x, "constant", 0, 3, "endvalues", "previous"), y); - assert (fillmissing (x, "constant", 0, 4, "endvalues", "previous"), x); - assert (fillmissing (x, "constant", 0, 99, "endvalues", "previous"), x); - y = x; - y([1,2,8,10,13,16,22])=[3,3,0,11,14,17,23]; - assert (fillmissing (x, "constant", 0, "endvalues", "next"), y); - assert (fillmissing (x, "constant", 0, 1, "endvalues", "next"), y); - y = x; - y([1,2,5,6,8,18,20,21])=[4,11,11,0,11,0,0,0]; - assert (fillmissing (x, "constant", 0, 2, "endvalues", "next"), y); - y = x; - y([2,5])=[14,17]; - assert (fillmissing (x, "constant", 0, 3, "endvalues", "next"), y); - assert (fillmissing (x, "constant", 0, 4, "endvalues", "next"), x); - assert (fillmissing (x, "constant", 0, 99, "endvalues", "next"), x); -***** assert (fillmissing ([1 2 3], "nearest"), [1 2 3]) -***** assert (fillmissing ([1 2 3]', "nearest"), [1 2 3]') -***** assert (fillmissing ([1 2 NaN], "nearest"), [1 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "nearest"), [2 2 2]) -***** assert (fillmissing ([1 NaN 3], "nearest"), [1 3 3]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 1), [1 2 6; 4 2 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 2), [1 2 2; 4 6 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 3), [1 2 NaN; 4 NaN 6]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "nearest"), [1 3 3 5 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "nearest", "samplepoints", [0 1 2 3 4]), [1 3 3 5 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "nearest", "samplepoints", [0.5 1 2 3 5]), [1 1 3 3 5]) -***** test - x = reshape([1:24],4,3,2); - x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; - y = x; - y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [2 5 8 10 11 15 15 20 21 24]; - assert (fillmissing (x, "nearest", 1), y); - y = x; - y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [5 10 11 5 8 18 20 15 18 15]; - assert (fillmissing (x, "nearest", 2), y); - y = x; - y([1, 6, 9, 12, 14, 16, 22, 23]) = [13 18 21 24 2 4 10 11]; - assert (fillmissing (x, "nearest", 3), y); - assert (fillmissing (x, "nearest", 99), x); -***** assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "nearest"), [1 2 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "nearest"), [1 0 3]) -***** assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "nearest"), [1 2 2]) -***** assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "nearest"), [1 1 1]) -***** assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "nearest"), [2 2 3]) -***** assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "nearest"), [3 3 3]) -***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "nearest"), [NaN NaN NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "nearest"), [2 2 0 4 4]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "nearest"), [NaN 2 NaN 4 NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "nearest"), [2 2 0 4 4]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "nearest"), [NaN 2 NaN 4 NaN]) -***** test - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([1,2,5,6,8,10,13,16,18,22])=[3 3 4 4 0 11 14 17 17 23]; - assert (fillmissing (x, "constant", 0, "endvalues", "nearest"), y); - assert (fillmissing (x, "constant", 0, 1, "endvalues", "nearest"), y); - y = x; - y([1,2,5,6,8,10,18,20,21])=[4 11 11 0 11 7 0 0 0]; - assert (fillmissing (x, "constant", 0, 2, "endvalues", "nearest"), y); - y = x; - y([2,5,16,19,21])=[14 17 4 7 9]; - assert (fillmissing (x, "constant", 0, 3, "endvalues", "nearest"), y); - assert (fillmissing (x, "constant", 0, 99, "endvalues", "nearest"), x); -***** assert (fillmissing ([1 2 3], "linear"), [1 2 3]) -***** assert (fillmissing ([1 2 3]', "linear"), [1 2 3]') -***** assert (fillmissing ([1 2 NaN], "linear"), [1 2 3]) -***** assert (fillmissing ([NaN 2 NaN], "linear"), [NaN 2 NaN]) -***** assert (fillmissing ([1 NaN 3], "linear"), [1 2 3]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 1), [1 2 NaN; 4 NaN 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 2), [1 2 3; 4 5 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 3), [1 2 NaN; 4 NaN 6]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "linear"), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "linear", "samplepoints", [0 1 2 3 4]), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "linear", "samplepoints", [0 1.5 2 5 14]), [1 2.5 3 3.5 5], eps) -***** test - x = reshape([1:24],4,3,2); - x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; - assert (fillmissing (x, "linear", 1), reshape([1:24],4,3,2)); - y = reshape([1:24],4,3,2); - y([1 9 14 19 22 23]) = NaN; - assert (fillmissing (x, "linear", 2), y); - y = reshape([1:24],4,3,2); - y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; - assert (fillmissing (x, "linear", 3), y); - assert (fillmissing (x, "linear", 99), x); -***** assert (fillmissing ([1 2 3], "linear", "endvalues", 0), [1 2 3]) -***** assert (fillmissing ([1 NaN 3], "linear", "endvalues", 0), [1 2 3]) -***** assert (fillmissing ([1 2 NaN], "linear", "endvalues", 0), [1 2 0]) -***** assert (fillmissing ([1 NaN NaN], "linear", "endvalues", 0), [1 0 0]) -***** assert (fillmissing ([NaN 2 3], "linear", "endvalues", 0), [0 2 3]) -***** assert (fillmissing ([NaN NaN 3], "linear", "endvalues", 0), [0 0 3]) -***** assert (fillmissing ([NaN NaN NaN], "linear", "endvalues", 0), [0 0 0]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", "endvalues", 0), [0 2 3 4 0]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 1, "endvalues", 0), [0 2 0 4 0]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 2, "endvalues", 0), [0 2 3 4 0]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 3, "endvalues", 0), [0 2 0 4 0]) -***** test - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([1,2,5,6,10,13,16,18,19,20,21,22])=0; y(8)=8; - assert (fillmissing (x, "linear", "endvalues", 0), y); - assert (fillmissing (x, "linear", 1, "endvalues", 0), y); - y = x; - y([1,2,5,8,10,13,16,19,22])=0; y([6,18,20,21])=[6,18,20,21]; - assert (fillmissing (x, "linear", 2, "endvalues", 0), y); - y = x; - y(isnan(y))=0; - assert (fillmissing (x, "linear", 3, "endvalues", 0), y); - assert (fillmissing (x, "linear", 99, "endvalues", 0), y); -***** assert (fillmissing ([1 2 3], "constant", 99, "endvalues", "linear"), [1 2 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", "linear"), [1 99 3]) -***** assert (fillmissing ([1 NaN 3 NaN], "constant", 99, "endvalues", "linear"), [1 99 3 4]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear"), [1 2 99 4 5]) -***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 99, "endvalues", "linear"), [NaN 2 NaN NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear", "samplepoints", [1 2 3 4 5]), [1 2 99 4 5]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear", "samplepoints", [0 2 3 4 10]), [0 2 99 4 10]) - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([1,6,10,18,20,21]) = [2.5, 5, 8.5, 17.25, 21, 21.75]; - assert (fillmissing (x, "linear", 2, "samplepoints", [2 4 8 10]), y, eps); - y([1,6,10,18,20,21]) = [2.5, 4.5, 8.5, 17.25, 21.5, 21.75]; - assert (fillmissing (x, "spline", 2, "samplepoints", [2 4 8 10]), y, eps); - y([1,6,10,18,20,21]) = [2.5, 4.559386973180077, 8.5, 17.25, 21.440613026819925, 21.75]; - assert (fillmissing (x, "pchip", 2, "samplepoints", [2 4 8 10]), y, 10*eps); -***** test <60965> - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([1,6,10,18,20,21]) = [2.5, 4.609523809523809, 8.5, 17.25, 21.390476190476186, 21.75]; - assert (fillmissing (x, "makima", 2, "samplepoints", [2 4 8 10]), y, 10*eps); -!!!!! known bug: https://octave.org/testfailure/?60965 -interp1: invalid METHOD 'makima' -***** assert (fillmissing ([1 2 3], "constant", 99, "endvalues", "spline"), [1 2 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", "spline"), [1 99 3]) -***** assert (fillmissing ([1 NaN 3 NaN], "constant", 99, "endvalues", "spline"), [1 99 3 4]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline"), [1 2 99 4 5]) -***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 99, "endvalues", "spline"), [NaN 2 NaN NaN]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline", "samplepoints", [1 2 3 4 5]), [1 2 99 4 5]) -***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline", "samplepoints", [0 2 3 4 10]), [0 2 99 4 10]) -***** assert (fillmissing ([1 2 3], "movmean", 1), [1 2 3]) -***** assert (fillmissing ([1 2 NaN], "movmean", 1), [1 2 NaN]) -***** assert (fillmissing ([1 2 3], "movmean", 2), [1 2 3]) -***** assert (fillmissing ([1 2 3], "movmean", [1 0]), [1 2 3]) -***** assert (fillmissing ([1 2 3]', "movmean", 2), [1 2 3]') -***** assert (fillmissing ([1 2 NaN], "movmean", 2), [1 2 2]) -***** assert (fillmissing ([1 2 NaN], "movmean", [1 0]), [1 2 2]) -***** assert (fillmissing ([1 2 NaN], "movmean", [1 0]'), [1 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "movmean", 2), [NaN 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "movmean", [1 0]), [NaN 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "movmean", [0 1]), [2 2 NaN]) -***** assert (fillmissing ([NaN 2 NaN], "movmean", [0 1.1]), [2 2 NaN]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", [3 0]), [1 1 3 2 5]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 1), [1 2 6; 4 2 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 2), [1 2 2; 4 5 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 3), [1 2 NaN; 4 NaN 6]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99), [1 3 3 3 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99, 1), [1 NaN 3 NaN 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmean", 99, 1), [1 3 3 3 5]') -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99, 2), [1 3 3 3 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmean", 99, 2), [1 NaN 3 NaN 5]') -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1 1], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 4, "samplepoints", [1 2 3 4 5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [2 2], "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 4.0001, "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1 2 3 4 4.5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1.5 2 3 4 4.5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1 2 3 4 4.5]), [1 1 5 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1.5 2 3 4 4.5]), [1 1 3 5 5]) -***** test - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([2,5,8,10,13,16,18,22]) = [3,4,8,11,14,17,17,23]; - assert (fillmissing (x, "movmean", 3), y); - assert (fillmissing (x, "movmean", [1 1]), y); - assert (fillmissing (x, "movmean", 3, "endvalues", "extrap"), y); - assert (fillmissing (x, "movmean", 3, "samplepoints", [1 2 3]), y); - y = x; - y([1,6,8,10,18,20,21]) = [4,6,11,7,15,20,24]; - assert (fillmissing (x, "movmean", 3, 2), y); - assert (fillmissing (x, "movmean", [1 1], 2), y); - assert (fillmissing (x, "movmean", 3, 2, "endvalues", "extrap"), y); - assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [1 2 3 4]), y); - y([1,18]) = NaN; y(6) = 9; - assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [0 2 3 4]), y); - y = x; - y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = 8; - assert (fillmissing (x, "movmean", 3, "endvalues", 99), y); - y = x; - y([1,2,5,8,10,13,16,19,22]) = 99; y([6,18,20,21]) = [6,15,20,24]; - assert (fillmissing (x, "movmean", 3, 2, "endvalues", 99), y); -***** assert (fillmissing ([1 2 3], "movmedian", 1), [1 2 3]) -***** assert (fillmissing ([1 2 NaN], "movmedian", 1), [1 2 NaN]) -***** assert (fillmissing ([1 2 3], "movmedian", 2), [1 2 3]) -***** assert (fillmissing ([1 2 3], "movmedian", [1 0]), [1 2 3]) -***** assert (fillmissing ([1 2 3]', "movmedian", 2), [1 2 3]') -***** assert (fillmissing ([1 2 NaN], "movmedian", 2), [1 2 2]) -***** assert (fillmissing ([1 2 NaN], "movmedian", [1 0]), [1 2 2]) -***** assert (fillmissing ([1 2 NaN], "movmedian", [1 0]'), [1 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "movmedian", 2), [NaN 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "movmedian", [1 0]), [NaN 2 2]) -***** assert (fillmissing ([NaN 2 NaN], "movmedian", [0 1]), [2 2 NaN]) -***** assert (fillmissing ([NaN 2 NaN], "movmedian", [0 1.1]), [2 2 NaN]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", [3 0]), [1 1 3 2 5]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 1), [1 2 6; 4 2 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 2), [1 2 2; 4 5 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 3), [1 2 NaN; 4 NaN 6]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99), [1 3 3 3 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99, 1), [1 NaN 3 NaN 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmedian", 99, 1), [1 3 3 3 5]') -***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99, 2), [1 3 3 3 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmedian", 99, 2), [1 NaN 3 NaN 5]') -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1 1], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 4, "samplepoints", [1 2 3 4 5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [2 2], "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 4.0001, "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1 2 3 4 4.5]), [1 1 NaN 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 4.5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1 2 3 4 4.5]), [1 1 5 5 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1.5 2 3 4 4.5]), [1 1 3 5 5]) -***** test - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([2 5 8 10 13 16 18 22]) = [3 4 8 11 14 17 17 23]; - assert (fillmissing (x, "movmedian", 3), y); - assert (fillmissing (x, "movmedian", [1 1]), y); - assert (fillmissing (x, "movmedian", 3, "endvalues", "extrap"), y); - assert (fillmissing (x, "movmedian", 3, "samplepoints", [1 2 3]), y); - y = x; - y([1 6 8 10 18 20 21]) = [4 6 11 7 15 20 24]; - assert (fillmissing (x, "movmedian", 3, 2), y); - assert (fillmissing (x, "movmedian", [1 1], 2), y); - assert (fillmissing (x, "movmedian", 3, 2, "endvalues", "extrap"), y); - assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [1 2 3 4]), y); - y([1,18]) = NaN; y(6) = 9; - assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [0 2 3 4]), y); - y = x; - y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = 8; - assert (fillmissing (x, "movmedian", 3, "endvalues", 99), y); - y = x; - y([1,2,5,8,10,13,16,19,22]) = 99; y([6,18,20,21]) = [6,15,20,24]; - assert (fillmissing (x, "movmedian", 3, 2, "endvalues", 99), y); -***** assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, 2), [1 2 3]) -***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, 1), [1 2 NaN]) -***** assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, 2), [1 2 3]) -***** assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, [1 0]), [1 2 3]) -***** assert (fillmissing ([1 2 3]', @(x,y,z) x+y+z, 2), [1 2 3]') -***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, 2), [1 2 7]) -***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, [1 0]), [1 2 7]) -***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, [1 0]'), [1 2 7]) -***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, 2), [5 2 7]) -***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [1 0]), [NaN 2 7]) -***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [0 1]), [5 2 NaN]) -***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [0 1.1]), [5 2 NaN]) -***** assert (fillmissing ([1 2 NaN NaN 3 4], @(x,y,z) x+y+z, 2),[1 2 7 12 3 4]) -***** assert (fillmissing ([1 2 NaN NaN 3 4], @(x,y,z) x+y+z, 0.5),[1 2 NaN NaN 3 4]) -***** function A = testfcn (x,y,z) - if isempty (y) - A = z; - elseif (numel (y) == 1) - A = repelem (x(1), numel(z)); - else - A = interp1 (y, x, z, "linear","extrap"); - endif -***** endfunction -***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, [3 0]), [1 1 3 NaN 5]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 1), [1 2 6; 4 2 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 2), [1 2 2; 4 5 6]) -***** assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 3), [1 2 NaN; 4 NaN 6]) -***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 1), [1 NaN 3 NaN 5]) ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5] -***** assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 1), [1 2 3 4 5]') -***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 2), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 2), [1 NaN 3 NaN 5]') ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5]' -***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 3), [1 NaN 3 NaN 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 3), [1 NaN 3 NaN 5]') -***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 3, "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [1 1], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 4, "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [2 2], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) -***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 3, "samplepoints", [1 2 2.5 3 3.5]), [1 2.6 3.4 4.2 5], 10*eps) -***** assert (fillmissing ([NaN NaN 3 NaN 5], @testfcn, 99, 1), [NaN NaN 3 NaN 5]) ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5] -***** test -***** function A = testfcn (x,y,z) - if isempty (y) - A = z; - elseif (numel (y) == 1) - A = repelem (x(1), numel(z)); - else - A = interp1 (y, x, z, "linear","extrap"); - endif -***** endfunction - x = reshape ([1:24], 3, 4, 2); - x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; - y = x; - y([1,2,5,6,8,10,13,16,18,22]) = [3,3,4,4,8,11,14,17,17,23]; - assert (fillmissing (x, @testfcn, 3), y); - assert (fillmissing (x, @testfcn, [1 1]), y); - assert (fillmissing (x, @testfcn, 3, "endvalues", "extrap"), y); - assert (fillmissing (x, @testfcn, 3, "samplepoints", [1 2 3]), y); - y= x; - y(isnan(x)) = 99; y(8) = 8; - assert (fillmissing (x, @testfcn, 3, "endvalues", 99), y) - y = x; - y([1,2,5,6,8,10,18,20,21]) = [4,11,11,6,11,7,18,20,21]; - assert (fillmissing (x, @testfcn, 3, 2), y); - assert (fillmissing (x, @testfcn, [1 1], 2), y); - assert (fillmissing (x, @testfcn, 3, 2, "endvalues", "extrap"), y); - assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [1 2 3 4]), y); - y(1) = NaN; y([6,18,21]) = [9,24,24]; - assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [0 2 3 4]), y); - y = x; - y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = [8]; - assert (fillmissing (x, @testfcn, 3, "endvalues", 99), y); - y([6,18,20,21]) = [6,18,20,21]; y(8)=99; - assert (fillmissing (x, @testfcn, 3, 2, "endvalues", 99), y); - y([6,18,20,21]) = 99; - assert (fillmissing (x, @testfcn, 3, 3, "endvalues", 99), y); -***** assert (fillmissing ([1 2 3], "constant", 0, "maxgap", 1), [1 2 3]) -***** assert (fillmissing ([1 2 3], "constant", 0, "maxgap", 99), [1 2 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 1), [1 NaN 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 1.999), [1 NaN 3]) -***** assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 2), [1 0 3]) -***** assert (fillmissing ([1 NaN NaN 4], "constant", 0, "maxgap", 2), [1 NaN NaN 4]) -***** assert (fillmissing ([1 NaN NaN 4], "constant", 0, "maxgap", 3), [1 0 0 4]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2), [1 0 3 0 5]) -***** assert (fillmissing ([NaN 2 NaN], "constant", 0, "maxgap", 0.999), [NaN 2 NaN]) -***** assert (fillmissing ([NaN 2 NaN], "constant", 0, "maxgap", 1), [0 2 0]) -***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 0, "maxgap", 1), [0 2 NaN NaN]) -***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 0, "maxgap", 2), [0 2 0 0]) -***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 1), [NaN NaN NaN]) -***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 3), [NaN NaN NaN]) -***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 999), [NaN NaN NaN]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2, "samplepoints", [0 1 2 3 5]), [1 0 3 NaN 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5]', "constant", 0, "maxgap", 2, "samplepoints", [0 1 2 3 5]), [1 0 3 NaN 5]') -***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2, "samplepoints", [0 2 3 4 5]), [1 NaN 3 0 5]) -***** assert (fillmissing ([1 NaN 3 NaN 5; 1 NaN 3 NaN 5], "constant", 0, 2, "maxgap", 2, "samplepoints", [0 2 3 4 5]), [1 NaN 3 0 5; 1 NaN 3 0 5]) -***** test - x = cat (3, [1, 2, NaN; 4, NaN, NaN], [NaN, 2, 3; 4, 5, NaN]); - assert (fillmissing (x, "constant", 0, "maxgap", 0.1), x); - y = x; - y([4,7,12]) = 0; - assert (fillmissing (x, "constant", 0, "maxgap", 1), y); - assert (fillmissing (x, "constant", 0, 1, "maxgap", 1), y); - y = x; - y([5,7,12]) = 0; - assert (fillmissing (x, "constant", 0, 2, "maxgap", 1), y); - y = x; - y([4,5,7]) = 0; - assert (fillmissing (x, "constant", 0, 3, "maxgap", 1), y); -***** test - x = cat (3, [1, 2, NaN; 4, NaN, NaN], [NaN, 2, 3; 4, 5, NaN]); - [~, idx] = fillmissing (x, "constant", 0, "maxgap", 1); - assert (idx, logical (cat (3, [0 0 0; 0 1 0], [1 0 0; 0 0 1]))); - [~, idx] = fillmissing (x, "constant", 0, 1, "maxgap", 1); - assert (idx, logical (cat (3, [0 0 0; 0 1 0], [1 0 0; 0 0 1]))); - [~, idx] = fillmissing (x, "constant", 0, 2, "maxgap", 1); - assert (idx, logical (cat (3, [0 0 1; 0 0 0], [1 0 0; 0 0 1]))); - [~, idx] = fillmissing (x, "constant", 0, 3, "maxgap", 1); - assert (idx, logical (cat (3, [0 0 1; 0 1 0], [1 0 0; 0 0 0]))); -***** test - x = [NaN, 2, 3]; - [~,idx] = fillmissing (x, "previous"); - assert (idx, logical ([0 0 0])); - [~,idx] = fillmissing (x, "movmean", 1); - assert (idx, logical ([0 0 0])); - x = [1:3;4:6;7:9]; - x([2,4,7,9]) = NaN; - [~,idx] = fillmissing (x, "linear"); - assert (idx, logical ([0 1 0;1 0 0;0 0 0])); - [~,idx] = fillmissing (x, "movmean", 2); - assert (idx, logical ([0 0 0;1 0 0;0 0 1])); - [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmean',2); - assert (A, [1 2 3 3 NaN]); - assert (idx, logical([0 0 0 1 0])); - [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmean',3); - assert (A, [1 2 3 3 NaN]); - assert (idx, logical([0 0 0 1 0])); - [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 2); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmedian', 3); - assert (A, [1 2 3 3 NaN]); - assert (idx, logical([0 0 0 1 0])); - [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) z, 3); - assert (A, [1 2 1 4 1]); - assert (idx, logical([0 1 0 1 0])); - [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) NaN (size (z)), 3); - assert (A, [1 NaN 1 NaN 1]); - assert (idx, logical([0 0 0 0 0])); -***** assert (fillmissing ([1 2 3], "constant", 99, "missinglocations", logical([0 0 0])), [1 2 3]) -***** assert (fillmissing ([1 2 3], "constant", 99, "missinglocations", logical([1 1 1])), [99 99 99]) -***** assert (fillmissing ([1 NaN 2 3 NaN], "constant", 99, "missinglocations", logical([1 0 1 0 1])), [99 NaN 99 3 99]) -***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", NaN, "missinglocations", logical([0 1 1 1 0])), [1 NaN NaN NaN 5]) -***** assert (fillmissing (["foo ";" bar"], "constant", 'X', "missinglocations", logical([0 0 0 0; 0 0 0 0])), ["foo ";" bar"]) -***** assert (fillmissing (["foo ";" bar"], "constant", 'X', "missinglocations", logical([1 0 1 0; 0 1 1 0])), ["XoX ";" XXr"]) -***** assert (fillmissing ({"foo","", "bar"}, "constant", 'X', "missinglocations", logical([0 0 0])), {"foo","", "bar"}) -***** assert (fillmissing ({"foo","", "bar"}, "constant", 'X', "missinglocations", logical([1 1 0])), {"X","X","bar"}) -***** test - [~,idx] = fillmissing ([1 NaN 3 NaN 5], "constant", NaN); - assert (idx, logical([0 0 0 0 0])); - [~,idx] = fillmissing ([1 NaN 3 NaN 5], "constant", NaN, "missinglocations", logical([0 1 1 1 0])); - assert (idx, logical([0 1 1 1 0])); - [A, idx] = fillmissing ([1 2 NaN 1 NaN], 'movmean', 3.1, 'missinglocations', logical([0 0 1 1 0])); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmean', 2, 'missinglocations', logical([0 0 1 1 0])); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 2 NaN 1 NaN], 'movmean', 3, 'missinglocations', logical([0 0 1 1 0])); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmean', 3, 'missinglocations', logical([0 0 1 1 0])); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 2, 'missinglocations', logical([0 0 1 1 0])); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 3, 'missinglocations', logical([0 0 1 1 0])); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 3.1, 'missinglocations', logical([0 0 1 1 0])); - assert (A, [1 2 2 NaN NaN]); - assert (idx, logical([0 0 1 0 0])); - [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) ones (size (z)), 3, "missinglocations", logical([0 1 0 1 1])); - assert (A, [1 1 1 1 1]); - assert (idx, logical([0 1 0 1 1])); - [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) NaN (size (z)), 3, "missinglocations", logical([0 1 0 1 1])); - assert (A, [1 NaN 1 NaN NaN]); - assert (idx, logical([0 0 0 0 0])); -***** assert (fillmissing (' foo bar ', "constant", 'X'), 'XfooXbarX') -***** assert (fillmissing ([' foo';'bar '], "constant", 'X'), ['Xfoo';'barX']) -***** assert (fillmissing ([' foo';'bar '], "next"), ['bfoo';'bar ']) -***** assert (fillmissing ([' foo';'bar '], "next", 1), ['bfoo';'bar ']) -***** assert (fillmissing ([' foo';'bar '], "previous"), [' foo';'baro']) -***** assert (fillmissing ([' foo';'bar '], "previous", 1), [' foo';'baro']) -***** assert (fillmissing ([' foo';'bar '], "nearest"), ['bfoo';'baro']) -***** assert (fillmissing ([' foo';'bar '], "nearest", 1), ['bfoo';'baro']) -***** assert (fillmissing ([' foo';'bar '], "next", 2), ['ffoo';'bar ']) -***** assert (fillmissing ([' foo';'bar '], "previous", 2), [' foo';'barr']) -***** assert (fillmissing ([' foo';'bar '], "nearest", 2), ['ffoo';'barr']) -***** assert (fillmissing ([' foo';'bar '], "next", 3), [' foo';'bar ']) -***** assert (fillmissing ([' foo';'bar '], "previous", 3), [' foo';'bar ']) -***** assert (fillmissing ([' foo';'bar '], "nearest", 3), [' foo';'bar ']) -***** assert (fillmissing ({'foo','bar'}, "constant", 'a'), {'foo','bar'}) -***** assert (fillmissing ({'foo','bar'}, "constant", {'a'}), {'foo','bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "constant", 'a'), {'foo', 'a', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "constant", {'a'}), {'foo', 'a', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "previous"), {'foo', 'foo', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "next"), {'foo', 'bar', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "nearest"), {'foo', 'bar', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "previous", 2), {'foo', 'foo', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "next", 2), {'foo', 'bar', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "nearest", 2), {'foo', 'bar', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "previous", 1), {'foo', '', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "previous", 1), {'foo', '', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "next", 1), {'foo', '', 'bar'}) -***** assert (fillmissing ({'foo', '', 'bar'}, "nearest", 1), {'foo', '', 'bar'}) -***** assert (fillmissing ("abc ", @(x,y,z) x+y+z, 2), "abcj") -***** assert (fillmissing ({'foo', '', 'bar'}, @(x,y,z) x(1), 3), {'foo','foo','bar'}) -***** test - [A, idx] = fillmissing (" a b c", "constant", " "); - assert (A, " a b c"); - assert (idx, logical([0 0 0 0 0 0])); - [A, idx] = fillmissing ({"foo", "", "bar", ""}, "constant", ""); - assert (A, {"foo", "", "bar", ""}); - assert (idx, logical([0 0 0 0])); - [A, idx] = fillmissing ({"foo", "", "bar", ""}, "constant", {""}); - assert (A, {"foo", "", "bar", ""}); - assert (idx, logical([0 0 0 0])); - [A,idx] = fillmissing (' f o o ', @(x,y,z) repelem ("a", numel (z)), 3); - assert (A, "afaoaoa"); - assert (idx, logical([1 0 1 0 1 0 1])); - [A,idx] = fillmissing (' f o o ', @(x,y,z) repelem (" ", numel (z)), 3); - assert (A, " f o o "); - assert (idx, logical([0 0 0 0 0 0 0])); - [A,idx] = fillmissing ({'','foo',''}, @(x,y,z) repelem ({'a'}, numel (z)), 3); - assert (A, {'a','foo','a'}); - assert (idx, logical([1 0 1])); - [A,idx] = fillmissing ({'','foo',''}, @(x,y,z) repelem ({''}, numel (z)), 3); - assert (A, {'','foo',''}); - assert (idx, logical([0 0 0])); -***** assert (fillmissing (logical ([1 0 1 0 1]), "constant", true), logical ([1 0 1 0 1])) -***** assert (fillmissing (logical ([1 0 1 0 1]), "constant", false, 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) -***** assert (fillmissing (logical ([1 0 1 0 1]), "previous", 'missinglocations', logical([1 0 1 0 1])), logical ([1 0 0 0 0])) -***** assert (fillmissing (logical ([1 0 1 0 1]), "next", 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 1])) -***** assert (fillmissing (logical ([1 0 1 0 1]), "nearest", 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) -***** assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), 3), logical ([1 0 1 0 1])) -***** assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), 3, 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) -***** assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), [2 0], 'missinglocations', logical([1 0 1 0 1])), logical ([1 0 0 0 0])) -***** test - x = logical ([1 0 1 0 1]); - [~,idx] = fillmissing (x, "constant", true); - assert (idx, logical([0 0 0 0 0])); - [~,idx] = fillmissing (x, "constant", false, 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 1])); - [~,idx] = fillmissing (x, "constant", true, 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 1])); - [~,idx] = fillmissing (x, "previous", 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([0 0 1 0 1])); - [~,idx] = fillmissing (x, "next", 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 0])); - [~,idx] = fillmissing (x, "nearest", 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 1])); - [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), 3); - assert (idx, logical ([0 0 0 0 0])) - [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), 3, 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical ([1 0 1 0 1])) - [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), [2 0], 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical ([0 0 1 0 1])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), "constant", 0), int32 ([1 2 3 4 5])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), "constant", 0,'missinglocations', logical([1 0 1 0 1])), int32 ([0 2 0 4 0])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), "previous", 'missinglocations', logical([1 0 1 0 1])), int32 ([1 2 2 4 4])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), "next", 'missinglocations', logical([1 0 1 0 1])), int32 ([2 2 4 4 5])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), "nearest", 'missinglocations', logical([1 0 1 0 1])), int32 ([2 2 4 4 4])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, 3), int32 ([1 2 3 4 5])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, 3, 'missinglocations', logical([1 0 1 0 1])), int32 ([11 2 13 4 15])) -***** assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, [2 0], 'missinglocations', logical([1 0 1 0 1])), int32 ([1 2 13 4 15])) -***** test - x = int32 ([1 2 3 4 5]); - [~,idx] = fillmissing (x, "constant", 0); - assert (idx, logical([0 0 0 0 0])); - [~,idx] = fillmissing (x, "constant", 0, 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 1])); - [~,idx] = fillmissing (x, "constant", 3, 'missinglocations', logical([0 0 1 0 0])); - assert (idx, logical([0 0 1 0 0])); - [~,idx] = fillmissing (x, "previous", 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([0 0 1 0 1])); - [~,idx] = fillmissing (x, "next", 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 0])); - [~,idx] = fillmissing (x, "nearest", 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 1])); - [~,idx] = fillmissing (x, @(x,y,z) z+10, 3); - assert (idx, logical([0 0 0 0 0])); - [~,idx] = fillmissing (x, @(x,y,z) z+10, 3, 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([1 0 1 0 1])); - [~,idx] = fillmissing (x, @(x,y,z) z+10, [2 0], 'missinglocations', logical([1 0 1 0 1])); - assert (idx, logical([0 0 1 0 1])); -***** test - [A, idx] = fillmissing ([struct struct], "constant", 1); - assert (A, [struct struct]) - assert (idx, [false false]) -***** error fillmissing () -***** error fillmissing (1) -***** error fillmissing (1,2,3,4,5,6,7,8,9,10,11,12,13) -***** error fillmissing (1, 2) -***** error fillmissing (1, "foo") -***** error fillmissing (1, @(x) x, 1) -***** error fillmissing (1, @(x,y) x+y, 1) -***** error fillmissing ("a b c", "linear") -***** error fillmissing ({'a','b'}, "linear") -***** error <'movmean' and 'movmedian' methods only valid for numeric> fillmissing ("a b c", "movmean", 2) -***** error <'movmean' and 'movmedian' methods only valid for numeric> fillmissing ({'a','b'}, "movmean", 2) -***** error <'constant' method must be followed by> fillmissing (1, "constant") -***** error fillmissing (1, "constant", []) -***** error fillmissing (1, "constant", "a") -***** error fillmissing ("a", "constant", 1) -***** error fillmissing ("a", "constant", {"foo"}) -***** error fillmissing ({"foo"}, "constant", 1) -***** error fillmissing (1, "movmean") -***** error fillmissing (1, "movmedian") -***** error fillmissing (1, "constant", 1, 0) -***** error fillmissing (1, "constant", 1, -1) -***** error fillmissing (1, "constant", 1, [1 2]) -***** error fillmissing (1, "constant", 1, "samplepoints") -***** error fillmissing (1, "constant", 1, "foo") -***** error fillmissing (1, "constant", 1, 1, "foo") -***** error fillmissing (1, "constant", 1, 2, {1}, 4) -***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [1 2]) -***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [3 1 2]) -***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [1 1 2]) -***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", "abc") -***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", logical([1 1 1])) -***** error fillmissing ([1 2 3], "constant", 1, 1, "samplepoints", [1 2 3]) -***** error fillmissing ('foo', "next", "endvalues", 1) -***** error fillmissing (1, "constant", 1, 1, "endvalues", "foo") -***** error fillmissing ([1 2 3], "constant", 1, 2, "endvalues", [1 2 3]) -***** error fillmissing ([1 2 3], "constant", 1, 1, "endvalues", [1 2]) -***** error fillmissing (randi(5,4,3,2), "constant", 1, 3, "endvalues", [1 2]) -***** error fillmissing (1, "constant", 1, 1, "endvalues", {1}) -***** error fillmissing (1, "constant", 1, 2, "foo", 4) -***** error fillmissing (struct, "constant", 1, "missinglocations", false) -***** error fillmissing (1, "constant", 1, 2, "maxgap", 1, "missinglocations", false) -***** error fillmissing (1, "constant", 1, 2, "missinglocations", false, "maxgap", 1) -***** error fillmissing (1, "constant", 1, "replacevalues", true) -***** error fillmissing (1, "constant", 1, "datavariables", 'Varname') -***** error fillmissing (1, "constant", 1, 2, "missinglocations", 1) -***** error fillmissing (1, "constant", 1, 2, "missinglocations", 'a') -***** error fillmissing (1, "constant", 1, 2, "missinglocations", [true false]) -***** error fillmissing (true, "linear", "missinglocations", true) -***** error fillmissing (int8(1), "linear", "missinglocations", true) -***** error fillmissing (true, "next", "missinglocations", true, "EndValues", "linear") -***** error fillmissing (true, "next", "EndValues", "linear", "missinglocations", true) -***** error fillmissing (int8(1), "next", "missinglocations", true, "EndValues", "linear") -***** error fillmissing (int8(1), "next", "EndValues", "linear", "missinglocations", true) -***** error fillmissing (1, "constant", 1, 2, "maxgap", true) -***** error fillmissing (1, "constant", 1, 2, "maxgap", 'a') -***** error fillmissing (1, "constant", 1, 2, "maxgap", [1 2]) -***** error fillmissing (1, "constant", 1, 2, "maxgap", 0) -***** error fillmissing (1, "constant", 1, 2, "maxgap", -1) -***** error fillmissing ([1 2 3], "constant", [1 2 3]) -***** error fillmissing ([1 2 3]', "constant", [1 2 3]) -***** error fillmissing ([1 2 3]', "constant", [1 2 3], 1) -***** error fillmissing ([1 2 3], "constant", [1 2 3], 2) -***** error fillmissing (randi(5,4,3,2), "constant", [1 2], 1) -***** error fillmissing (randi(5,4,3,2), "constant", [1 2], 2) -***** error fillmissing (randi(5,4,3,2), "constant", [1 2], 3) -***** error fillmissing (1, @(x,y,z) x+y+z) -***** error fillmissing ([1 NaN 2], @(x,y,z) [1 2], 2) -378 tests, 377 passed, 0 known failure, 1 skipped -[inst/confusionchart.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/confusionchart.m +[inst/gscatter.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gscatter.m +***** demo + load fisheriris; + X = meas(:,3:4); + cidcs = kmeans (X, 3, "Replicates", 5); + gscatter (X(:,1), X(:,2), cidcs, [.75 .75 0; 0 .75 .75; .75 0 .75], "os^"); + title ("Fisher's iris data"); +***** error gscatter(); +***** error gscatter([1]); +***** error gscatter([1], [2]); +***** error gscatter('abc', [1 2 3], [1]); +***** error gscatter([1 2 3], [1 2], [1]); +***** error gscatter([1 2 3], 'abc', [1]); +***** error gscatter([1 2], [1 2], [1]); +***** error gscatter([1 2], [1 2], [1 2], 'rb', 'so', 12, 'xxx'); ***** shared visibility_setting visibility_setting = get (0, "DefaultFigureVisible"); ***** test set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ()", "Invalid call"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 1; 2 2; 3 3])", "invalid argument"); + load fisheriris; + X = meas(:,3:4); + cidcs = kmeans (X, 3, "Replicates", 5); + gscatter (X(:,1), X(:,2), cidcs, [.75 .75 0; 0 .75 .75; .75 0 .75], "os^"); + title ("Fisher's iris data"); set (0, "DefaultFigureVisible", visibility_setting); warning: using the gnuplot graphics toolkit is discouraged @@ -3760,2374 +3024,188 @@ example, if the plot window is closed with a mouse click, Octave will not be notified and will not update its internal list of open figure windows. The qt toolkit is recommended instead. -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'xxx', 1)", "invalid property"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'XLabel', 1)", "XLabel .* string"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'YLabel', [1 0])", ".* YLabel .* string"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'Title', .5)", ".* Title .* string"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'FontName', [])", ".* FontName .* string"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'FontSize', 'b')", ".* FontSize .* numeric"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'DiagonalColor', 'h')", ".* DiagonalColor .* color"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'OffDiagonalColor', [])", ".* OffDiagonalColor .* color"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'Normalization', '')", ".* invalid .* Normalization"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'ColumnSummary', [])", ".* invalid .* ColumnSummary"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'RowSummary', 1)", ".* invalid .* RowSummary"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'GridVisible', .1)", ".* invalid .* GridVisible"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'HandleVisibility', .1)", ".* invalid .* HandleVisibility"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'OuterPosition', .1)", ".* invalid .* OuterPosition"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'Position', .1)", ".* invalid .* Position"); - set (0, "DefaultFigureVisible", visibility_setting); -***** xtest - set (0, "DefaultFigureVisible", "off"); - fail ("confusionchart ([1 2], [0 1], 'Units', .1)", ".* invalid .* Units"); - set (0, "DefaultFigureVisible", visibility_setting); -***** demo "Setting the chart properties" - Yt = [8 5 6 8 5 3 1 6 4 2 5 3 1 4]'; - Yp = [8 5 6 8 5 2 3 4 4 5 5 7 2 6]'; - confusionchart (Yt, Yp, "Title", ... - "Demonstration with summaries","Normalization",... - "absolute","ColumnSummary", "column-normalized","RowSummary",... - "row-normalized") -***** demo "Cellstr as inputs" - Yt = {'Positive', 'Positive', 'Positive', 'Negative', 'Negative' }; - Yp = {'Positive', 'Positive', 'Negative', 'Negative', 'Negative' }; - m = confusionmat ( Yt, Yp ); - confusionchart ( m, { 'Positive', 'Negative' } ); -***** demo "Editing the object properties" - Yt = {'Positive', 'Positive', 'Positive', 'Negative', 'Negative' }; - Yp = {'Positive', 'Positive', 'Negative', 'Negative', 'Negative' }; - cm = confusionchart ( Yt, Yp ); - cm.Title = "This is an example with a green diagonal"; - cm.DiagonalColor = [0.4660, 0.6740, 0.1880]; -***** demo "Confusion chart in a uipanel" - h = uipanel (); - Yt = {'Positive', 'Positive', 'Positive', 'Negative', 'Negative' }; - Yp = {'Positive', 'Positive', 'Negative', 'Negative', 'Negative' }; - cm = confusionchart ( h, Yt, Yp ); -***** demo "Sorting classes" - Yt = [8 5 6 8 5 3 1 6 4 2 5 3 1 4]'; - Yp = [8 5 6 8 5 2 3 4 4 5 5 7 2 6]'; - cm = confusionchart (Yt, Yp, "Title", ... - "Classes are sorted according to clusters"); - sortClasses (cm, "cluster"); -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/pdist2.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/geostat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/chi2stat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/anova2.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/anova2.m -***** demo - - # Factorial (Crossed) Two-way ANOVA with Interaction - - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - - [p, atab, stats] = anova2(popcorn, 3, "on"); -***** demo - - # One-way Repeated Measures ANOVA (Rows are a crossed random factor) - - data = [54, 43, 78, 111; - 23, 34, 37, 41; - 45, 65, 99, 78; - 31, 33, 36, 35; - 15, 25, 30, 26]; - - [p, atab, stats] = anova2 (data, 1, "on", "linear"); -***** demo - - # Balanced Nested One-way ANOVA (Rows are a nested random factor) - - data = [4.5924 7.3809 21.322; -0.5488 9.2085 25.0426; ... - 6.1605 13.1147 22.66; 2.3374 15.2654 24.1283; ... - 5.1873 12.4188 16.5927; 3.3579 14.3951 10.2129; ... - 6.3092 8.5986 9.8934; 3.2831 3.4945 10.0203]; - - [p, atab, stats] = anova2 (data, 4, "on", "nested"); -***** test - ## Test for anova2 ("interaction") - ## comparison with results from Matlab for column effect - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - [p, atab, stats] = anova2 (popcorn, 3, "off"); - assert (p(1), 7.678957383294716e-07, 1e-14); - assert (p(2), 0.0001003738963050171, 1e-14); - assert (p(3), 0.7462153966366274, 1e-14); - assert (atab{2,5}, 56.700, 1e-14); - assert (atab{2,3}, 2, 0); - assert (atab{4,2}, 0.08333333333333348, 1e-14); - assert (atab{5,4}, 0.1388888888888889, 1e-14); - assert (atab{5,2}, 1.666666666666667, 1e-14); - assert (atab{6,2}, 22); - assert (stats.source, "anova2"); - assert (stats.colmeans, [6.25, 4.75, 4]); - assert (stats.inter, 1, 0); - assert (stats.pval, 0.7462153966366274, 1e-14); - assert (stats.df, 12); -***** test - ## Test for anova2 ("linear") - comparison with results from GraphPad Prism 8 - data = [54, 43, 78, 111; - 23, 34, 37, 41; - 45, 65, 99, 78; - 31, 33, 36, 35; - 15, 25, 30, 26]; - [p, atab, stats] = anova2 (data, 1, "off", "linear"); - assert (atab{2,2}, 2174.95, 1e-10); - assert (atab{3,2}, 8371.7, 1e-10); - assert (atab{4,2}, 2404.3, 1e-10); - assert (atab{5,2}, 12950.95, 1e-10); - assert (atab{2,4}, 724.983333333333, 1e-10); - assert (atab{3,4}, 2092.925, 1e-10); - assert (atab{4,4}, 200.358333333333, 1e-10); - assert (atab{2,5}, 3.61843363972882, 1e-10); - assert (atab{3,5}, 10.445909412303, 1e-10); - assert (atab{2,6}, 0.087266112738617, 1e-10); - assert (atab{3,6}, 0.000698397753556, 1e-10); -***** test - ## Test for anova2 ("nested") - comparison with results from GraphPad Prism 8 - data = [4.5924 7.3809 21.322; -0.5488 9.2085 25.0426; ... - 6.1605 13.1147 22.66; 2.3374 15.2654 24.1283; ... - 5.1873 12.4188 16.5927; 3.3579 14.3951 10.2129; ... - 6.3092 8.5986 9.8934; 3.2831 3.4945 10.0203]; - [p, atab, stats] = anova2 (data, 4, "off", "nested"); - assert (atab{2,2}, 745.360306290833, 1e-10); - assert (atab{3,2}, 278.01854140125, 1e-10); - assert (atab{4,2}, 180.180377467501, 1e-10); - assert (atab{5,2}, 1203.55922515958, 1e-10); - assert (atab{2,4}, 372.680153145417, 1e-10); - assert (atab{3,4}, 92.67284713375, 1e-10); - assert (atab{4,4}, 10.0100209704167, 1e-10); - assert (atab{2,5}, 4.02146005730833, 1e-10); - assert (atab{3,5}, 9.25800729165627, 1e-10); - assert (atab{2,6}, 0.141597630656771, 1e-10); - assert (atab{3,6}, 0.000636643812875719, 1e-10); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/cholcov.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cholcov.m +warning: legend: 'best' not yet implemented for location specifier, using 'northeast' instead +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/silhouette.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/silhouette.m +***** error silhouette (); +***** error silhouette ([1 2; 1 1]); +***** error silhouette ([1 2; 1 1], [1 2 3]'); +***** error silhouette ([1 2; 1 1], [1 2]', "xxx"); ***** demo - C1 = [2, 1, 1, 2; 1, 2, 1, 2; 1, 1, 2, 2; 2, 2, 2, 3] - T = cholcov (C1) - C2 = T'*T -***** test - C1 = [2, 1, 1, 2; 1, 2, 1, 2; 1, 1, 2, 2; 2, 2, 2, 3]; - T = cholcov (C1); - assert (C1, T'*T, 1e-15 * ones (size (C1))); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/cophenet.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cophenet.m -***** error cophenet () -***** error cophenet (ones (2,2), 1) -***** error cophenet ([1 2 1], "a") -***** error cophenet ([1 2 1], [1 2]) -***** demo "usage"; - X = randn (10,2); - y = pdist (X); - Z = linkage (y, "average"); - cophenet (Z, y) + load fisheriris; + X = meas(:,3:4); + cidcs = kmeans (X, 3, "Replicates", 5); + silhouette (X, cidcs); + y_labels(cidcs([1 51 101])) = unique (species); + set (gca, "yticklabel", y_labels); + title ("Fisher's iris data"); 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/dendrogram.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/dendrogram.m -***** demo "simple 1" - y = [4, 5; 2, 6; 3, 7; 8, 9; 1, 10]; - y(:,3) = 1:5; - dendrogram (y); -***** demo "simple 2" - v = 2 * rand (30, 1) - 1; - d = abs (bsxfun (@minus, v(:, 1), v(:, 1)')); - y = linkage (squareform (d, "tovector")); - dendrogram (y); -***** demo "collapsed tree, find all the leaves of node 5" - X = randn (60, 2); - D = pdist (X); - y = linkage (D, "average"); - subplot (2, 1, 1); - title ("original tree"); - dendrogram (y, 0); - subplot (2, 1, 2); - title ("collapsed tree"); - [~, t] = dendrogram (y, 20); - find(t == 5) -***** demo "optimal leaf order" - X = randn (30, 2); - D = pdist (X); - y = linkage (D, "average"); - order = optimalleaforder (y, D); - subplot (2, 1, 1); - title ("original leaf order"); - dendrogram (y); - subplot (2, 1, 2); - title ("optimal leaf order"); - dendrogram (y, "Reorder", order); -***** demo "horizontal orientation and labels" - X = randn (8, 2); - D = pdist (X); - L = ["Snow White"; "Doc"; "Grumpy"; "Happy"; "Sleepy"; "Bashful"; ... - "Sneezy"; "Dopey"]; - y = linkage (D, "average"); - dendrogram (y, "Orientation", "left", "Labels", L); -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - y = [4, 5; 2, 6; 3, 7; 8, 9; 1, 10]; - y(:,3) = 1:5; - dendrogram (y); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - y = [4, 5; 2, 6; 3, 7; 8, 9; 1, 10]; - y(:,3) = 1:5; - dendrogram (y); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - v = 2 * rand (30, 1) - 1; - d = abs (bsxfun (@minus, v(:, 1), v(:, 1)')); - y = linkage (squareform (d, "tovector")); - dendrogram (y); - set (0, "DefaultFigureVisible", visibility_setting); +[inst/squareform.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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 - set (0, "DefaultFigureVisible", "off"); - X = randn (30, 2); - D = pdist (X); - y = linkage (D, "average"); - order = optimalleaforder (y, D); - subplot (2, 1, 1); - title ("original leaf order"); - dendrogram (y); - subplot (2, 1, 2); - title ("optimal leaf order"); - dendrogram (y, "Reorder", order); - set (0, "DefaultFigureVisible", visibility_setting); -***** error dendrogram (); -***** error dendrogram (ones (2, 2), 1); -***** error dendrogram ([1 2 1], 1, "xxx", "xxx"); -***** error dendrogram ([1 2 1], "Reorder", "xxx"); -***** error dendrogram ([1 2 1], "Reorder", [1 2 3 4]); - fail ('dendrogram ([1 2 1], "Orientation", "north")', "invalid orientation .*") + 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/gamfit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/raylstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/raylstat.m +[inst/gplike.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gplike.m +***** error gplike () +***** error gplike (1) +***** error gplike ([1, 2], []) +***** error gplike ([1, 2], ones (2)) +***** error gplike (2, [1:10]) +***** assert (gplike ([2, 3], 4), 3.047536764863501, 1e-14) +***** assert (gplike ([1, 2], 4), 2.890371757896165, 1e-14) +***** assert (gplike ([2, 3], [1:10]), 32.57864322725392, 1e-14) +***** assert (gplike ([1, 2], [1:10]), 31.65666282460443, 1e-14) +***** assert (gplike ([1, NaN], [1:10]), NaN) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/grpstats.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/grpstats.m +***** demo + load carsmall; + [m,p,g] = grpstats (Weight, Model_Year, {"mean", "predci", "gname"}) + n = length(m); + errorbar((1:n)',m,p(:,2)-m); + set (gca, "xtick", 1:n, "xticklabel", g); + title ("95% prediction intervals for mean weight by year"); +***** demo + load carsmall; + [m,p,g] = grpstats ([Acceleration,Weight/1000],Cylinders, ... + {"mean", "meanci", "gname"}, 0.05) + [c,r] = size (m); + errorbar((1:c)'.*ones(c,r),m,p(:,[(1:r)])-m); + set (gca, "xtick", 1:c, "xticklabel", g); + title ("95% prediction intervals for mean weight by year"); +***** test + load carsmall + means = grpstats (Acceleration, Origin); + assert (means, [14.4377; 18.0500; 15.8867; 16.3778; 16.6000; 15.5000], 0.001); +***** test + load carsmall + [grpMin,grpMax,grp] = grpstats (Acceleration, Origin, {"min","max","gname"}); + assert (grpMin, [8.0; 15.3; 13.9; 12.2; 15.7; 15.5]); + assert (grpMax, [22.2; 21.9; 18.2; 24.6; 17.5; 15.5]); +***** test + load carsmall + [grpMin,grpMax,grp] = grpstats (Acceleration, Origin, {"min","max","gname"}); + assert (grp', {"USA", "France", "Japan", "Germany", "Sweden", "Italy"}); +***** test + load carsmall + [m,p,g] = grpstats ([Acceleration,Weight/1000], Cylinders, ... + {"mean", "meanci", "gname"}, 0.05); + assert (p(:,1), [11.17621760075134, 16.13845847655224, 16.16222663683362]', ... + [1e-14, 2e-14, 1e-14]'); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/confusionmat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/confusionmat.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); + Yt = [8 5 6 8 5 3 1 6 4 2 5 3 1 4]'; + Yp = [8 5 6 8 5 2 3 4 4 5 5 7 2 6]'; + C = [0 1 1 0 0 0 0 0; 0 0 0 0 1 0 0 0; 0 1 0 0 0 0 1 0; 0 0 0 1 0 1 0 0; ... + 0 0 0 0 3 0 0 0; 0 0 0 1 0 1 0 0; 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 2]; + assert (confusionmat (Yt, Yp), C) 1 test, 1 passed, 0 known failure, 0 skipped -[inst/nbinstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/nbinstat.m +[inst/gamstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gamstat.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]; + 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 - n = 1:4; - [m, v] = nbinstat (n, 0.5); - expected_m = [1, 2, 3, 4]; - expected_v = [2, 4, 6, 8]; + 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/nansum.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/cdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cdf.m -***** test - assert (cdf ("norm", 1, 0, 1), normcdf (1, 0, 1)) -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - theta = [1; 2]; - assert (cdf ("copula", x, "Clayton", theta), copulacdf ("Clayton", x, theta)) -***** test - x = [-1, 0, 1, 2, Inf]; - assert (cdf ("bbs", x, ones (1,5), ones (1,5), zeros (1,5)), ... - bbscdf (x, ones (1,5), ones (1,5), zeros (1,5))) -***** test - x = [1 2]; - mu = [0.5 1.5]; - sigma = [1.0 0.5; 0.5 1.0]; - assert (cdf ("multivariate normal", x, mu, sigma), ... - mvncdf (x, mu, sigma), 0.01) - a = [-inf 0]; - assert (cdf ("mvn", x, a, mu, sigma), ... - mvncdf (a, x, mu, sigma), 0.01) -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/gevfit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gevfit.m -***** demo - data = 1:50; - [pfit, pci] = gevfit (data); - p1 = gevcdf (data, pfit(1), pfit(2), pfit(3)); - plot (data, p1); -***** test - data = 1:50; - [pfit, pci] = gevfit (data); - pfit_out = [-0.4407, 15.1923, 21.5309]; - pci_out = [-0.7532, 11.5878, 16.5686; -0.1282, 19.9183, 26.4926]; - assert (pfit, pfit_out, 1e-3); - assert (pci, pci_out, 1e-3); -***** error [pfit, pci] = gevfit (ones (2,5)); -***** test - data = 1:2:50; - [pfit, pci] = gevfit (data); - pfit_out = [-0.4434, 15.2024, 21.0532]; - pci_out = [-0.8904, 10.3439, 14.0168; 0.0035, 22.3429, 28.0896]; - assert (pfit, pfit_out, 1e-3); - assert (pci, pci_out, 1e-3); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/regress.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/regress.m -***** test - % Longley data from the NIST Statistical Reference Dataset - Z = [ 60323 83.0 234289 2356 1590 107608 1947 - 61122 88.5 259426 2325 1456 108632 1948 - 60171 88.2 258054 3682 1616 109773 1949 - 61187 89.5 284599 3351 1650 110929 1950 - 63221 96.2 328975 2099 3099 112075 1951 - 63639 98.1 346999 1932 3594 113270 1952 - 64989 99.0 365385 1870 3547 115094 1953 - 63761 100.0 363112 3578 3350 116219 1954 - 66019 101.2 397469 2904 3048 117388 1955 - 67857 104.6 419180 2822 2857 118734 1956 - 68169 108.4 442769 2936 2798 120445 1957 - 66513 110.8 444546 4681 2637 121950 1958 - 68655 112.6 482704 3813 2552 123366 1959 - 69564 114.2 502601 3931 2514 125368 1960 - 69331 115.7 518173 4806 2572 127852 1961 - 70551 116.9 554894 4007 2827 130081 1962 ]; - % Results certified by NIST using 500 digit arithmetic - % b and standard error in b - V = [ -3482258.63459582 890420.383607373 - 15.0618722713733 84.9149257747669 - -0.358191792925910E-01 0.334910077722432E-01 - -2.02022980381683 0.488399681651699 - -1.03322686717359 0.214274163161675 - -0.511041056535807E-01 0.226073200069370 - 1829.15146461355 455.478499142212 ]; - Rsq = 0.995479004577296; - F = 330.285339234588; - y = Z(:,1); X = [ones(rows(Z),1), Z(:,2:end)]; - alpha = 0.05; - [b, bint, r, rint, stats] = regress (y, X, alpha); - assert(b,V(:,1),3e-6); - assert(stats(1),Rsq,1e-12); - assert(stats(2),F,3e-8); - assert(((bint(:,1)-bint(:,2))/2)/tinv(alpha/2,9),V(:,2),-1.e-5); -warning: matrix singular to machine precision, rcond = 3.50566e-20 -warning: called from - regress at line 130 column 7 - __test__ at line 33 column 28 - test at line 683 column 11 - /tmp/tmp.82E11Krx1T at line 134 column 31 - -1 test, 1 passed, 0 known failure, 0 skipped -[inst/betastat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/betastat.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); -***** 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); -***** 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/gevlike.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gevlike.m -***** test - x = 1; - k = 0.2; - sigma = 0.3; - mu = 0.5; - [L, D, C] = gevlike ([k sigma mu], x); - expected_L = 0.75942; - expected_D = [0.53150; -0.67790; -2.40674]; - expected_C = [-0.12547 1.77884 1.06731; 1.77884 16.40761 8.48877; 1.06731 8.48877 0.27979]; - assert (L, expected_L, 0.001); - assert (D, expected_D, 0.001); - assert (C, inv (expected_C), 0.001); -***** test - x = 1; - k = 0; - sigma = 0.3; - mu = 0.5; - [L, D, C] = gevlike ([k sigma mu], x); - expected_L = 0.65157; - expected_D = [0.54011; -1.17291; -2.70375]; - expected_C = [0.090036 3.41229 2.047337; 3.412229 24.760027 12.510190; 2.047337 12.510190 2.098618]; - assert (L, expected_L, 0.001); - assert (D, expected_D, 0.001); - assert (C, inv (expected_C), 0.001); -***** test - x = -5:-1; - k = -0.2; - sigma = 0.3; - mu = 0.5; - [L, D, C] = gevlike ([k sigma mu], x); - expected_L = 3786.4; - expected_D = [6.4511e+04; -4.8194e+04; 3.0633e+03]; - expected_C = [1.6802e-07, 4.6110e-06, 8.7297e-05; ... - 4.6110e-06, 7.5693e-06, 1.2034e-05; ... - 8.7297e-05, 1.2034e-05, -0.0019125]; - assert (L, expected_L, -0.001); - assert (D, expected_D, -0.001); - assert (C, expected_C, -0.001); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/canoncorr.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/qqplot.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/qqplot.m -***** error qqplot () -***** error qqplot ({1}) -***** error qqplot (ones (2,2)) -***** error qqplot (1, "foobar") -***** error qqplot ([1 2 3], "foobar") -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - qqplot ([2 3 3 4 4 5 6 5 6 7 8 9 8 7 8 9 0 8 7 6 5 4 6 13 8 15 9 9]); - set (0, "DefaultFigureVisible", visibility_setting); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/chi2gof.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/chi2gof.m -***** demo - x = normrnd (50, 5, 100, 1); - [h, p, stats] = chi2gof (x) - [h, p, stats] = chi2gof (x, "cdf", @(x)normcdf (x, mean(x), std(x))) - [h, p, stats] = chi2gof (x, "cdf", {@normcdf, mean(x), std(x)}) -***** demo - x = rand (100,1 ); - n = length (x); - binedges = linspace (0, 1, 11); - expectedCounts = n * diff (binedges); - [h, p, stats] = chi2gof (x, "binedges", binedges, "expected", expectedCounts) -***** demo - bins = 0:5; - obsCounts = [6 16 10 12 4 2]; - n = sum(obsCounts); - lambdaHat = sum(bins.*obsCounts) / n; - expCounts = n * poisspdf(bins,lambdaHat); - [h, p, stats] = chi2gof (bins, "binctrs", bins, "frequency", obsCounts, ... - "expected", expCounts, "nparams",1) -***** error chi2gof () -***** error chi2gof ([2,3;3,4]) -***** error chi2gof ([1,2,3,4], "nbins", 3, "ctrs", [2,3,4]) -***** error chi2gof ([1,2,3,4], "frequency", [2,3,2]) -***** error chi2gof ([1,2,3,4], "frequency", [2,3,2,-2]) -***** error chi2gof ([1,2,3,4], "frequency", [2,3,2,2], "nparams", i) -***** error chi2gof ([1,2,3,4], "frequency", [2,3,2,2], "alpha", 1.3) -***** error chi2gof ([1,2,3,4], "expected", [-3,2,2]) -***** error chi2gof ([1,2,3,4], "expected", [3,2,2], "nbins", 5) -***** error chi2gof ([1,2,3,4], "cdf", @normcdff) -***** test - x = [1 2 1 3 2 4 3 2 4 3 2 2]; - [h, p, stats] = chi2gof (x); - assert (h, 0); - assert (p, NaN); - assert (stats.chi2stat, 0.1205375022748029, 1e-14); - assert (stats.df, 0); - assert (stats.edges, [1, 2.5, 4], 1e-14); - assert (stats.O, [7, 5], 1e-14); - assert (stats.E, [6.399995519909668, 5.600004480090332], 1e-14); -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/evalclusters.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/evalclusters.m -***** error evalclusters () -***** error evalclusters ([1 1;0 1]) -***** error evalclusters ([1 1;0 1], "kmeans") -***** error <'x' must be a numeric*> evalclusters ("abc", "kmeans", "gap") -***** error evalclusters ([1 1;0 1], "xxx", "gap") -***** error evalclusters ([1 1;0 1], [1 2], "gap") -***** error evalclusters ([1 1;0 1], 1.2, "gap") -***** error evalclusters ([1 1;0 1], [1; 2], 123) -***** error evalclusters ([1 1;0 1], [1; 2], "xxx") -***** error <'KList' can be empty*> evalclusters ([1 1;0 1], "kmeans", "gap") -***** error evalclusters ([1 1;0 1], [1; 2], "gap", 1) -***** error evalclusters ([1 1;0 1], [1; 2], "gap", 1, 1) -***** error evalclusters ([1 1;0 1], [1; 2], "gap", "xxx", 1) -***** error <'KList'*> evalclusters ([1 1;0 1], [1; 2], "gap", "KList", [-1 0]) -***** error <'KList'*> evalclusters ([1 1;0 1], [1; 2], "gap", "KList", [1 .5]) -***** error <'KList'*> evalclusters ([1 1;0 1], [1; 2], "gap", "KList", [1 1; 1 1]) -***** error evalclusters ([1 1;0 1], [1; 2], "gap", ... - "distance", "a") -***** error evalclusters ([1 1;0 1], [1; 2], "daviesbouldin", ... - "distance", "a") -***** error evalclusters ([1 1;0 1], [1; 2], "gap", ... - "clusterpriors", "equal") -***** error evalclusters ([1 1;0 1], [1; 2], ... - "silhouette", "clusterpriors", "xxx") -***** error <'clust' must be a clustering*> evalclusters ([1 1;0 1], [1; 2], "gap") -***** demo - load fisheriris; - eva = evalclusters(meas, "kmeans", "calinskiharabasz", "KList", [1:6]) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/ecdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ecdf.m -***** demo - y = exprnd (10, 50, 1); ## random failure times are exponential(10) - d = exprnd (20, 50, 1); ## drop-out times are exponential(20) - t = min (y, d); ## we observe the minimum of these times - censored = (y > d); ## we also observe whether the subject failed - - ## Calculate and plot the empirical cdf and confidence bounds - [f, x, flo, fup] = ecdf (t, "censoring", censored); - stairs (x, f); - hold on; - stairs (x, flo, "r:"); stairs (x, fup, "r:"); - - ## Superimpose a plot of the known true cdf - xx = 0:.1:max (t); yy = 1 - exp (-xx / 10); plot (xx, yy, "g-"); - hold off; -***** demo - R = wblrnd (100, 2, 100, 1); - ecdf (R, "Function", "survivor", "Alpha", 0.01, "Bounds", "on"); - hold on - x = 1:1:250; - wblsurv = 1 - cdf ("weibull", x, 100, 2); - plot (x, wblsurv, "g-", "LineWidth", 2) - legend ("Empirical survivor function", "Lower confidence bound", ... - "Upper confidence bound", "Weibull survivor function", ... - "Location", "northeast"); - hold off -***** error ecdf (); -***** error ecdf (randi (15,2)); -***** error ecdf ([3,2,4,3+2i,5]); -***** error kstest ([2,3,4,5,6],"tail"); -***** error kstest ([2,3,4,5,6],"tail", "whatever"); -***** error kstest ([2,3,4,5,6],"function", ""); -***** error kstest ([2,3,4,5,6],"badoption", 0.51); -***** error kstest ([2,3,4,5,6],"tail", 0); -***** error kstest ([2,3,4,5,6],"alpha", 0); -***** error kstest ([2,3,4,5,6],"alpha", NaN); -***** error kstest ([NaN,NaN,NaN,NaN,NaN],"tail", "unequal"); -***** error kstest ([2,3,4,5,6],"alpha", 0.05, "CDF", [2,3,4;1,3,4;1,2,1]); +[inst/ppplot.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ppplot.m +***** error ppplot () +***** error ppplot (ones (2,2)) +***** error ppplot (1, 2) +***** error ppplot ([1 2 3 4], 2) ***** shared visibility_setting visibility_setting = get (0, "DefaultFigureVisible"); ***** test set (0, "DefaultFigureVisible", "off"); - x = [2, 3, 4, 3, 5, 4, 6, 5, 8, 3, 7, 8, 9, 0]; - [F, x, Flo, Fup] = ecdf (x); - F_out = [0; 0.0714; 0.1429; 0.3571; 0.5; 0.6429; 0.7143; 0.7857; 0.9286; 1]; - assert (F, F_out, ones (10,1) * 1e-4); - x_out = [0 0 2 3 4 5 6 7 8 9]'; - assert (x, x_out); - Flo_out = [NaN, 0, 0, 0.1061, 0.2381, 0.3919, 0.4776, 0.5708, 0.7937, NaN]'; - assert (Flo, Flo_out, ones (10,1) * 1e-4); - Fup_out = [NaN, 0.2063, 0.3262, 0.6081, 0.7619, 0.8939, 0.9509, 1, 1, NaN]'; - assert (Fup, Fup_out, ones (10,1) * 1e-4); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - x = [2, 3, 4, 3, 5, 4, 6, 5, 8, 3, 7, 8, 9, 0]; - ecdf (x); + ppplot ([2 3 3 4 4 5 6 5 6 7 8 9 8 7 8 9 0 8 7 6 5 4 6 13 8 15 9 9]); set (0, "DefaultFigureVisible", visibility_setting); -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/logistic_regression.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/logistic_regression.m -***** test - # Output compared to following MATLAB commands - # [B, DEV, STATS] = mnrfit(X,Y+1,'model','ordinal'); - # P = mnrval(B,X) - X = [1.489381332449196, 1.1534152241851305; ... - 1.8110085304863965, 0.9449666896938425; ... - -0.04453299665130296, 0.34278203449678646; ... - -0.36616019468850347, 1.130254275908322; ... - 0.15339143291005095, -0.7921044310668951; ... - -1.6031878794469698, -1.8343471035233376; ... - -0.14349521143198166, -0.6762996896828459; ... - -0.4403818557740143, -0.7921044310668951; ... - -0.7372685001160434, -0.027793137932169563; ... - -0.11875465773681024, 0.5512305689880763]; - Y = [1,1,1,1,1,0,0,0,0,0]'; - [INTERCEPT, SLOPE, DEV, DL, D2L, P] = logistic_regression (Y, X, false); -***** test - # Output compared to following MATLAB commands - # [B, DEV, STATS] = mnrfit(X,Y+1,'model','ordinal'); - load carbig - X = [Acceleration Displacement Horsepower Weight]; - miles = [1,1,1,1,1,1,1,1,1,1,NaN,NaN,NaN,NaN,NaN,1,1,NaN,1,1,2,2,1,2,2,2, ... - 2,2,2,2,2,1,1,1,1,2,2,2,2,NaN,2,1,1,2,1,1,1,1,1,1,1,1,1,2,2,1,2, ... - 2,3,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,2,2,2, ... - 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,2,2,2,1,2,2, ... - 2,1,1,3,2,2,2,1,2,2,1,2,2,2,1,3,2,3,2,1,1,1,1,1,1,1,1,3,2,2,3,3, ... - 2,2,2,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,2,2,1,3,2,2,2,2,2,2,1,3,2,2, ... - 2,2,2,3,2,2,2,2,2,1,1,1,1,2,2,2,2,3,2,3,3,2,1,1,1,3,3,2,2,2,1,2, ... - 2,1,1,1,1,1,3,3,3,2,3,1,1,1,1,1,2,2,1,1,1,1,1,3,2,2,2,3,3,3,3,2, ... - 2,2,4,3,3,4,3,2,2,2,2,2,2,2,2,2,2,2,1,1,2,1,1,1,3,2,2,3,2,2,2,2, ... - 2,1,2,1,3,3,2,2,2,2,2,1,1,1,1,1,1,2,1,3,3,3,2,2,2,2,2,3,3,3,3,2, ... - 2,2,3,4,3,3,3,2,2,2,2,3,3,3,3,3,4,2,4,4,4,3,3,4,4,3,3,3,2,3,2,3, ... - 2,2,2,2,3,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,NaN,3,2,2,2,2,2,1,2, ... - 2,3,3,3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,2,2,4,3,2,3]'; - [INTERCEPT, SLOPE, DEV, DL, D2L, P] = logistic_regression (miles, X, false); - assert (DEV, 433.197174495549, 1e-05); - assert (INTERCEPT(1), -16.6895155618903, 1e-05); - assert (INTERCEPT(2), -11.7207818178493, 1e-05); - assert (INTERCEPT(3), -8.0605768506075, 1e-05); - assert (SLOPE(1), 0.104762463756714, 1e-05); - assert (SLOPE(2), 0.0103357623191891, 1e-05); - assert (SLOPE(3), 0.0645199313242276, 1e-05); - assert (SLOPE(4), 0.00166377028388103, 1e-05); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/shadow9/mean.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/mean.m -***** test - x = -10:10; - y = x'; - z = [y, y+10]; - assert (mean (x), 0); - assert (mean (y), 0); - assert (mean (z), [0, 10]); -***** assert (mean (magic (3), 1), [5, 5, 5]) -***** assert (mean (magic (3), 2), [5; 5; 5]) -***** assert (mean (logical ([1 0 1 1])), 0.75) -***** assert (mean (single ([1 0 1 1])), single (0.75)) -***** assert (mean ([1 2], 3), [1 2]) -***** error mean () -***** error mean (1, 2, 3) -***** error mean (1, 2, 3, 4) -***** error mean (1, "all", 3) -***** error mean (1, "b") -***** error mean (1, 1, "foo") -***** error mean ({1:5}) -***** error mean ("char") -***** error mean (1, ones (2,2)) -***** error mean (1, 1.5) -***** error mean (1, 0) -***** test - in = [1 2 3]; - out = 2; - assert (mean (in, "default"), mean (in)); - assert (mean (in, "default"), out); - - in = single ([1 2 3]); - out = 2; - assert (mean (in, "default"), mean (in)); - assert (mean (in, "default"), single (out)); - assert (mean (in, "double"), out); - assert (mean (in, "native"), single (out)); - - in = uint8 ([1 2 3]); - out = 2; - assert (mean (in, "default"), mean (in)); - assert (mean (in, "default"), out); - assert (mean (in, "double"), out); - assert (mean (in, "native"), uint8 (out)); - - in = logical ([1 0 1]); - out = 2/3; - assert (mean (in, "default"), mean (in)); - assert (mean (in, "default"), out); - assert (mean (in, "native"), out); # logical ignores native option -***** test - x = [-10:10]; - y = [x;x+5;x-5]; - assert (mean (x), 0); - assert (mean (y, 2), [0, 5, -5]'); - assert (mean (y, "all"), 0); - y(2,4) = NaN; - assert (mean (y', "omitnan"), [0 5.35 -5]); - z = y + 20; - assert (mean (z, "all"), NaN); - m = [20 NaN 15]; - assert (mean (z'), m); - assert (mean (z', "includenan"), m); - m = [20 25.35 15]; - assert (mean (z', "omitnan"), m); - assert (mean (z, 2, "omitnan"), m'); - assert (mean (z, 2, "native", "omitnan"), m'); - assert (mean (z, 2, "omitnan", "native"), m'); -***** test - assert (mean (true, "all"), 1); - assert (mean (false), 0); - assert (mean ([true false true]), 2/3, 4e-14); - assert (mean ([true false true], 1), [1 0 1]); - assert (mean ([true false NaN], 1), [1 0 NaN]); - assert (mean ([true false NaN], 2), NaN); - assert (mean ([true false NaN], 2, "omitnan"), 0.5); - assert (mean ([true false NaN], 2, "omitnan", "native"), 0.5); -***** test - x = repmat ([1:20;6:25], [5 2 6 3]); - assert (size (mean (x, [3 2])), [10 1 1 3]); - assert (size (mean (x, [1 2])), [1 1 6 3]); - assert (size (mean (x, [1 2 4])), [1 1 6]); - assert (size (mean (x, [1 4 3])), [1 40]); - assert (size (mean (x, [1 2 3 4])), [1 1]); -***** assert (mean (ones (2,2), 3), ones (2,2)); -***** assert (mean (ones (2,2,2), 99), ones (2,2,2)); -***** assert (mean (magic (3), 3), magic (3)); -***** assert (mean (magic (3), [1 3]), [5, 5, 5]); -***** assert (mean (magic (3), [1 99]), [5, 5, 5]); -***** test - x = repmat ([1:20;6:25], [5 2 6 3]); - m = repmat ([10.5;15.5], [5 1 1 3]); - assert (mean (x, [3 2]), m, 4e-14); - x(2,5,6,3) = NaN; - m(2,1,1,3) = NaN; - assert (mean (x, [3 2]), m, 4e-14); - m(2,1,1,3) = 15.52301255230125; - assert (mean (x, [3 2], "omitnan"), m, 4e-14); -27 tests, 27 passed, 0 known failure, 0 skipped -[inst/shadow9/median.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/median.m -***** assert (median (1), 1) -***** assert (median ([1,2,3]), 2) -***** assert (median ([1,2,3]'), 2) -***** assert (median (cat(3,3,1,2)), 2) -***** assert (median ([3,1,2]), 2) -***** assert (median ([2,4,6,8]), 5) -***** assert (median ([8,2,6,4]), 5) -***** assert (median (single ([1,2,3])), single (2)) -***** assert (median ([1,2], 3), [1,2]) -***** test - x = [1, 2, 3, 4, 5, 6]; - x2 = x'; - y = [1, 2, 3, 4, 5, 6, 7]; - y2 = y'; - - assert (median (x) == median (x2) && median (x) == 3.5); - assert (median (y) == median (y2) && median (y) == 4); - assert (median ([x2, 2 * x2]), [3.5, 7]); - assert (median ([y2, 3 * y2]), [4, 12]); -***** test - in = [1 2 3]; - out = 2; - assert (median (in, "default"), median (in)); - assert (median (in, "default"), out); -***** test - in = single ([1 2 3]); - out = 2; - assert (median (in, "default"), single (median (in))); - assert (median (in, "default"), single (out)); - assert (median (in, "double"), double (out)); - assert (median (in, "native"), single (out)); -***** test - in = uint8 ([1 2 3]); - out = 2; - assert (median (in, "default"), double (median (in))); - assert (median (in, "default"), double (out)); - assert (median (in, "double"), out); - assert (median (in, "native"), uint8 (out)); -***** test - in = logical ([1 0 1]); - out = 1; - assert (median (in, "default"), double (median (in))); - assert (median (in, "default"), double (out)); - assert (median (in, "double"), double (out)); - assert (median (in, "native"), double (out)); -***** test - x = repmat ([2 2.1 2.2 2 NaN; 3 1 2 NaN 5; 1 1.1 1.4 5 3], [1, 1, 4]); - y = repmat ([2 1.1 2 NaN NaN], [1, 1, 4]); - assert (median (x), y); - assert (median (x, 1), y); - y = repmat ([2 1.1 2 3.5 4], [1, 1, 4]); - assert (median (x, "omitnan"), y); - assert (median (x, 1, "omitnan"), y); - y = repmat ([2.05; 2.5; 1.4], [1, 1, 4]); - assert (median (x, 2, "omitnan"), y); - y = repmat ([NaN; NaN; 1.4], [1, 1, 4]); - assert (median (x, 2), y); - assert (median (x, "all"), NaN); - assert (median (x, "all", "omitnan"), 2); -***** assert (median (cat (3, 3, 1, NaN, 2), "omitnan"), 2) -***** assert (median (cat (3, 3, 1, NaN, 2), 3, "omitnan"), 2) -***** test - assert (median (true, "all"), logical (1)); - assert (median (false), logical (0)); - assert (median ([true false true]), true); - assert (median ([true false true], 2), true); - assert (median ([true false true], 1), logical ([1 0 1])); - assert (median ([true false NaN], 1), [1 0 NaN]); - assert (median ([true false NaN], 2), NaN); - assert (median ([true false NaN], 2, "omitnan"), 0.5); - assert (median ([true false NaN], 2, "omitnan", "native"), double(0.5)); -***** test - x = repmat ([1:20;6:25], [5 2 6 3]); - assert (size (median (x, [3 2])), [10 1 1 3]); - assert (size (median (x, [1 2])), [1 1 6 3]); - assert (size (median (x, [1 2 4])), [1 1 6]); - assert (size (median (x, [1 4 3])), [1 40]); - assert (size (median (x, [1 2 3 4])), [1 1]); -***** assert (median (ones (2,2), 3), ones (2,2)); -***** assert (median (ones (2,2,2), 99), ones (2,2,2)); -***** assert (median (magic (3), 3), magic (3)); -***** assert (median (magic (3), [1 3]), [4, 5, 6]); -***** assert (median (magic (3), [1 99]), [4, 5, 6]); -***** test - x = repmat ([2 2.1 2.2 2 NaN; 3 1 2 NaN 5; 1 1.1 1.4 5 3], [1, 1, 4]); - assert (median (x, [3 2]), [NaN NaN 1.4]'); - assert (median (x, [3 2], "omitnan"), [2.05 2.5 1.4]'); - assert (median (x, [1 3]), [2 1.1 2 NaN NaN]); - assert (median (x, [1 3], "omitnan"), [2 1.1 2 3.5 4]); -***** assert (median (NaN), NaN) -***** assert (median (NaN, "omitnan"), NaN) -***** assert (median (NaN (2)), [NaN NaN]) -***** assert (median (NaN (2), "omitnan"), [NaN NaN]) -***** assert (median ([1 NaN 3]), NaN) -***** assert (median ([1 NaN 3], 1), [1 NaN 3]) -***** assert (median ([1 NaN 3], 2), NaN) -***** assert (median ([1 NaN 3]'), NaN) -***** assert (median ([1 NaN 3]', 1), NaN) -***** assert (median ([1 NaN 3]', 2), [1; NaN; 3]) -***** assert (median ([1 NaN 3], "omitnan"), 2) -***** assert (median ([1 NaN 3]', "omitnan"), 2) -***** assert (median ([1 NaN 3], 1, "omitnan"), [1 NaN 3]) -***** assert (median ([1 NaN 3], 2, "omitnan"), 2) -***** assert (median ([1 NaN 3]', 1, "omitnan"), 2) -***** assert (median ([1 NaN 3]', 2, "omitnan"), [1; NaN; 3]) -***** assert (median ([1 2 NaN 3]), NaN) -***** assert (median ([1 2 NaN 3], "omitnan"), 2) -***** assert (median ([1,2,NaN;4,5,6;NaN,8,9]), [NaN, 5, NaN]) -***** assert (median ([1 2 ; NaN 4]), [NaN 3]) -***** assert (median ([1 2 ; NaN 4], "omitnan"), [1 3]) -***** assert (median ([1 2 ; NaN 4], 1, "omitnan"), [1 3]) -***** assert (median ([1 2 ; NaN 4], 2, "omitnan"), [1.5; 4], eps) -***** assert (median ([1 2 ; NaN 4], 3, "omitnan"), [1 2 ; NaN 4]) -***** assert (median ([NaN 2 ; NaN 4]), [NaN 3]) -***** assert (median ([NaN 2 ; NaN 4], "omitnan"), [NaN 3]) -***** assert (median (ones (1, 0, 3)), NaN (1, 1, 3)) -***** assert (median (NaN("single")), NaN("single")); -***** assert (median (NaN("single"), "omitnan"), NaN("single")); -***** assert (median (NaN("single"), "double"), NaN("double")); -***** assert (median (single([1 2 ; NaN 4])), single([NaN 3])); -***** assert (median (single([1 2 ; NaN 4]), "double"), double([NaN 3])); -***** assert (median (single([1 2 ; NaN 4]), "omitnan"), single([1 3])); -***** assert (median (single([1 2 ; NaN 4]), "omitnan", "double"), double([1 3])); -***** assert (median (single([NaN 2 ; NaN 4]), "double"), double([NaN 3])); -***** assert (median (single([NaN 2 ; NaN 4]), "omitnan"), single([NaN 3])); -***** assert (median (single([NaN 2 ; NaN 4]), "omitnan", "double"), double([NaN 3])); -***** assert (median (Inf), Inf); -***** assert (median (-Inf), -Inf); -***** assert (median ([-Inf Inf]), NaN); -***** assert (median ([3 Inf]), Inf); -***** assert (median ([3 4 Inf]), 4); -***** assert (median ([Inf 3 4]), 4); -***** assert (median ([Inf 3 Inf]), Inf); -***** assert (median ([]), NaN); -***** assert (median (ones(1,0)), NaN); -***** assert (median (ones(0,1)), NaN); -***** assert (median ([], 1), NaN(1,0)); -***** assert (median ([], 2), NaN(0,1)); -***** assert (median ([], 3), NaN(0,0)); -***** assert (median (ones(1,0), 1), NaN(1,0)); -***** assert (median (ones(1,0), 2), NaN(1,1)); -***** assert (median (ones(1,0), 3), NaN(1,0)); -***** assert (median (ones(0,1), 1), NaN(1,1)); -***** assert (median (ones(0,1), 2), NaN(0,1)); -***** assert (median (ones(0,1), 3), NaN(0,1)); -***** assert (median (ones(0,1,0,1), 1), NaN(1,1,0)); -***** assert (median (ones(0,1,0,1), 2), NaN(0,1,0)); -***** assert (median (ones(0,1,0,1), 3), NaN(0,1,1)); -***** assert (median (ones(0,1,0,1), 4), NaN(0,1,0)); -***** assert (median([1 3 3i 2 1i]), 2) -***** assert (median([1 2 4i; 3 2i 4]), [2, 1+1i, 2+2i]) -***** shared a, b, x, y - old_state = rand ("state"); - restore_state = onCleanup (@() rand ("state", old_state)); - rand ("state", 2); - a = rand (2,3,4,5); - b = rand (3,4,6,5); - x = sort (a, 4); - y = sort (b, 3); -***** assert <*35679> (median (a, 4), x(:, :, :, 3)) -***** assert <*35679> (median (b, 3), (y(:, :, 3, :) + y(:, :, 4, :))/2) -***** shared ## Clear shared to prevent variable echo for any later test failures -***** assert (median ([true, false]), true) -***** assert (median (logical ([])), false) -***** assert (median (uint8 ([1, 3])), uint8 (2)) -***** assert (median (uint8 ([])), uint8 (NaN)) -***** assert (median (uint8 ([NaN 10])), uint8 (5)) -***** assert (median (int8 ([1, 3, 4])), int8 (3)) -***** assert (median (int8 ([])), int8 (NaN)) -***** assert (median (single ([1, 3, 4])), single (3)) -***** assert (median (single ([1, 3, NaN])), single (NaN)) -***** assert (median ([1 2 3], "aLL"), 2); -***** assert (median ([1 2 3], "OmitNan"), 2); -***** assert (median ([1 2 3], "DOUBle"), 2); -***** error median () -***** error median (1, 2, 3) -***** error median (1, 2, 3, 4) -***** error median (1, "all", 3) -***** error median (1, "b") -***** error median (1, 1, "foo") -***** error <'all' cannot be used with> median (1, 3, "all") -***** error <'all' cannot be used with> median (1, [2 3], "all") -***** error median ({1:5}) -***** error median ("char") -***** error median(1, "double", "native") -***** error median (1, ones (2,2)) -***** error median (1, 1.5) -***** error median (1, 0) -***** error median ([1 2 3], [-1 1]) -***** error median(1, [1 2 2]) -117 tests, 117 passed, 0 known failure, 0 skipped -[inst/shadow9/var.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/var.m -***** test - x = [-10:10]; - y = [x;x+5;x-5]; - assert (var (x), 38.5); - assert (var (y, [], 2), [38.5; 38.5; 38.5]); - assert (var (y, 0, 2), [38.5; 38.5; 38.5]); - assert (var (y, 1, 2), ones (3,1) * 36.66666666666666, 1e-14); - assert (var (y, "all"), 54.19354838709678, 1e-14); - y(2,4) = NaN; - assert (var (y, "all"), NaN); - assert (var (y, "all", "includenan"), NaN); - assert (var (y, "all", "omitnan"), 55.01533580116342, 1e-14); - assert (var (y, 0, 2, "includenan"), [38.5; NaN; 38.5]); - assert (var (y, [], 2), [38.5; NaN; 38.5]); - assert (var (y, [], 2, "omitnan"), [38.5; 37.81842105263158; 38.5], 1e-14); -***** assert (var ([1 NaN 3], [1 2 3], "omitnan"), 0.75, eps) -***** assert (var ([1 2 3], [1 NaN 3], "omitnan"), 0.75, eps) -***** assert (var (magic(3), [1 NaN 3], "omitnan"), [3 12 3], eps) -***** assert (var ([1 NaN 3], [1 2 3], "omitnan", "all"), 0.75, eps) -***** assert (var ([1 NaN 3], [1 2 3], "all", "omitnan"), 0.75, eps) -***** assert (var ([1 2 3], [1 NaN 3], "omitnan", "all"), 0.75, eps) -***** assert (var ([1 NaN 3], [1 2 3], 2, "omitnan"), 0.75, eps) -***** assert (var ([1 2 3], [1 NaN 3], 2, "omitnan"), 0.75, eps) -***** assert (var (magic(3), [1 NaN 3], 1, "omitnan"), [3 12 3], eps) -***** assert (var (magic(3), [1 NaN 3], 2, "omitnan"), [0.75;3;0.75], eps) -***** assert (var ([4 4; 4 6; 6 6], [1 3], 2, 'omitnan'), [0;0.75;0], eps) -***** assert (var ([4 NaN; 4 6; 6 6], [1 2 3], 1, 'omitnan'), [1 0]) -***** assert (var ([4 NaN; 4 6; 6 6], [1 3], 2, 'omitnan'), [0;0.75;0], eps) -***** assert (var (3*reshape(1:18, [3 3 2]), [1 2 3], 1, 'omitnan'), ones(1,3,2)*5) -***** assert (var (reshape(1:18, [3 3 2]), [1 2 3], 2, 'omitnan'), 5*ones(3,1,2)) -***** assert (var (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 2], 'omitnan'), 60*ones(1,1,2)) -***** assert (var (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 4], 'omitnan'), 6*ones(1,3,2)) -***** assert (var (6*reshape(1:18, [3 3 2]), ones (3,3,2), [1:3], 'omitnan'), 969) -***** test - x = reshape(1:18, [3 3 2]); - x([2, 14]) = NaN; - w = ones (3,3,2); - assert (var (16*x, w, [1:3], 'omitnan'), 6519); -***** test - x = reshape(1:18, [3 3 2]); - w = ones (3,3,2); - w([2, 14]) = NaN; - assert (var (16*x, w, [1:3], 'omitnan'), 6519); -***** assert (var ([1 2 3], "aLl"), 1); -***** assert (var ([1 2 3], "OmitNan"), 1); -***** assert (var ([1 2 3], "IncludeNan"), 1); -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - assert (size (var (x, 0, [3 2])), [10, 1, 1, 3]); - assert (size (var (x, 1, [1 2])), [1, 1, 6, 3]); - assert (size (var (x, [], [1 2 4])), [1, 1, 6]); - assert (size (var (x, 0, [1 4 3])), [1, 40]); - assert (size (var (x, [], [1 2 3 4])), [1, 1]); -***** assert (var (3*magic(3)), [63 144 63]) -***** assert (var (3*magic(3), 'omitnan'), [63 144 63]) -***** assert (var (3*magic(3), 1), [42 96 42]) -***** assert (var (3*magic(3), 1, 'omitnan'), [42 96 42]) -***** assert (var (3*magic(3), ones(1,3), 1), [42 96 42]) -***** assert (var (3*magic(3), ones(1,3), 1, 'omitnan'), [42 96 42]) -***** assert (var (2*magic(3), [1 1 NaN], 1, 'omitnan'), [25 16 1]) -***** assert (var (3*magic(3), ones(3,3)), [42 96 42]) -***** assert (var (3*magic(3), ones(3,3), 'omitnan'), [42 96 42]) -***** assert (var (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 'omitnan'), [42 36 42]) -***** assert (var (3*magic(3), ones(3,3), 1), [42 96 42]) -***** assert (var (3*magic(3), ones(3,3), 1, 'omitnan'), [42 96 42]) -***** assert (var (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 1, 'omitnan'), [42 36 42]) -***** assert (var (3*magic(3), ones(3,3), [1 4]), [42 96 42]) -***** assert (var (3*magic(3), ones(3,3), [1 4], 'omitnan'), [42 96 42]) -***** assert (var (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1],[1 4],'omitnan'), [42 36 42]) -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - v = repmat (33.38912133891213, [10, 1, 1, 3]); - assert (var (x, 0, [3, 2]), v, 1e-14); - v = repmat (33.250, [10, 1, 1, 3]); - assert (var (x, 1, [3, 2]), v, 1e-14); - x(2,5,6,3) = NaN; - v(2,1,1,3) = NaN; - assert (var (x, 1, [3, 2]), v, 4e-14); - v = repmat (33.38912133891213, [10 1 1 3]); - v(2,1,1,3) = NaN; - assert (var (x, [], [3, 2]), v, 4e-14); - v(2,1,1,3) = 33.40177912169048; - assert (var (x, [], [3, 2], "omitnan"), v, 4e-14); -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - [v, m] = var (x, 0, [3 2]); - assert (m, mean (x, [3 2])); - [v, m] = var (x, 0, [1 2]); - assert (m, mean (x, [1 2])); - [v, m] = var (x, 0, [1 3 4]); - assert (m, mean (x, [1 3 4])); -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - x(2,5,6,3) = NaN; - [v, m] = var (x, 0, [3 2], "omitnan"); - assert (m, mean (x, [3 2], "omitnan")); -***** test - [v, m] = var (4 * eye (2), [1, 3]); - assert (v, [3, 3]); - assert (m, [1, 3]); -***** assert (var (ones (2,2,2), [1:2], 3), [(zeros (2, 2))]); -***** assert (var (magic (3), [1:9], "all"), 6.666666666666667, 1e-14); -***** assert (var (ones (2,2), [], 3), zeros (2,2)); -***** assert (var (ones (2,2,2), [], 99), zeros (2,2,2)); -***** assert (var (magic (3), [], 3), zeros (3,3)); -***** assert (var (magic (3), [], 1), [7, 16, 7]); -***** assert (var (magic (3), [], [1 3]), [7, 16, 7]); -***** assert (var (magic (3), [], [1 99]), [7, 16, 7]); -***** test - [v, m] = var ([]); - assert (v, NaN); - assert (m, NaN); - [v, m] = var (3); - assert (v, 0); - assert (m, 3); -***** assert (var (13), 0) -***** assert (var (single (13)), single (0)) -***** assert (var ([1,2,3]), 1) -***** assert (var ([1,2,3], 1), 2/3, eps) -***** assert (var ([1,2,3], [], 1), [0,0,0]) -***** assert (var ([1,2,3], [], 3), [0,0,0]) -***** assert (var (5, 99), 0) -***** assert (var (5, 99, 1), 0) -***** assert (var (5, 99, 2), 0) -***** assert (var ([5 3], [99 99], 2), 1) -***** assert (var ([1:7], [1:7]), 3) -***** assert (var ([eye(3)], [1:3]), [5/36, 2/9, 1/4], eps) -***** assert (var (ones (2,2,2), [1:2], 3), [(zeros (2,2))]) -***** assert (var ([1 2; 3 4], 0, 'all'), var ([1:4])) -***** assert (var (reshape ([1:8], 2, 2, 2), 0, [1 3]), [17/3 17/3], eps) -***** assert (var ([1 2 3;1 2 3], [], [1 2]), 0.8, eps) -***** assert (var ([]), NaN) -***** assert (var ([],[],1), NaN(1,0)) -***** assert (var ([],[],2), NaN(0,1)) -***** assert (var ([],[],3), []) -***** assert (var (ones (1,0)), NaN) -***** assert (var (ones (1,0), [], 1), NaN(1,0)) -***** assert (var (ones (1,0), [], 2), NaN) -***** assert (var (ones (1,0), [], 3), NaN(1,0)) -***** assert (var (ones (0,1)), NaN) -***** assert (var (ones (0,1), [], 1), NaN) -***** assert (var (ones (0,1), [], 2), NaN(0,1)) -***** assert (var (ones (0,1), [], 3), NaN(0,1)) -***** assert (var (ones (1,3,0,2)), NaN(1,1,0,2)) -***** assert (var (ones (1,3,0,2), [], 1), NaN(1,3,0,2)) -***** assert (var (ones (1,3,0,2), [], 2), NaN(1,1,0,2)) -***** assert (var (ones (1,3,0,2), [], 3), NaN(1,3,1,2)) -***** assert (var (ones (1,3,0,2), [], 4), NaN(1,3,0)) -***** test <*62395> - [~, m] = var (13); - assert (m, 13); - [~, m] = var (single(13)); - assert (m, single(13)); - [~, m] = var ([1, 2, 3; 3 2 1], []); - assert (m, [2 2 2]); - [~, m] = var ([1, 2, 3; 3 2 1], [], 1); - assert (m, [2 2 2]); - [~, m] = var ([1, 2, 3; 3 2 1], [], 2); - assert (m, [2 2]'); - [~, m] = var ([1, 2, 3; 3 2 1], [], 3); - assert (m, [1 2 3; 3 2 1]); -***** test <*62395> - [~, m] = var (5,99); - assert (m, 5); - [~, m] = var ([1:7], [1:7]); - assert (m, 5); - [~, m] = var ([eye(3)], [1:3]); - assert (m, [1/6, 1/3, 0.5], eps); - [~, m] = var (ones (2,2,2), [1:2], 3); - assert (m, ones (2,2)); - [~, m] = var ([1 2; 3 4], 0, 'all'); - assert (m, 2.5, eps); - [~, m] = var (reshape ([1:8], 2, 2, 2), 0, [1 3]); - assert (m, [3.5, 5.5], eps); -***** test <*62395> - [~, m] = var ([]); - assert (m, NaN); -***** test <*63203> - [v, m] = var (Inf); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = var (NaN); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([1, Inf, 3]); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = var ([1, Inf, 3]'); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = var ([1, NaN, 3]); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([1, NaN, 3]'); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([1, Inf, 3], [], 1); - assert (v, [0, NaN, 0]); - assert (m, [1, Inf, 3]); -***** test <*63203> - [v, m] = var ([1, Inf, 3], [], 2); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = var ([1, Inf, 3], [], 3); - assert (v, [0, NaN, 0]); - assert (m, [1, Inf, 3]); -***** test <*63203> - [v, m] = var ([1, NaN, 3], [], 1); - assert (v, [0, NaN, 0]); - assert (m, [1, NaN, 3]); -***** test <*63203> - [v, m] = var ([1, NaN, 3], [], 2); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([1, NaN, 3], [], 3); - assert (v, [0, NaN, 0]); - assert (m, [1, NaN, 3]); -***** test <*63203> - [v, m] = var ([1, 2, 3; 3, Inf, 5]); - assert (v, [2, NaN, 2]); - assert (m, [2, Inf, 4]); -***** test <*63203> - [v, m] = var ([1, Inf, 3; 3, Inf, 5]); - assert (v, [2, NaN, 2]); - assert (m, [2, Inf, 4]); -***** test <*63203> - [v, m] = var ([1, 2, 3; 3, NaN, 5]); - assert (v, [2, NaN, 2]); - assert (m, [2, NaN, 4]); -***** test <*63203> - [v, m] = var ([1, NaN, 3; 3, NaN, 5]); - assert (v, [2, NaN, 2]); - assert (m, [2, NaN, 4]); -***** test <*63203> - [v, m] = var ([Inf, 2, NaN]); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([Inf, 2, NaN]'); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([NaN, 2, Inf]); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([NaN, 2, Inf]'); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([Inf, 2, NaN], [], 1); - assert (v, [NaN, 0, NaN]); - assert (m, [Inf, 2, NaN]); -***** test <*63203> - [v, m] = var ([Inf, 2, NaN], [], 2); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([NaN, 2, Inf], [], 1); - assert (v, [NaN, 0, NaN]); - assert (m, [NaN, 2, Inf]); -***** test <*63203> - [v, m] = var ([NaN, 2, Inf], [], 2); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = var ([1, 3, NaN; 3, 5, Inf]); - assert (v, [2, 2, NaN]); - assert (m, [2, 4, NaN]); -***** test <*63203> - [v, m] = var ([1, 3, Inf; 3, 5, NaN]); - assert (v, [2, 2, NaN]); - assert (m, [2, 4, NaN]); -***** test <*63291> - [v, m] = var (2 * eye (2)); - assert (v, [2, 2]); - assert (m, [1, 1]); -***** test <*63291> - [v, m] = var (4 * eye (2), [1, 3]); - assert (v, [3, 3]); - assert (m, [1, 3]); -***** test <*63291> - [v, m] = var (sparse (2 * eye (2))); - assert (full (v), [2, 2]); - assert (full (m), [1, 1]); -***** test <*63291> - [v, m] = var (sparse (4 * eye (2)), [1, 3]); - assert (full (v), [3, 3]); - assert (full (m), [1, 3]); -***** test <63291> - [v, m] = var (sparse (eye (2))); - assert (issparse (v)); - assert (issparse (m)); -***** test <63291> - [v, m] = var (sparse (eye (2)), [1, 3]); - assert (issparse (v)); - assert (issparse (m)); -***** error var () -***** error var (['A'; 'B']) -***** error var ([1 2 3], 2) -***** error var ([1 2], [-1 0]) -***** error ... - var ([1 2], eye (2)) -***** error ... - var (ones (2, 2), [1 2], [1 2]) -***** error ... - var ([1 2], [1 2 3]) -***** error ... - var (1, [1 2]) -***** error ... - var ([1 2], [1 2], 1) -***** error ... - var (1, [], ones (2,2)) -***** error var (1, [], 1.5) -***** error var (1, [], 0) -***** error var () -***** error var (1, 2, "omitnan", 3) -***** error var (1, 2, 3, 4) -***** error var (1, 2, 3, 4, 5) -***** error var (1, "foo") -***** error var (1, [], "foo") -***** error var ([1 2], 2, "all") -***** error var ([1 2],0.5, "all") -***** error var (1, -1) -***** error var (1, [1 -1]) -***** error ... - var ([1 2 3], [1 -1 0]) -***** error var ({1:5}) -***** error var ("char") -***** error var (1, [], ones (2,2)) -***** error var (1, 0, 1.5) -***** error var (1, [], 0) -***** error var ([1 2 3], [], [-1 1]) -***** error ... - var (repmat ([1:20;6:25], [5 2 6 3]), 0, [1 2 2 2]) -***** error ... - var ([1 2 3; 2 3 4], [1 3 4]) -***** error ... - var ([1 2], eye (2)) -***** error ... - var ([1 2 3; 2 3 4], [1 3 4], 1) -***** error ... - var ([1 2 3; 2 3 4], [1 3], 2) -***** error ... - var (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), [2 3]) -***** error ... - var (1, [], 1, "all") -***** error ... - var ([1 2 3; 2 3 4], [1 3], "all") -***** error ... - var (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), "all") -160 tests, 160 passed, 0 known failure, 0 skipped -[inst/shadow9/std.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/std.m -***** test - x = [-10:10]; - y = [x;x+5;x-5]; - assert (std (x), sqrt (38.5), 1e-14); - assert (std (y, [], 2), sqrt ([38.5; 38.5; 38.5]), 1e-14); - assert (std (y, 0, 2), sqrt ([38.5; 38.5; 38.5]), 1e-14); - assert (std (y, 1, 2), ones (3,1) * sqrt (36.66666666666666), 1e-14); - assert (std (y, "all"), sqrt (54.19354838709678), 1e-14); - y(2,4) = NaN; - assert (std (y, "all"), NaN); - assert (std (y, "all", "includenan"), NaN); - assert (std (y, "all", "omitnan"), sqrt (55.01533580116342), 1e-14); - assert (std (y, 0, 2, "includenan"), sqrt ([38.5; NaN; 38.5]), 1e-14); - assert (std (y, [], 2), sqrt ([38.5; NaN; 38.5]), 1e-14); - assert (std (y, [], 2, "omitnan"), ... - sqrt ([38.5; 37.81842105263158; 38.5]), 1e-14); -***** assert (std ([4 NaN 6], [1 2 1], "omitnan"), 1, eps) -***** assert (std ([4 5 6], [1 NaN 1], "omitnan"), 1, eps) -***** assert (std (magic(3), [1 NaN 3], "omitnan"), sqrt(3)*[1 2 1], eps) -***** assert (std ([4 NaN 6], [1 2 1], "omitnan", "all"), 1, eps) -***** assert (std ([4 NaN 6], [1 2 1], "all", "omitnan"), 1, eps) -***** assert (std ([4 5 6], [1 NaN 1], "omitnan", "all"), 1, eps) -***** assert (std ([4 NaN 6], [1 2 1], 2, "omitnan"), 1, eps) -***** assert (std ([4 5 6], [1 NaN 1], 2, "omitnan"), 1, eps) -***** assert (std (magic(3), [1 NaN 3], 1, "omitnan"), sqrt(3)*[1 2 1], eps) -***** assert (std (magic(3), [1 NaN 3], 2, "omitnan"), sqrt(3)*[0.5;1;0.5], eps) -***** assert (std (4*[4 5; 6 7; 8 9], [1 3], 2, 'omitnan'), sqrt(3)*[1;1;1], eps) -***** assert (std ([4 NaN; 6 7; 8 9], [1 1 3], 1, 'omitnan'), [1.6 sqrt(3)/2], eps) -***** assert (std (4*[4 NaN; 6 7; 8 9], [1 3], 2, 'omitnan'), sqrt(3)*[0;1;1], eps) -***** assert (std (3*reshape(1:18, [3 3 2]), [1 2 3], 1, 'omitnan'), sqrt(5)*ones(1,3,2), eps) -***** assert (std (reshape(1:18, [3 3 2]), [1 2 3], 2, 'omitnan'), sqrt(5)*ones(3,1,2), eps) -***** assert (std (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 2], 'omitnan'), sqrt(60)*ones(1,1,2),eps) -***** assert (std (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 4], 'omitnan'), sqrt(6)*ones(1,3,2),eps) -***** assert (std (6*reshape(1:18, [3 3 2]), ones (3,3,2), [1:3], 'omitnan'), sqrt(969),eps) -***** test - x = reshape(1:18, [3 3 2]); - x([2, 14]) = NaN; - w = ones (3,3,2); - assert (std (16*x, w, [1:3], 'omitnan'), sqrt(6519), eps); -***** test - x = reshape(1:18, [3 3 2]); - w = ones (3,3,2); - w([2, 14]) = NaN; - assert (std (16*x, w, [1:3], 'omitnan'), sqrt(6519), eps); -***** assert (std ([1 2 3], "aLl"), 1); -***** assert (std ([1 2 3], "OmitNan"), 1); -***** assert (std ([1 2 3], "IncludeNan"), 1); -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - assert (size (std (x, 0, [3 2])), [10, 1, 1, 3]); - assert (size (std (x, 1, [1 2])), [1, 1, 6, 3]); - assert (size (std (x, [], [1 2 4])), [1, 1, 6]); - assert (size (std (x, 0, [1 4 3])), [1, 40]); - assert (size (std (x, [], [1 2 3 4])), [1, 1]); -***** assert (std (3*magic(3)), sqrt([63 144 63]), eps) -***** assert (std (3*magic(3), 'omitnan'), sqrt([63 144 63]), eps) -***** assert (std (3*magic(3), 1), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), 1, 'omitnan'), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), ones(1,3), 1), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), ones(1,3), 1, 'omitnan'), sqrt([42 96 42]), eps) -***** assert (std (2*magic(3), [1 1 NaN], 1, 'omitnan'), [5 4 1], eps) -***** assert (std (3*magic(3), ones(3,3)), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), ones(3,3), 'omitnan'), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 'omitnan'), sqrt([42 36 42]), eps) -***** assert (std (3*magic(3), ones(3,3), 1), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), ones(3,3), 1, 'omitnan'), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 1, 'omitnan'), sqrt([42 36 42]), eps) -***** assert (std (3*magic(3), ones(3,3), [1 4]), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), ones(3,3), [1 4], 'omitnan'), sqrt([42 96 42]), eps) -***** assert (std (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1],[1 4],'omitnan'), sqrt([42 36 42]), eps) -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - v = repmat (sqrt (33.38912133891213), [10, 1, 1, 3]); - assert (std (x, 0, [3, 2]), v, 1e-14); - v = repmat (sqrt (33.250), [10, 1, 1, 3]); - assert (std (x, 1, [3, 2]), v, 1e-14); - x(2,5,6,3) = NaN; - v(2,1,1,3) = NaN; - assert (std (x, 1, [3, 2]), v, 1e-14); - v = repmat (sqrt (33.38912133891213), [10 1 1 3]); - v(2,1,1,3) = NaN; - assert (std (x, [], [3, 2]), v, 1e-14); - v(2,1,1,3) = sqrt (33.40177912169048); - assert (std (x, [], [3, 2], "omitnan"), v, 1e-14); -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - [v, m] = std (x, 0, [3 2]); - assert (m, mean (x, [3 2])); - [v, m] = std (x, 0, [1 2]); - assert (m, mean (x, [1 2])); - [v, m] = std (x, 0, [1 3 4]); - assert (m, mean (x, [1 3 4])); -***** test - x = repmat ([1:20;6:25], [5, 2, 6, 3]); - x(2,5,6,3) = NaN; - [v, m] = std (x, 0, [3 2], "omitnan"); - assert (m, mean (x, [3 2], "omitnan")); -***** test - [v, m] = std (4 * eye (2), [1, 3]); - assert (v, sqrt ([3, 3]), 1e-14); - assert (m, [1, 3]); -***** assert (std (ones (2,2,2), [1:2], 3), [(zeros (2, 2))]); -***** assert (std (magic (3), [1:9], "all"), 2.581988897471611, 1e-14); -***** assert (std (ones (2,2), [], 3), zeros (2,2)); -***** assert (std (ones (2,2,2), [], 99), zeros (2,2,2)); -***** assert (std (magic (3), [], 3), zeros (3,3)); -***** assert (std (magic (3), [], 1), sqrt ([7, 16, 7])); -***** assert (std (magic (3), [], [1 3]), sqrt ([7, 16, 7])); -***** assert (std (magic (3), [], [1 99]), sqrt ([7, 16, 7])); -***** test - [v, m] = std ([]); - assert (v, NaN); - assert (m, NaN); - [v, m] = std (3); - assert (v, 0); - assert (m, 3); -***** assert (std (13), 0) -***** assert (std (single (13)), single (0)) -***** assert (std ([1,2,3]), 1) -***** assert (std ([1,2,3], 1), sqrt (2/3), eps) -***** assert (std ([1,2,3], [], 1), [0,0,0]) -***** assert (std ([1,2,3], [], 3), [0,0,0]) -***** assert (std (5, 99), 0) -***** assert (std (5, 99, 1), 0) -***** assert (std (5, 99, 2), 0) -***** assert (std ([5 3], [99 99], 2), 1) -***** assert (std ([1:7], [1:7]), sqrt (3)) -***** assert (std ([eye(3)], [1:3]), sqrt ([5/36, 2/9, 1/4]), eps) -***** assert (std (ones (2,2,2), [1:2], 3), [(zeros (2,2))]) -***** assert (std ([1 2; 3 4], 0, 'all'), std ([1:4])) -***** assert (std (reshape ([1:8], 2, 2, 2), 0, [1 3]), sqrt ([17/3 17/3]), eps) -***** assert (std ([1 2 3;1 2 3], [], [1 2]), sqrt (0.8), eps) -***** assert (std ([]), NaN) -***** assert (std ([],[],1), NaN(1,0)) -***** assert (std ([],[],2), NaN(0,1)) -***** assert (std ([],[],3), []) -***** assert (std (ones (1,0)), NaN) -***** assert (std (ones (1,0), [], 1), NaN(1,0)) -***** assert (std (ones (1,0), [], 2), NaN) -***** assert (std (ones (1,0), [], 3), NaN(1,0)) -***** assert (std (ones (0,1)), NaN) -***** assert (std (ones (0,1), [], 1), NaN) -***** assert (std (ones (0,1), [], 2), NaN(0,1)) -***** assert (std (ones (0,1), [], 3), NaN(0,1)) -***** assert (std (ones (1,3,0,2)), NaN(1,1,0,2)) -***** assert (std (ones (1,3,0,2), [], 1), NaN(1,3,0,2)) -***** assert (std (ones (1,3,0,2), [], 2), NaN(1,1,0,2)) -***** assert (std (ones (1,3,0,2), [], 3), NaN(1,3,1,2)) -***** assert (std (ones (1,3,0,2), [], 4), NaN(1,3,0)) -***** test <*62395> - [~, m] = std (13); - assert (m, 13); - [~, m] = std (single(13)); - assert (m, single(13)); - [~, m] = std ([1, 2, 3; 3 2 1], []); - assert (m, [2 2 2]); - [~, m] = std ([1, 2, 3; 3 2 1], [], 1); - assert (m, [2 2 2]); - [~, m] = std ([1, 2, 3; 3 2 1], [], 2); - assert (m, [2 2]'); - [~, m] = std ([1, 2, 3; 3 2 1], [], 3); - assert (m, [1 2 3; 3 2 1]); -***** test <*62395> - [~, m] = std (5,99); - assert (m, 5); - [~, m] = std ([1:7], [1:7]); - assert (m, 5); - [~, m] = std ([eye(3)], [1:3]); - assert (m, [1/6, 1/3, 0.5], eps); - [~, m] = std (ones (2,2,2), [1:2], 3); - assert (m, ones (2,2)); - [~, m] = std ([1 2; 3 4], 0, 'all'); - assert (m, 2.5, eps); - [~, m] = std (reshape ([1:8], 2, 2, 2), 0, [1 3]); - assert (m, [3.5, 5.5], eps); -***** test <*62395> - [~, m] = std ([]); - assert (m, NaN); -***** test <*63203> - [v, m] = std (Inf); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = std (NaN); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([1, Inf, 3]); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = std ([1, Inf, 3]'); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = std ([1, NaN, 3]); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([1, NaN, 3]'); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([1, Inf, 3], [], 1); - assert (v, [0, NaN, 0]); - assert (m, [1, Inf, 3]); -***** test <*63203> - [v, m] = std ([1, Inf, 3], [], 2); - assert (v, NaN); - assert (m, Inf); -***** test <*63203> - [v, m] = std ([1, Inf, 3], [], 3); - assert (v, [0, NaN, 0]); - assert (m, [1, Inf, 3]); -***** test <*63203> - [v, m] = std ([1, NaN, 3], [], 1); - assert (v, [0, NaN, 0]); - assert (m, [1, NaN, 3]); -***** test <*63203> - [v, m] = std ([1, NaN, 3], [], 2); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([1, NaN, 3], [], 3); - assert (v, [0, NaN, 0]); - assert (m, [1, NaN, 3]); -***** test <*63203> - [v, m] = std ([1, 2, 3; 3, Inf, 5]); - assert (v, sqrt ([2, NaN, 2])); - assert (m, [2, Inf, 4]); -***** test <*63203> - [v, m] = std ([1, Inf, 3; 3, Inf, 5]); - assert (v, sqrt ([2, NaN, 2])); - assert (m, [2, Inf, 4]); -***** test <*63203> - [v, m] = std ([1, 2, 3; 3, NaN, 5]); - assert (v, sqrt ([2, NaN, 2])); - assert (m, [2, NaN, 4]); -***** test <*63203> - [v, m] = std ([1, NaN, 3; 3, NaN, 5]); - assert (v, sqrt ([2, NaN, 2])); - assert (m, [2, NaN, 4]); -***** test <*63203> - [v, m] = std ([Inf, 2, NaN]); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([Inf, 2, NaN]'); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([NaN, 2, Inf]); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([NaN, 2, Inf]'); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([Inf, 2, NaN], [], 1); - assert (v, [NaN, 0, NaN]); - assert (m, [Inf, 2, NaN]); -***** test <*63203> - [v, m] = std ([Inf, 2, NaN], [], 2); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([NaN, 2, Inf], [], 1); - assert (v, [NaN, 0, NaN]); - assert (m, [NaN, 2, Inf]); -***** test <*63203> - [v, m] = std ([NaN, 2, Inf], [], 2); - assert (v, NaN); - assert (m, NaN); -***** test <*63203> - [v, m] = std ([1, 3, NaN; 3, 5, Inf]); - assert (v, sqrt ([2, 2, NaN])); - assert (m, [2, 4, NaN]); -***** test <*63203> - [v, m] = std ([1, 3, Inf; 3, 5, NaN]); - assert (v, sqrt ([2, 2, NaN])); - assert (m, [2, 4, NaN]); -***** test <*63291> - [v, m] = std (2 * eye (2)); - assert (v, sqrt ([2, 2])); - assert (m, [1, 1]); -***** test <*63291> - [v, m] = std (4 * eye (2), [1, 3]); - assert (v, sqrt ([3, 3])); - assert (m, [1, 3]); -***** test <*63291> - [v, m] = std (sparse (2 * eye (2))); - assert (full (v), sqrt ([2, 2])); - assert (full (m), [1, 1]); -***** test <*63291> - [v, m] = std (sparse (4 * eye (2)), [1, 3]); - assert (full (v), sqrt ([3, 3])); - assert (full (m), [1, 3]); -***** test <63291> - [v, m] = std (sparse (eye (2))); - assert (issparse (v)); - assert (issparse (m)); -***** test <63291> - [v, m] = std (sparse (eye (2)), [1, 3]); - assert (issparse (v)); - assert (issparse (m)); -***** error std () -***** error std (['A'; 'B']) -***** error std ([1 2 3], 2) -***** error std ([1 2], [-1 0]) -***** error ... - std ([1 2], eye (2)) -***** error ... - std (ones (2, 2), [1 2], [1 2]) -***** error ... - std ([1 2], [1 2 3]) -***** error ... - std (1, [1 2]) -***** error ... - std ([1 2], [1 2], 1) -***** error ... - std (1, [], ones (2,2)) -***** error std (1, [], 1.5) -***** error std (1, [], 0) -***** error std () -***** error std (1, 2, "omitnan", 3) -***** error std (1, 2, 3, 4) -***** error std (1, 2, 3, 4, 5) -***** error std (1, "foo") -***** error std (1, [], "foo") -***** error std ([1 2], 2, "all") -***** error std ([1 2],0.5, "all") -***** error std (1, -1) -***** error std (1, [1 -1]) -***** error ... - std ([1 2 3], [1 -1 0]) -***** error std ({1:5}) -***** error std ("char") -***** error std (1, [], ones (2,2)) -***** error std (1, 0, 1.5) -***** error std (1, [], 0) -***** error var ([1 2 3], [], [-1 1]) -***** error ... - std (repmat ([1:20;6:25], [5 2 6 3]), 0, [1 2 2 2]) -***** error ... - std ([1 2 3; 2 3 4], [1 3 4]) -***** error ... - std ([1 2], eye (2)) -***** error ... - std ([1 2 3; 2 3 4], [1 3 4], 1) -***** error ... - std ([1 2 3; 2 3 4], [1 3], 2) -***** error ... - std (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), [2 3]) -***** error ... - std (1, [], 1, "all") -***** error ... - std ([1 2 3; 2 3 4], [1 3], "all") -***** error ... - std (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), "all") -160 tests, 160 passed, 0 known failure, 0 skipped -[inst/lognstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/kmeans.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/stepwisefit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/stepwisefit.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)) - [X_use, b, bint, r, rint, stats] = stepwisefit(y, X, 0.05, 0.1, "corr"); - assert(X_use, [4 1]) - assert(b, regress(y, [ones(size(y)) X(:, X_use)], 0.05)) - [X_use, b, bint, r, rint, stats] = stepwisefit(y, X, [], [], "p"); - 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/sampsizepwr.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/sampsizepwr.m -***** demo - ## Compute the mean closest to 100 that can be determined to be - ## significantly different from 100 using a t-test with a sample size - ## of 60 and a power of 0.8. - mu1 = sampsizepwr ("t", [100, 10], [], 0.8, 60); - disp (mu1); -***** demo - ## Compute the sample sizes required to distinguish mu0 = 100 from - ## mu1 = 110 by a two-sample t-test with a ratio of the larger and the - ## smaller sample sizes of 1.5 and a power of 0.6. - [N1,N2] = sampsizepwr ("t2", [100, 10], 110, 0.6, [], "ratio", 1.5) -***** demo - ## Compute the sample size N required to distinguish p=.26 from p=.2 - ## with a binomial test. The result is approximate, so make a plot to - ## see if any smaller N values also have the required power of 0.6. - Napprox = sampsizepwr ("p", 0.2, 0.26, 0.6); - nn = 1:250; - pwr = sampsizepwr ("p", 0.2, 0.26, [], nn); - Nexact = min (nn(pwr >= 0.6)); - plot(nn,pwr,'b-', [Napprox Nexact],pwr([Napprox Nexact]),'ro'); - grid on -***** demo - ## The company must test 52 bottles to detect the difference between a mean - ## volume of 100 mL and 102 mL with a power of 0.80. Generate a power curve - ## to visualize how the sample size affects the power of the test. - - nout = sampsizepwr('t',[100 5],102,0.80); - nn = 1:100; - pwrout = sampsizepwr('t',[100 5],102,[],nn); - - figure; - plot (nn, pwrout, "b-", nout, 0.8, "ro") - title ("Power versus Sample Size") - xlabel ("Sample Size") - ylabel ("Power") -***** error ... - out = sampsizepwr ([], [100, 10], [], 0.8, 60); -***** error ... - out = sampsizepwr (3, [100, 10], [], 0.8, 60); -***** error ... - out = sampsizepwr ({"t", "t2"}, [100, 10], [], 0.8, 60); -***** error ... - out = sampsizepwr ("reg", [100, 10], [], 0.8, 60); -***** error ... - out = sampsizepwr ("t", ["a", "e"], [], 0.8, 60); -***** error ... - out = sampsizepwr ("z", 100, [], 0.8, 60); -***** error ... - out = sampsizepwr ("t", 100, [], 0.8, 60); -***** error ... - out = sampsizepwr ("t2", 60, [], 0.8, 60); -***** error ... - out = sampsizepwr ("var", [100, 10], [], 0.8, 60); -***** error ... - out = sampsizepwr ("p", [100, 10], [], 0.8, 60); -***** error ... - out = sampsizepwr ("r", [100, 10], [], 0.8, 60); -***** error ... - [out, N1] = sampsizepwr ("z", [100, 10], [], 0.8, 60); -***** error ... - [out, N1] = sampsizepwr ("t", [100, 10], [], 0.8, 60); -***** error ... - [out, N1] = sampsizepwr ("var", 2, [], 0.8, 60); -***** error ... - [out, N1] = sampsizepwr ("p", 0.1, [], 0.8, 60); -***** error ... - [out, N1] = sampsizepwr ("r", 0.5, [], 0.8, 60); -***** error ... - out = sampsizepwr ("z", [100, 0], [], 0.8, 60); -***** error ... - out = sampsizepwr ("z", [100, -5], [], 0.8, 60); -***** error ... - out = sampsizepwr ("t", [100, 0], [], 0.8, 60); -***** error ... - out = sampsizepwr ("t", [100, -5], [], 0.8, 60); -***** error ... - [out, N1] = sampsizepwr ("t2", [100, 0], [], 0.8, 60); -***** error ... - [out, N1] = sampsizepwr ("t2", [100, -5], [], 0.8, 60); -***** error ... - out = sampsizepwr ("var", 0, [], 0.8, 60); -***** error ... - out = sampsizepwr ("var", -5, [], 0.8, 60); -***** error ... - out = sampsizepwr ("p", 0, [], 0.8, 60); -***** error ... - out = sampsizepwr ("p", 1.2, [], 0.8, 60); -***** error ... - out = sampsizepwr ("r", -1.5, [], 0.8, 60); -***** error ... - out = sampsizepwr ("r", -1, [], 0.8, 60); -***** error ... - out = sampsizepwr ("r", 1.2, [], 0.8, 60); -***** error ... - out = sampsizepwr ("r", 0, [], 0.8, 60); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", -0.2); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", 0); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", 1.5); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", "zero"); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "tail", 1.5); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "tail", {"both", "left"}); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "tail", "other"); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "ratio", "some"); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "ratio", 0.5); -***** error ... - out = sampsizepwr ("r", 0.2, [], 0.8, 60, "ratio", [2, 1.3, 0.3]); -***** error ... - out = sampsizepwr ("z", [100, 5], [], [], 60); -***** error ... - out = sampsizepwr ("z", [100, 5], 110, [], []); -***** error ... - out = sampsizepwr ("z", [100, 5], [], 0.8, []); -***** error ... - out = sampsizepwr ("z", [100, 5], 110, 0.8, 60); -***** error ... - out = sampsizepwr ("z", [100, 5], "mu", [], 60); -***** error ... - out = sampsizepwr ("var", 5, -1, [], 60); -***** error ... - out = sampsizepwr ("p", 0.8, 1.2, [], 60, "tail", "right"); -***** error ... - out = sampsizepwr ("r", 0.8, 1.2, [], 60); -***** error ... - out = sampsizepwr ("r", 0.8, -1.2, [], 60); -***** error ... - out = sampsizepwr ("z", [100, 5], 110, 1.2); -***** error ... - out = sampsizepwr ("z", [100, 5], 110, 0); -***** error ... - out = sampsizepwr ("z", [100, 5], 110, 0.05, [], "alpha", 0.1); -***** error ... - out = sampsizepwr ("z", [100, 5], [], [0.8, 0.7], [60, 80, 100]); -***** error ... - out = sampsizepwr ("t", [100, 5], 100, 0.8, []); -***** error ... - out = sampsizepwr ("t", [100, 5], 110, 0.8, [], "tail", "left"); -***** error ... - out = sampsizepwr ("t", [100, 5], 90, 0.8, [], "tail", "right"); -***** warning ... - Napprox = sampsizepwr ("p", 0.2, 0.26, 0.6); -***** warning ... - Napprox = sampsizepwr ("p", 0.30, 0.36, 0.8); -***** test - mu1 = sampsizepwr ("t", [100, 10], [], 0.8, 60); - assert (mu1, 103.67704316, 1e-8); -***** test - [N1,N2] = sampsizepwr ("t2", [100, 10], 110, 0.6, [], "ratio", 1.5); - assert (N1, 9); - assert (N2, 14); -***** test - nn = 1:250; - pwr = sampsizepwr ("p", 0.2, 0.26, [], nn); - pwr_out = [0, 0.0676, 0.0176, 0.0566, 0.0181, 0.0431, 0.0802, 0.0322]; - assert (pwr([1:8]), pwr_out, 1e-4 * ones (1,8)); - pwr_out = [0.59275, 0.6073, 0.62166, 0.6358, 0.6497, 0.6087, 0.6229, 0.6369]; - assert (pwr([243:end]), pwr_out, 1e-4 * ones (1,8)); -***** test - nout = sampsizepwr ("t", [100, 5], 102, 0.80); - assert (nout, 52); -***** test - power = sampsizepwr ("t", [20, 5], 25, [], 5, "Tail", "right"); - assert (power, 0.5797373588621888, 1e-14); -***** test - nout = sampsizepwr ("t", [20, 5], 25, 0.99, [], "Tail", "right"); - assert (nout, 18); -***** test - p1out = sampsizepwr ("t", [20, 5], [], 0.95, 10, "Tail", "right"); - assert (p1out, 25.65317979360237, 1e-14); -***** test - pwr = sampsizepwr ("t2", [1.4, 0.2], 1.7, [], 5, "Ratio", 2); - assert (pwr, 0.716504004686586, 1e-14); -***** test - n = sampsizepwr ("t2", [1.4, 0.2], 1.7, 0.9, []); - assert (n, 11); -***** test - [n1, n2] = sampsizepwr ("t2", [1.4, 0.2], 1.7, 0.9, [], "Ratio", 2); - assert ([n1, n2], [8, 16]); -68 tests, 68 passed, 0 known failure, 0 skipped -[inst/pdist.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/gamlike.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gamlike.m -***** error gamlike (1); -***** error gamlike (1, 2, 3); -***** test - [nLogL] = gamlike([2, 3], [2, 3, 4, 5, 6, 7, 8, 9]); - assert (nLogL, 19.4426, 1e-4); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/binotest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/barttest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/barttest.m -***** error barttest () -***** error barttest ([2,NaN;3,4]) -***** error barttest (ones (30, 4), "alpha") -***** error barttest (ones (30, 4), 0) -***** error barttest (ones (30, 4), 1.2) -***** error barttest (ones (30, 4), [0.2, 0.05]) -***** error barttest (ones (30, 1)) -***** error barttest (ones (30, 1), 0.05) -***** test - x = [2, 3, 4, 5, 6, 7, 8, 9; 1, 2, 3, 4, 5, 6, 7, 8]'; - [ndim, pval, chisq] = barttest (x); - assert (ndim, 2); - assert (pval, 0); - ## assert (chisq, 512.0558, 1e-4); Result differs between octave 6 and 7 ? -***** test - x = [0.53767, 0.62702, -0.10224, -0.25485, 1.4193, 1.5237 ; ... - 1.8339, 1.6452, -0.24145, -0.23444, 0.29158, 0.1634 ; ... - -2.2588, -2.1351, 0.31286, 0.39396, 0.19781, 0.20995 ; ... - 0.86217, 1.0835, 0.31286, 0.46499, 1.5877, 1.495 ; ... - 0.31877, 0.38454, -0.86488, -0.63839, -0.80447, -0.7536 ; ... - -1.3077, -1.1487, -0.030051, -0.017629, 0.69662, 0.60497 ; ... - -0.43359, -0.32672, -0.16488, -0.37364, 0.83509, 0.89586 ; ... - 0.34262, 0.29639, 0.62771, 0.51672, -0.24372, -0.13698 ; ... - 3.5784, 3.5841, 1.0933, 0.93258, 0.21567, 0.455 ; ... - 2.7694, 2.6307, 1.1093, 1.4298, -1.1658, -1.1816 ; ... - -1.3499, -1.2111, -0.86365, -0.94186, -1.148, -1.4381 ; ... - 3.0349, 2.8428, 0.077359, 0.18211, 0.10487, -0.014613; ... - 0.7254, 0.56737, -1.2141, -1.2291, 0.72225, 0.90612 ; ... - -0.063055,-0.17662, -1.1135, -0.97701, 2.5855, 2.4084 ; ... - 0.71474, 0.29225, -0.0068493, -0.11468, -0.66689, -0.52466 ; ... - -0.20497, -7.8874e-06, 1.5326, 1.3195, 0.18733, 0.20296 ; ... - -0.12414, -0.077029, -0.76967, -0.96262, -0.082494, 0.121 ; ... - 1.4897, 1.3683, 0.37138, 0.43653, -1.933, -2.1903 ; ... - 1.409, 1.5882, -0.22558, -0.24835, -0.43897, -0.46247 ; ... - 1.4172, 1.1616, 1.1174, 1.0785, -1.7947, -1.9471 ]; - [ndim, pval, chisq] = barttest (x); - assert (ndim, 3); - assert (pval, [0; 0; 0; 0.52063; 0.34314], 1e-5); - chisq_out = [251.6802; 210.2670; 153.1773; 4.2026; 2.1392]; - assert (chisq, chisq_out, 1e-4); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/nanmin.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/nanmin.m -***** assert (nanmin ([2 4 NaN 7]), 2) -***** assert (nanmin ([2 4 NaN Inf]), 2) -***** assert (nanmin ([1 NaN 3; NaN 5 6; 7 8 NaN]), [1, 5, 3]) -***** assert (nanmin ([1 NaN 3; NaN 5 6; 7 8 NaN]'), [1, 5, 7]) -***** assert (nanmin (single ([1 NaN 3; NaN 5 6; 7 8 NaN])), single ([1 5 3])) 5 tests, 5 passed, 0 known failure, 0 skipped -[inst/mhsample.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/mhsample.m -***** demo - ## Define function to sample - d = 2; - mu = [-1; 2]; - Sigma = rand (d); - Sigma = (Sigma + Sigma'); - Sigma += eye (d) * abs (eigs (Sigma, 1, "sa")) * 1.1; - pdf = @(x)(2*pi)^(-d/2)*det(Sigma)^-.5*exp(-.5*sum((x.'-mu).*(Sigma\(x.'-mu)),1)); - ## Inputs - start = ones (1, 2); - nsamples = 500; - sym = true; - K = 500; - m = 10; - proprnd = @(x) (rand (size (x)) - .5) * 3 + x; - [smpl, accept] = mhsample (start, nsamples, "pdf", pdf, "proprnd", proprnd, ... - "symmetric", sym, "burnin", K, "thin", m); - figure; - hold on; - plot (smpl(:, 1), smpl(:, 2), 'x'); - [x, y] = meshgrid (linspace (-6, 4), linspace(-3, 7)); - z = reshape (pdf ([x(:), y(:)]), size(x)); - mesh (x, y, z, "facecolor", "None"); - ## Using sample points to find the volume of half a sphere with radius of .5 - f = @(x) ((.25-(x(:,1)+1).^2-(x(:,2)-2).^2).^.5.*(((x(:,1)+1).^2+(x(:,2)-2).^2)<.25)).'; - int = mean (f (smpl) ./ pdf (smpl)); - errest = std (f (smpl) ./ pdf (smpl)) / nsamples ^ .5; - trueerr = abs (2 / 3 * pi * .25 ^ (3 / 2) - int); - printf ("Monte Carlo integral estimate int f(x) dx = %f\n", int); - printf ("Monte Carlo integral error estimate %f\n", errest); - printf ("The actual error %f\n", trueerr); - mesh (x, y, reshape (f([x(:), y(:)]), size(x)), "facecolor", "None"); -***** demo - ## Integrate truncated normal distribution to find normilization constant - pdf = @(x) exp (-.5*x.^2)/(pi^.5*2^.5); - nsamples = 1e3; - proprnd = @(x) (rand (size (x)) - .5) * 3 + x; - [smpl, accept] = mhsample (1, nsamples, "pdf", pdf, "proprnd", proprnd, ... - "symmetric", true, "thin", 4); - f = @(x) exp(-.5 * x .^ 2) .* (x >= -2 & x <= 2); - x = linspace (-3, 3, 1000); - area(x, f(x)); - xlabel ('x'); - ylabel ('f(x)'); - int = mean (f (smpl) ./ pdf (smpl)); - errest = std (f (smpl) ./ pdf (smpl)) / nsamples^ .5; - trueerr = abs (erf (2 ^ .5) * 2 ^ .5 * pi ^ .5 - int); - printf ("Monte Carlo integral estimate int f(x) dx = %f\n", int); - printf ("Monte Carlo integral error estimate %f\n", errest); - printf ("The actual error %f\n", trueerr); -***** test - nchain = 1e4; - start = rand (nchain, 1); - nsamples = 1e3; - pdf = @(x) exp (-.5*(x-1).^2)/(2*pi)^.5; - proppdf = @(x, y) 1/3; - proprnd = @(x) 3 * (rand (size (x)) - .5) + x; - [smpl, accept] = mhsample (start, nsamples, "pdf", pdf, "proppdf", proppdf, ... - "proprnd", proprnd, "thin", 2, "nchain", nchain, ... - "burnin", 0); - assert (mean (mean (smpl, 1), 3), 1, .01); - assert (mean (var (smpl, 1), 3), 1, .01) -***** error mhsample (); -***** error mhsample (1); -***** error mhsample (1, 1); -***** error mhsample (1, 1, "pdf", @(x)x); -***** error mhsample (1, 1, "pdf", @(x)x, "proprnd", @(x)x+rand(size(x))); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/bartlett_test.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/bartlett_test.m -***** error bartlett_test () -***** error ... - bartlett_test (1, 2, 3, 4); -***** error bartlett_test (randn (50, 2), 0); -***** error ... - bartlett_test (randn (50, 2), [1, 2, 3]); -***** error ... - bartlett_test (randn (50, 1), ones (55, 1)); -***** error ... - bartlett_test (randn (50, 1), ones (50, 2)); -***** error ... - bartlett_test (randn (50, 2), [], 1.2); -***** error ... - bartlett_test (randn (50, 2), [], "alpha"); -***** error ... - bartlett_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], 1.2); -***** error ... - bartlett_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], "err"); -***** warning ... - bartlett_test (randn (50, 1), [ones(24, 1); 2*ones(25, 1); 3]); -***** test - load examgrades - [h, pval, chisq, df] = bartlett_test (grades); - assert (h, 1); - assert (pval, 7.908647337018238e-08, 1e-14); - assert (chisq, 38.73324, 1e-5); - assert (df, 4); -***** test - load examgrades - [h, pval, chisq, df] = bartlett_test (grades(:,[2:4])); - assert (h, 1); - assert (pval, 0.01172, 1e-5); - assert (chisq, 8.89274, 1e-5); - assert (df, 2); -***** test - load examgrades - [h, pval, chisq, df] = bartlett_test (grades(:,[1,4])); - assert (h, 0); - assert (pval, 0.88118, 1e-5); - assert (chisq, 0.02234, 1e-5); - assert (df, 1); -***** test - load examgrades - grades = [grades; nan(10, 5)]; - [h, pval, chisq, df] = bartlett_test (grades(:,[1,4])); - assert (h, 0); - assert (pval, 0.88118, 1e-5); - assert (chisq, 0.02234, 1e-5); - assert (df, 1); +[inst/ranksum.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ranksum.m ***** test - load examgrades - [h, pval, chisq, df] = bartlett_test (grades(:,[2,5]), 0.01); - assert (h, 0); - assert (pval, 0.01791, 1e-5); - assert (chisq, 5.60486, 1e-5); - assert (df, 1); -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/adtest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/adtest.m -***** error adtest (); -***** error adtest (ones (20,2)); -***** error adtest ([1+i,0-3i]); -***** error ... - adtest (ones (20,1), "Distribution", "normal"); -***** error ... - adtest (rand (20,1), "Distribution", {"normal", 5, 3}); -***** error ... - adtest (rand (20,1), "Distribution", {"norm", 5}); -***** error ... - adtest (rand (20,1), "Distribution", {"exp", 5, 4}); -***** error ... - adtest (rand (20,1), "Distribution", {"ev", 5}); -***** error ... - adtest (rand (20,1), "Distribution", {"logn", 5, 3, 2}); -***** error ... - adtest (rand (20,1), "Distribution", {"Weibull", 5}); -***** error ... - adtest (rand (20,1), "Distribution", 35); -***** error ... - adtest (rand (20,1), "Name", "norm"); -***** error ... - adtest (rand (20,1), "Name", {"norm", 75, 10}); -***** error ... - adtest (rand (20,1), "Distribution", "norm", "Asymptotic", true); -***** error ... - adtest (rand (20,1), "MCTol", 0.001, "Asymptotic", true); -***** error ... - adtest (rand (20,1), "Distribution", {"norm", 5, 3}, "MCTol", 0.001, ... - "Asymptotic", true); -***** error ... - [h, pval, ADstat, CV] = adtest (ones (20,1), "Distribution", {"norm",5,3},... - "Alpha", 0.000000001); -***** error ... - [h, pval, ADstat, CV] = adtest (ones (20,1), "Distribution", {"norm",5,3},... - "Alpha", 0.999999999); -***** error ... - adtest (10); -***** warning ... - adtest (ones (20,1), "Alpha", 0.000001); -***** warning ... - adtest (normrnd(0,1,100,1), "Alpha", 0.99999); -***** warning ... - adtest (normrnd(0,1,100,1), "Alpha", 0.00001); + mileage = [33.3, 34.5, 37.4; 33.4, 34.8, 36.8; ... + 32.9, 33.8, 37.6; 32.6, 33.4, 36.6; ... + 32.5, 33.7, 37.0; 33.0, 33.9, 36.7]; + [p,h,stats] = ranksum(mileage(:,1),mileage(:,2)); + assert (p, 0.004329004329004329, 1e-14); + assert (h, true); + assert (stats.ranksum, 21.5); ***** test - load examgrades - x = grades(:,1); - [h, pval, adstat, cv] = adtest (x); + year1 = [51 52 62 62 52 52 51 53 59 63 59 56 63 74 68 86 82 70 69 75 73 ... + 49 47 50 60 59 60 62 61 71]'; + year2 = [54 53 64 66 57 53 54 54 62 66 59 59 67 76 75 86 82 67 74 80 75 ... + 54 50 53 62 62 62 72 60 67]'; + [p,h,stats] = ranksum(year1, year2, "alpha", 0.01, "tail", "left"); + assert (p, 0.1270832752950605, 1e-14); assert (h, false); - assert (pval, 0.1854, 1e-4); - assert (adstat, 0.5194, 1e-4); - assert (cv, 0.7470, 1e-4); -***** test - load examgrades - x = grades(:,1); - [h, pval, adstat, cv] = adtest (x, "Distribution", "ev"); + assert (stats.ranksum, 837.5); + assert (stats.zval, -1.140287483634606, 1e-14); + [p,h,stats] = ranksum(year1, year2, "alpha", 0.01, "tail", "left", ... + "method", "exact"); + assert (p, 0.127343916432862, 1e-14); assert (h, false); - assert (pval, 0.071363, 1e-6); + assert (stats.ranksum, 837.5); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/vartest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/vartest.m +***** error vartest (); +***** error vartest ([1, 2, 3, 4], -0.5); +***** error ... + vartest ([1, 2, 3, 4], 1, "alpha", 0); +***** error ... + vartest ([1, 2, 3, 4], 1, "alpha", 1.2); +***** error ... + vartest ([1, 2, 3, 4], 1, "alpha", "val"); +***** error ... + vartest ([1, 2, 3, 4], 1, "tail", "val"); +***** error ... + vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail", "val"); +***** error ... + vartest ([1, 2, 3, 4], 1, "dim", 3); +***** error ... + vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail", "both", "dim", 3); +***** error ... + vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail", "both", "badoption", 3); +***** error ... + vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail"); ***** test - load examgrades - x = grades(:,1); - [h, pval, adstat, cv] = adtest (x, "Distribution", {"norm", 75, 10}); - assert (h, false); - assert (pval, 0.4687, 1e-4); -25 tests, 25 passed, 0 known failure, 0 skipped + load carsmall + [h, pval, ci] = vartest (MPG, 7^2); + assert (h, 1); + assert (pval, 0.04335086742174443, 1e-14); + assert (ci, [49.397; 88.039], 1e-3); +12 tests, 12 passed, 0 known failure, 0 skipped [inst/tiedrank.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/tiedrank.m ***** test @@ -6147,45 +3225,115 @@ assert (r, [1, 2, 3, 4, 5]); assert (tieadj, [0 0 0]'); 2 tests, 2 passed, 0 known failure, 0 skipped -[inst/inconsistent.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/inconsistent.m -***** error inconsistent () -***** error inconsistent ([1 2 1], 2, 3) -***** error inconsistent (ones (2, 2)) -***** error inconsistent ([1 2 1], -1) -***** error inconsistent ([1 2 1], 1.3) -***** error inconsistent ([1 2 1], [1 1]) -***** error inconsistent (ones (2, 3)) +[inst/chi2test.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/chi2test.m +***** error chi2test (); +***** error chi2test ([1, 2, 3, 4, 5]); +***** error chi2test ([1, 2; 2, 1+3i]); +***** error chi2test ([NaN, 6; 34, 12]); +***** error ... + p = chi2test (ones (3, 3), "mutual", []); +***** error ... + p = chi2test (ones (3, 3, 3), "testtype", 2); +***** error ... + p = chi2test (ones (3, 3, 3), "mutual"); +***** error ... + p = chi2test (ones (3, 3, 3), "joint", ["a"]); +***** error ... + p = chi2test (ones (3, 3, 3), "joint", [2, 3]); +***** error ... + p = chi2test (ones (3, 3, 3, 4), "mutual", []) +***** warning p = chi2test (ones (2)); +***** warning p = chi2test (ones (3, 2)); +***** warning p = chi2test (0.4 * ones (3)); ***** test - load fisheriris; - Z = linkage(meas, 'average', 'chebychev'); - assert (cond (inconsistent (Z)), 39.9, 1e-3); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/linkage.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/linkage.m -***** shared x, t - x = reshape (mod (magic (6),5), [], 3); - t = 1e-6; -***** assert (cond (linkage (pdist (x))), 34.119045, t); -***** assert (cond (linkage (pdist (x), "complete")), 21.793345, t); -***** assert (cond (linkage (pdist (x), "average")), 27.045012, t); -***** assert (cond (linkage (pdist (x), "weighted")), 27.412889, t); - lastwarn(); # Clear last warning before the test -***** warning linkage (pdist (x), "centroid"); + x = [11, 3, 8; 2, 9, 14; 12, 13, 28]; + p = chi2test (x); + assert (p, 0.017787, 1e-6); ***** test - warning off Octave:clustering - assert (cond (linkage (pdist (x), "centroid")), 27.457477, t); - warning on Octave:clustering -***** warning linkage (pdist (x), "median"); + x = [11, 3, 8; 2, 9, 14; 12, 13, 28]; + [p, chisq] = chi2test (x); + assert (chisq, 11.9421, 1e-4); ***** test - warning off Octave:clustering - assert (cond (linkage (pdist (x), "median")), 27.683325, t); - warning on Octave:clustering -***** 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 + x = [11, 3, 8; 2, 9, 14; 12, 13, 28]; + [p, chisq, df] = chi2test (x); + assert (df, 4); +***** test +***** shared x + x(:,:,1) = [59, 32; 9,16]; + x(:,:,2) = [55, 24;12,33]; + x(:,:,3) = [107,80;17,56];%! +***** assert (chi2test (x), 2.282063427117009e-11, 1e-14); +***** assert (chi2test (x, "mutual", []), 2.282063427117009e-11, 1e-14); +***** assert (chi2test (x, "joint", 1), 1.164834895206468e-11, 1e-14); +***** assert (chi2test (x, "joint", 2), 7.771350230001417e-11, 1e-14); +***** assert (chi2test (x, "joint", 3), 0.07151361728026107, 1e-14); +***** assert (chi2test (x, "marginal", 1), 0, 1e-14); +***** assert (chi2test (x, "marginal", 2), 6.347555814301131e-11, 1e-14); +***** assert (chi2test (x, "marginal", 3), 0, 1e-14); +***** assert (chi2test (x, "conditional", 1), 0.2303114201312508, 1e-14); +***** assert (chi2test (x, "conditional", 2), 0.0958810684407079, 1e-14); +***** assert (chi2test (x, "conditional", 3), 2.648037344954446e-11, 1e-14); +***** assert (chi2test (x, "homogeneous", []), 0.4485579470993741, 1e-14); +***** test + [pval, chisq, df, E] = chi2test (x); + assert (chisq, 64.0982, 1e-4); + assert (df, 7); + assert (E(:,:,1), [42.903, 39.921; 17.185, 15.991], ones (2, 2) * 1e-3); +***** test + [pval, chisq, df, E] = chi2test (x, "joint", 2); + assert (chisq, 56.0943, 1e-4); + assert (df, 5); + assert (E(:,:,2), [40.922, 23.310; 38.078, 21.690], ones (2, 2) * 1e-3); +***** test + [pval, chisq, df, E] = chi2test (x, "marginal", 3); + assert (chisq, 146.6058, 1e-4); + assert (df, 9); + assert (E(:,1,1), [61.642; 57.358], ones (2, 1) * 1e-3); +***** test + [pval, chisq, df, E] = chi2test (x, "conditional", 3); + assert (chisq, 52.2509, 1e-4); + assert (df, 3); + assert (E(:,:,1), [53.345, 37.655; 14.655, 10.345], ones (2, 2) * 1e-3); +***** test + [pval, chisq, df, E] = chi2test (x, "homogeneous", []); + assert (chisq, 1.6034, 1e-4); + assert (df, 2); + assert (E(:,:,1), [60.827, 31.382; 7.173, 16.618], ones (2, 2) * 1e-3); +34 tests, 34 passed, 0 known failure, 0 skipped +[inst/nanmax.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/nanmax.m +***** assert (nanmax ([2 4 NaN 7]), 7) +***** assert (nanmax ([2 4 NaN Inf]), Inf) +***** assert (nanmax ([1 NaN 3; NaN 5 6; 7 8 NaN]), [7, 8, 6]) +***** assert (nanmax ([1 NaN 3; NaN 5 6; 7 8 NaN]'), [3, 6, 8]) +***** assert (nanmax (single ([1 NaN 3; NaN 5 6; 7 8 NaN])), single ([7 8 6])) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/wblstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/cmdscale.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/hist3.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hist3.m ***** demo @@ -6364,73 +3512,551 @@ assert (c, exp_c) assert (nn, exp_nn, eps*100) 16 tests, 16 passed, 0 known failure, 0 skipped -[inst/hygestat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hygestat.m +[inst/raylstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/raylstat.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); + 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/lognstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/lognstat.m ***** 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); + 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/grp2idx.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/grp2idx.m +[inst/gmdistribution.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gmdistribution.m ***** test - in = [true false false true]; - out = {[1; 2; 2; 1] {"1"; "0"} [true; false]}; - assert (nthargout (1:3, @grp2idx, in), out) - assert (nthargout (1:3, @grp2idx, in), nthargout (1:3, @grp2idx, in')) + 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/ztest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ztest.m +***** error ztest (); +***** error ... + ztest ([1, 2, 3, 4], 2, -0.5); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "alpha", 0); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "alpha", 1.2); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "alpha", "val"); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "tail", "val"); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "alpha", 0.01, "tail", "val"); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "dim", 3); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "alpha", 0.01, "tail", "both", "dim", 3); +***** error ... + ztest ([1, 2, 3, 4], 1, 2, "alpha", 0.01, "tail", "both", "badoption", 3); ***** test - assert (nthargout (1:3, @grp2idx, [false, true]), - {[1; 2] {"0"; "1"} [false; true]}); - assert (nthargout (1:3, @grp2idx, [true, false]), - {[1; 2] {"1"; "0"} [true; false]}); -***** 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]), - {[1; 2; 3; 2; 2; 4; 1; 5; 6; 2], {"1"; "-3"; "-2"; "2"; "-1"; "3"}, ... - [1; -3; -2; 2; -1; 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"}}) -***** test assert (nthargout (1:3, @grp2idx, ["sci"; "oct"; "sci"; "oct"; "oct"]), - {[1; 2; 1; 2; 2] {"sci"; "oct"} ["sci"; "oct"]}); -***** test assert (nthargout (1:3, @grp2idx, {"sci"; "oct"; "sci"; "oct"; "oct"}), - {[1; 2; 1; 2; 2] {"sci"; "oct"} {"sci"; "oct"}}); -***** test assert (nthargout (1:3, @grp2idx, {"sa" "et" "et" "" "sa"}), - {[1; 2; 2; NaN; 1] {"sa"; "et"} {"sa"; "et"}}) + load carsmall + [h, pval, ci] = ztest (MPG, mean (MPG, "omitnan"), std (MPG, "omitnan")); + assert (h, 0); + assert (pval, 1, 1e-14); + assert (ci, [22.094; 25.343], 1e-3); +***** test + load carsmall + [h, pval, ci] = ztest (MPG, 26, 8); + assert (h, 1); + assert (pval, 0.00568359158544743, 1e-14); + assert (ci, [22.101; 25.335], 1e-3); +***** test + load carsmall + [h, pval, ci] = ztest (MPG, 26, 4); + assert (h, 1); + assert (pval, 3.184168011941316e-08, 1e-14); + assert (ci, [22.909; 24.527], 1e-3); +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/gpfit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gpfit.m +***** error gpfit () +***** error gpfit (ones (2)) +***** error gpfit ([-1, 2]) +***** error gpfit ([0, 1, 2]) +***** error gpfit ([1, 2], 0) +***** error gpfit ([1, 2], 1.2) +***** error ... + gpfit ([1:10], 0.05, 5) +***** test + shape = 5; scale = 2; + x = gprnd (shape, scale, 0, 1, 100000); + [hat, ci] = gpfit (x); + assert (hat, [shape, scale], 1e-1); + assert (ci, [shape, scale; shape, scale], 2e-1); +***** test + shape = 1; scale = 1; + x = gprnd (shape, scale, 0, 1, 100000); + [hat, ci] = gpfit (x); + assert (hat, [shape, scale], 1e-1); + assert (ci, [shape, scale; shape, scale], 1e-1); +***** test + shape = 3; scale = 2; + x = gprnd (shape, scale, 0, 1, 100000); + [hat, ci] = gpfit (x); + assert (hat, [shape, scale], 1e-1); + assert (ci, [shape, scale; shape, scale], 1e-1); 10 tests, 10 passed, 0 known failure, 0 skipped -[inst/manovacluster.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/manovacluster.m +[inst/gamfit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/logit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/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/geomean.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/geomean.m +***** test + x = [-10:10]; + y = [x;x+5;x-5]; + assert (geomean (x), 0); + assert (geomean (y, 2), [0, 0, 0]'); + assert (geomean (y, "all"), 0); + y(2,4) = NaN; + assert (geomean (y', "omitnan"), [0 0 0]); + z = y + 20; + assert (geomean (z, "all"), NaN); + m = [19.02099329497543 NaN 13.60912525683438]; + assert (geomean (z'), m, 4e-14); + assert (geomean (z', "includenan"), m, 4e-14); + m = [19.02099329497543 24.59957418295707 13.60912525683438]; + assert (geomean (z', "omitnan"), m, 4e-14); + assert (geomean (z, 2, "omitnan"), m', 4e-14); +***** test + assert (geomean (true, "all"), 1); + assert (geomean (false), 0); + assert (geomean ([true false true]), 0); + assert (geomean ([true false true], 1), [1 0 1]); + assert (geomean ([true false NaN], 1), [1 0 NaN]); + assert (geomean ([true false NaN], 2), NaN); + assert (geomean ([true false NaN], 2, "omitnan"), 0); +***** test + x = repmat ([1:20;6:25], [5 2 6 3]); + assert (size (geomean (x, [3 2])), [10 3]); + assert (size (geomean (x, [1 2])), [6 3]); + assert (size (geomean (x, [1 2 4])), [1 6]); + assert (size (geomean (x, [1 4 3])), [1 40]); + assert (size (geomean (x, [1 2 3 4])), [1 1]); +***** test + x = repmat ([1:20;6:25], [5 2 6 3]); + m = repmat ([8.304361203739333;14.3078118884256], [5,3]); + assert (geomean (x, [3 2]), m, 4e-14); + x(2,5,6,3) = NaN; + m(2,3) = NaN; + assert (geomean (x, [3 2]), m, 4e-14); + m(2,3) = 14.3292729579901; + assert (geomean (x, [3 2], "omitnan"), m, 4e-14); +***** error geomean ("char") +***** error geomean ... + (repmat ([1:20;6:25], [5 2 6 3 5]), [1 2]) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/normplot.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/normplot.m ***** demo - load carbig - X = [MPG Acceleration Weight Displacement]; - [d, p, stats] = manova1 (X, Origin); - manovacluster (stats) -***** error manovacluster (stats, "some"); + h = normplot([1:20]); +***** demo + h = normplot([1:20;5:2:44]'); +***** demo + ax = newplot(); + h = normplot(ax, [1:20]); + ax = gca; + h = normplot(ax, [-10:10]); + set (ax, "xlim", [-11, 21]); +***** test +***** error normplot (); +***** error normplot (23); +***** error normplot (23, [1:20]); +***** error normplot (ones(3,4,5)); ***** shared visibility_setting visibility_setting = get (0, "DefaultFigureVisible"); ***** test set (0, "DefaultFigureVisible", "off"); - load carbig - X = [MPG Acceleration Weight Displacement]; - [d, p, stats] = manova1 (X, Origin); - manovacluster (stats); + ax = newplot(); + h = normplot(ax, [1:20]); + ax = gca; + h = normplot(ax, [-10:10]); + set (ax, "xlim", [-11, 21]); + set (0, "DefaultFigureVisible", visibility_setting); +***** test + set (0, "DefaultFigureVisible", "off"); + h = normplot([1:20;5:2:44]'); + set (0, "DefaultFigureVisible", visibility_setting); +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/runstest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/runstest.m +***** test + ## NIST beam deflection data + ## http://www.itl.nist.gov/div898/handbook/eda/section4/eda425.htm + 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]; + [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/cluster.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cluster.m +***** error cluster () +***** error cluster ([1 1], "Cutoff", 1) +***** error cluster ([1 2 1], "Bogus", 1) +***** error cluster ([1 2 1], "Cutoff", -1) +***** error cluster ([1 2 1], "Cutoff", 1, "Bogus", 1) +***** test +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/unifstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/chi2gof.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/chi2gof.m +***** demo + x = normrnd (50, 5, 100, 1); + [h, p, stats] = chi2gof (x) + [h, p, stats] = chi2gof (x, "cdf", @(x)normcdf (x, mean(x), std(x))) + [h, p, stats] = chi2gof (x, "cdf", {@normcdf, mean(x), std(x)}) +***** demo + x = rand (100,1 ); + n = length (x); + binedges = linspace (0, 1, 11); + expectedCounts = n * diff (binedges); + [h, p, stats] = chi2gof (x, "binedges", binedges, "expected", expectedCounts) +***** demo + bins = 0:5; + obsCounts = [6 16 10 12 4 2]; + n = sum(obsCounts); + lambdaHat = sum(bins.*obsCounts) / n; + expCounts = n * poisspdf(bins,lambdaHat); + [h, p, stats] = chi2gof (bins, "binctrs", bins, "frequency", obsCounts, ... + "expected", expCounts, "nparams",1) +***** error chi2gof () +***** error chi2gof ([2,3;3,4]) +***** error chi2gof ([1,2,3,4], "nbins", 3, "ctrs", [2,3,4]) +***** error chi2gof ([1,2,3,4], "frequency", [2,3,2]) +***** error chi2gof ([1,2,3,4], "frequency", [2,3,2,-2]) +***** error chi2gof ([1,2,3,4], "frequency", [2,3,2,2], "nparams", i) +***** error chi2gof ([1,2,3,4], "frequency", [2,3,2,2], "alpha", 1.3) +***** error chi2gof ([1,2,3,4], "expected", [-3,2,2]) +***** error chi2gof ([1,2,3,4], "expected", [3,2,2], "nbins", 5) +***** error chi2gof ([1,2,3,4], "cdf", @normcdff) +***** test + x = [1 2 1 3 2 4 3 2 4 3 2 2]; + [h, p, stats] = chi2gof (x); + assert (h, 0); + assert (p, NaN); + assert (stats.chi2stat, 0.1205375022748029, 1e-14); + assert (stats.df, 0); + assert (stats.edges, [1, 2.5, 4], 1e-14); + assert (stats.O, [7, 5], 1e-14); + assert (stats.E, [6.399995519909668, 5.600004480090332], 1e-14); +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/gevstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/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/boxplot.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/boxplot.m +***** demo + axis ([0, 3]); + boxplot ({(randn(10, 1) * 5 + 140), (randn (13, 1) * 8 + 135)}); + set (gca (), "xtick", [1 2], "xticklabel", {"girls", "boys"}) + title ("Grade 3 heights"); +***** demo + data = [(randn (10, 1) * 5 + 140); (randn (25, 1) * 8 + 135); ... + (randn (20, 1) * 6 + 165)]; + groups = [(ones (10, 1)); (ones (25, 1) * 2); (ones (20, 1) * 3)]; + labels = {"Team A", "Team B", "Team C"}; + pos = [2, 1, 3]; + boxplot (data, groups, "Notch", "on", "Labels", labels, "Positions", pos, ... + "OutlierTags", "on", "BoxStyle", "filled"); + title ("Example of Group splitting with paired vectors"); +***** demo + boxplot (randn (100, 9), "notch", "on", "boxstyle", "filled", ... + "colors", "ygcwkmb", "whisker", 1.2); + title ("Example of different colors specified with characters"); +***** demo + colors = [0.7 0.7 0.7; ... + 0.0 0.4 0.9; ... + 0.7 0.4 0.3; ... + 0.7 0.1 0.7; ... + 0.8 0.7 0.4; ... + 0.1 0.8 0.5; ... + 0.9 0.9 0.2]; + boxplot (randn (100, 13), "notch", "on", "boxstyle", "filled", ... + "colors", colors, "whisker", 1.3, "boxwidth", "proportional"); + title ("Example of different colors specified as RGB values"); +***** error boxplot ("a") +***** error boxplot ({[1 2 3], "a"}) +***** error boxplot ([1 2 3], 1, {2, 3}) +***** error boxplot ([1 2 3], {"a", "b"}) +***** error <'Notch' input argument accepts> boxplot ([1:10], "notch", "any") +***** error boxplot ([1:10], "notch", i) +***** error boxplot ([1:10], "notch", {}) +***** error boxplot (1, "symbol", 1) +***** error <'Orientation' input argument accepts only> boxplot (1, "orientation", "diagonal") +***** error boxplot (1, "orientation", {}) +***** error <'Whisker' input argument accepts only> boxplot (1, "whisker", "a") +***** error <'Whisker' input argument accepts only> boxplot (1, "whisker", [1 3]) +***** error <'OutlierTags' input argument accepts only> boxplot (3, "OutlierTags", "maybe") +***** error boxplot (3, "OutlierTags", {}) +***** error <'Sample_IDs' input argument accepts only> boxplot (1, "sample_IDs", 1) +***** error <'BoxWidth' input argument accepts only> boxplot (1, "boxwidth", 2) +***** error <'BoxWidth' input argument accepts only> boxplot (1, "boxwidth", "anything") +***** error <'Widths' input argument accepts only> boxplot (5, "widths", "a") +***** error <'Widths' input argument accepts only> boxplot (5, "widths", [1:4]) +***** error <'Widths' input argument accepts only> boxplot (5, "widths", []) +***** error <'CapWidths' input argument accepts only> boxplot (5, "capwidths", "a") +***** error <'CapWidths' input argument accepts only> boxplot (5, "capwidths", [1:4]) +***** error <'CapWidths' input argument accepts only> boxplot (5, "capwidths", []) +***** error <'BoxStyle' input argument accepts only> boxplot (1, "Boxstyle", 1) +***** error <'BoxStyle' input argument accepts only> boxplot (1, "Boxstyle", "garbage") +***** error <'Positions' input argument accepts only> boxplot (1, "positions", "aa") +***** error <'Labels' input argument accepts only> boxplot (3, "labels", [1 5]) +***** error <'Colors' input argument accepts only> boxplot (1, "colors", {}) +***** error <'Colors' input argument accepts only> boxplot (2, "colors", [1 2 3 4]) +***** error boxplot (randn (10, 3), 'Sample_IDs', {"a", "b"}) +***** error boxplot (rand (3, 3), [1 2]) +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); +***** test + set (0, "DefaultFigureVisible", "off"); + [a, b] = boxplot (rand (10, 3)); + assert (size (a), [7, 3]); + assert (numel (b.box), 3); + assert (numel (b.whisker), 12); + assert (numel (b.median), 3); + set (0, "DefaultFigureVisible", visibility_setting); +***** test + set (0, "DefaultFigureVisible", "off"); + [~, b] = boxplot (rand (10, 3), "BoxStyle", "filled", "colors", "ybc"); + assert (numel (b.box_fill), 3); set (0, "DefaultFigureVisible", visibility_setting); +33 tests, 33 passed, 0 known failure, 0 skipped +[inst/mhsample.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/mhsample.m +***** demo + ## Define function to sample + d = 2; + mu = [-1; 2]; + Sigma = rand (d); + Sigma = (Sigma + Sigma'); + Sigma += eye (d) * abs (eigs (Sigma, 1, "sa")) * 1.1; + pdf = @(x)(2*pi)^(-d/2)*det(Sigma)^-.5*exp(-.5*sum((x.'-mu).*(Sigma\(x.'-mu)),1)); + ## Inputs + start = ones (1, 2); + nsamples = 500; + sym = true; + K = 500; + m = 10; + proprnd = @(x) (rand (size (x)) - .5) * 3 + x; + [smpl, accept] = mhsample (start, nsamples, "pdf", pdf, "proprnd", proprnd, ... + "symmetric", sym, "burnin", K, "thin", m); + figure; + hold on; + plot (smpl(:, 1), smpl(:, 2), 'x'); + [x, y] = meshgrid (linspace (-6, 4), linspace(-3, 7)); + z = reshape (pdf ([x(:), y(:)]), size(x)); + mesh (x, y, z, "facecolor", "None"); + ## Using sample points to find the volume of half a sphere with radius of .5 + f = @(x) ((.25-(x(:,1)+1).^2-(x(:,2)-2).^2).^.5.*(((x(:,1)+1).^2+(x(:,2)-2).^2)<.25)).'; + int = mean (f (smpl) ./ pdf (smpl)); + errest = std (f (smpl) ./ pdf (smpl)) / nsamples ^ .5; + trueerr = abs (2 / 3 * pi * .25 ^ (3 / 2) - int); + printf ("Monte Carlo integral estimate int f(x) dx = %f\n", int); + printf ("Monte Carlo integral error estimate %f\n", errest); + printf ("The actual error %f\n", trueerr); + mesh (x, y, reshape (f([x(:), y(:)]), size(x)), "facecolor", "None"); +***** demo + ## Integrate truncated normal distribution to find normilization constant + pdf = @(x) exp (-.5*x.^2)/(pi^.5*2^.5); + nsamples = 1e3; + proprnd = @(x) (rand (size (x)) - .5) * 3 + x; + [smpl, accept] = mhsample (1, nsamples, "pdf", pdf, "proprnd", proprnd, ... + "symmetric", true, "thin", 4); + f = @(x) exp(-.5 * x .^ 2) .* (x >= -2 & x <= 2); + x = linspace (-3, 3, 1000); + area(x, f(x)); + xlabel ('x'); + ylabel ('f(x)'); + int = mean (f (smpl) ./ pdf (smpl)); + errest = std (f (smpl) ./ pdf (smpl)) / nsamples^ .5; + trueerr = abs (erf (2 ^ .5) * 2 ^ .5 * pi ^ .5 - int); + printf ("Monte Carlo integral estimate int f(x) dx = %f\n", int); + printf ("Monte Carlo integral error estimate %f\n", errest); + printf ("The actual error %f\n", trueerr); +***** test + nchain = 1e4; + start = rand (nchain, 1); + nsamples = 1e3; + pdf = @(x) exp (-.5*(x-1).^2)/(2*pi)^.5; + proppdf = @(x, y) 1/3; + proprnd = @(x) 3 * (rand (size (x)) - .5) + x; + [smpl, accept] = mhsample (start, nsamples, "pdf", pdf, "proppdf", proppdf, ... + "proprnd", proprnd, "thin", 2, "nchain", nchain, ... + "burnin", 0); + assert (mean (mean (smpl, 1), 3), 1, .01); + assert (mean (var (smpl, 1), 3), 1, .01) +***** error mhsample (); +***** error mhsample (1); +***** error mhsample (1, 1); +***** error mhsample (1, 1, "pdf", @(x)x); +***** error mhsample (1, 1, "pdf", @(x)x, "proprnd", @(x)x+rand(size(x))); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/logistic_regression.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/logistic_regression.m +***** test + # Output compared to following MATLAB commands + # [B, DEV, STATS] = mnrfit(X,Y+1,'model','ordinal'); + # P = mnrval(B,X) + X = [1.489381332449196, 1.1534152241851305; ... + 1.8110085304863965, 0.9449666896938425; ... + -0.04453299665130296, 0.34278203449678646; ... + -0.36616019468850347, 1.130254275908322; ... + 0.15339143291005095, -0.7921044310668951; ... + -1.6031878794469698, -1.8343471035233376; ... + -0.14349521143198166, -0.6762996896828459; ... + -0.4403818557740143, -0.7921044310668951; ... + -0.7372685001160434, -0.027793137932169563; ... + -0.11875465773681024, 0.5512305689880763]; + Y = [1,1,1,1,1,0,0,0,0,0]'; + [INTERCEPT, SLOPE, DEV, DL, D2L, P] = logistic_regression (Y, X, false); +***** test + # Output compared to following MATLAB commands + # [B, DEV, STATS] = mnrfit(X,Y+1,'model','ordinal'); + load carbig + X = [Acceleration Displacement Horsepower Weight]; + miles = [1,1,1,1,1,1,1,1,1,1,NaN,NaN,NaN,NaN,NaN,1,1,NaN,1,1,2,2,1,2,2,2, ... + 2,2,2,2,2,1,1,1,1,2,2,2,2,NaN,2,1,1,2,1,1,1,1,1,1,1,1,1,2,2,1,2, ... + 2,3,3,3,3,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,2,2,2, ... + 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,2,2,2,1,2,2, ... + 2,1,1,3,2,2,2,1,2,2,1,2,2,2,1,3,2,3,2,1,1,1,1,1,1,1,1,3,2,2,3,3, ... + 2,2,2,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,2,2,1,3,2,2,2,2,2,2,1,3,2,2, ... + 2,2,2,3,2,2,2,2,2,1,1,1,1,2,2,2,2,3,2,3,3,2,1,1,1,3,3,2,2,2,1,2, ... + 2,1,1,1,1,1,3,3,3,2,3,1,1,1,1,1,2,2,1,1,1,1,1,3,2,2,2,3,3,3,3,2, ... + 2,2,4,3,3,4,3,2,2,2,2,2,2,2,2,2,2,2,1,1,2,1,1,1,3,2,2,3,2,2,2,2, ... + 2,1,2,1,3,3,2,2,2,2,2,1,1,1,1,1,1,2,1,3,3,3,2,2,2,2,2,3,3,3,3,2, ... + 2,2,3,4,3,3,3,2,2,2,2,3,3,3,3,3,4,2,4,4,4,3,3,4,4,3,3,3,2,3,2,3, ... + 2,2,2,2,3,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,NaN,3,2,2,2,2,2,1,2, ... + 2,3,3,3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,2,2,4,3,2,3]'; + [INTERCEPT, SLOPE, DEV, DL, D2L, P] = logistic_regression (miles, X, false); + assert (DEV, 433.197174495549, 1e-05); + assert (INTERCEPT(1), -16.6895155618903, 1e-05); + assert (INTERCEPT(2), -11.7207818178493, 1e-05); + assert (INTERCEPT(3), -8.0605768506075, 1e-05); + assert (SLOPE(1), 0.104762463756714, 1e-05); + assert (SLOPE(2), 0.0103357623191891, 1e-05); + assert (SLOPE(3), 0.0645199313242276, 1e-05); + assert (SLOPE(4), 0.00166377028388103, 1e-05); 2 tests, 2 passed, 0 known failure, 0 skipped [inst/sigma_pts.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/sigma_pts.m @@ -6481,724 +4107,41 @@ ***** 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/kstest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/kstest.m -***** error kstest () -***** error kstest (ones(2,4)) -***** error kstest ([2,3,5,7,3+3i]) -***** error kstest ([2,3,4,5,6],"tail") -***** error kstest ([2,3,4,5,6],"tail", "whatever") -***** error kstest ([2,3,4,5,6],"badoption", 0.51) -***** error kstest ([2,3,4,5,6],"tail", 0) -***** error kstest ([2,3,4,5,6],"alpha", 0) -***** error kstest ([2,3,4,5,6],"alpha", NaN) -***** error kstest ([NaN,NaN,NaN,NaN,NaN],"tail", "unequal") -***** error kstest ([2,3,4,5,6],"alpha", 0.05, "CDF", [2,3,4;1,3,4;1,2,1]) -***** test - load examgrades - [h, p] = kstest (grades(:,1)); - assert (h, true); - assert (p, 7.58603305206105e-107, 1e-14); +[inst/ttest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ttest.m ***** test - load stockreturns - x = stocks(:,3); - [h,p,k,c] = kstest (x, "Tail", "larger"); - assert (h, true); - assert (p, 5.085438806199252e-05, 1e-14); - assert (k, 0.2197, 1e-4); - assert (c, 0.1207, 1e-4); -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/clusterdata.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/clusterdata.m -***** error clusterdata () -***** error clusterdata (1) -***** error clusterdata ([1 1], "Bogus", 1) -***** error clusterdata ([1 1], "Depth", 1) -***** demo - X = [(randn (10, 2) * 0.25) + 1; (randn (20, 2) * 0.5) - 1]; - wnl = warning ("off", "Octave:linkage_savemem", "local"); - T = clusterdata (X, "linkage", "ward", "MaxClust", 2); - scatter (X(:,1), X(:,2), 36, T, "filled"); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/manova1.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/manova1.m -***** demo - load carbig - [d,p] = manova1([MPG, Acceleration, Weight, Displacement], Origin) -***** test - load carbig - [d,p] = manova1([MPG, Acceleration, Weight, Displacement], Origin); - assert (d, 3); - assert (p, [0, 3.140583347827075e-07, 0.007510999577743149, ... - 0.1934100745898493]', [1e-12, 1e-12, 1e-12, 1e-12]'); -***** test - load carbig - [d,p] = manova1([MPG, Acceleration, Weight], Origin); - assert (d, 2); - assert (p, [0, 0.00516082975137544, 0.1206528056514453]', ... - [1e-12, 1e-12, 1e-12]'); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/princomp.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/princomp.m -***** shared COEFF,SCORE,latent,tsquare,m,x,R,V,lambda,i,S,F -***** 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); -***** 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); -***** 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/unifstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/evstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/evstat.m -***** error evstat () -***** error evstat (1) -***** error evstat (i, 2) -***** error evstat (2, i) -***** error ... - evstat (ones (3), ones (2)) -***** shared x, y0, y1 - x = [-5, 0, 1, 2, 3]; - y0 = [NaN, NaN, 0.4228, 0.8456, 1.2684]; - y1 = [-5.5772, -3.4633, -3.0405, -2.6177, -2.1949]; -***** assert (evstat (x, x), y0, 1e-4) -***** assert (evstat (x, x+6), y1, 1e-4) -***** assert (evstat (x, x-6), NaN (1,5)) -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/gevfit_lmom.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/vartestn.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/vartestn.m -***** demo - ## Test the null hypothesis that the variances are equal across the five - ## columns of data in the students’ exam grades matrix, grades. - - load examgrades - vartestn (grades) -***** demo - ## Test the null hypothesis that the variances in miles per gallon (MPG) are - ## equal across different model years. - - load carsmall - vartestn (MPG, Model_Year) -***** demo - ## Use Levene’s test to test the null hypothesis that the variances in miles - ## per gallon (MPG) are equal across different model years. - - load carsmall - p = vartestn (MPG, Model_Year, "TestType", "LeveneAbsolute") -***** demo - ## Test the null hypothesis that the variances are equal across the five - ## columns of data in the students’ exam grades matrix, grades, using the - ## Brown-Forsythe test. Suppress the display of the summary table of - ## statistics and the box plot. - - load examgrades - [p, stats] = vartestn (grades, "TestType", "BrownForsythe", "Display", "off") -***** error vartestn (); -***** error vartestn (1); -***** error ... - vartestn ([1, 2, 3, 4, 5, 6, 7]); -***** error ... - vartestn ([1, 2, 3, 4, 5, 6, 7], []); -***** error ... - vartestn ([1, 2, 3, 4, 5, 6, 7], "TestType", "LeveneAbsolute"); -***** error ... - vartestn ([1, 2, 3, 4, 5, 6, 7], [], "TestType", "LeveneAbsolute"); -***** error ... - vartestn ([1, 2, 3, 4, 5, 6, 7], [1, 1, 1, 2, 2, 2, 2], "Display", "some"); -***** error ... - vartestn (ones (50,3), "Display", "some"); -***** error ... - vartestn (ones (50,3), "Display", "off", "testtype", "some"); -***** error ... - vartestn (ones (50,3), [], "som"); -***** error ... - vartestn (ones (50,3), [], "some", "some"); -***** error ... - vartestn (ones (50,3), [1, 2], "Display", "off"); -***** test - load examgrades - [p, stat] = vartestn (grades, "Display", "off"); - assert (p, 7.908647337018238e-08, 1e-14); - assert (stat.chisqstat, 38.7332, 1e-4); - assert (stat.df, 4); -***** test - load examgrades - [p, stat] = vartestn (grades, "Display", "off", "TestType", "LeveneAbsolute"); - assert (p, 9.523239714592791e-07, 1e-14); - assert (stat.fstat, 8.5953, 1e-4); - assert (stat.df, [4, 595]); -***** test - load examgrades - [p, stat] = vartestn (grades, "Display", "off", "TestType", "LeveneQuadratic"); - assert (p, 7.219514351897161e-07, 1e-14); - assert (stat.fstat, 8.7503, 1e-4); - assert (stat.df, [4, 595]); -***** test - load examgrades - [p, stat] = vartestn (grades, "Display", "off", "TestType", "BrownForsythe"); - assert (p, 1.312093241723211e-06, 1e-14); - assert (stat.fstat, 8.4160, 1e-4); - assert (stat.df, [4, 595]); -***** test - load examgrades - [p, stat] = vartestn (grades, "Display", "off", "TestType", "OBrien"); - assert (p, 8.235660885480556e-07, 1e-14); - assert (stat.fstat, 8.6766, 1e-4); - assert (stat.df, [4, 595]); -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/signtest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/signtest.m -***** error signtest (); -***** error signtest ([]); -***** error signtest (ones(1,10), ones(1,8)); -***** error signtest (ones(1,10), ones(2,10)); -***** error signtest (ones(2,10), 0); -***** error signtest (ones(1,10), zeros(1,10), "alpha", 1.4) -***** error signtest (ones(1,10), zeros(1,10), "tail", "<") -***** error signtest (ones(1,10), zeros(1,10), "method", "some") -***** test - [pval, h, stats] = signtest ([-ones(1, 1000) 1], 0, "tail", "left"); - assert (pval, 1.091701889420221e-218, 1e-14); - assert (h, 1); - assert (stats.zval, -31.5437631079266, 1e-14); -***** test - [pval, h, stats] = signtest ([-2 -1 0 2 1 3 1], 0); - assert (pval, 0.6875000000000006, 1e-14); - assert (h, 0); - assert (stats.zval, NaN); - assert (stats.sign, 4); -***** test - [pval, h, stats] = signtest ([-2 -1 0 2 1 3 1], 0, "method", "approximate"); - assert (pval, 0.6830913983096086, 1e-14); - assert (h, 0); - assert (stats.zval, 0.4082482904638631, 1e-14); - assert (stats.sign, 4); -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/squareform.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/histfit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/histfit.m -***** demo - histfit (randn (100, 1)) -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4, 7, 5, 9, 8, 10, 4, 11]; - histfit (x); - x = [2, 4, 3, 2, NaN, 3, 2, 5, 6, 4, 7, 5, 9, 8, 10, 4, 11]; - histfit (x); - histfit (x, 3); - set (0, "DefaultFigureVisible", visibility_setting); -***** error histfit (); -***** error histfit ([x',x']); + 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) +***** error ttest ([8:0.1:12], 10, "tail", "invalid"); +***** error ttest ([8:0.1:12], 10, "tail", 25); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/boxplot.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/boxplot.m -***** demo - axis ([0, 3]); - boxplot ({(randn(10, 1) * 5 + 140), (randn (13, 1) * 8 + 135)}); - set (gca (), "xtick", [1 2], "xticklabel", {"girls", "boys"}) - title ("Grade 3 heights"); -***** demo - data = [(randn (10, 1) * 5 + 140); (randn (25, 1) * 8 + 135); ... - (randn (20, 1) * 6 + 165)]; - groups = [(ones (10, 1)); (ones (25, 1) * 2); (ones (20, 1) * 3)]; - labels = {"Team A", "Team B", "Team C"}; - pos = [2, 1, 3]; - boxplot (data, groups, "Notch", "on", "Labels", labels, "Positions", pos, ... - "OutlierTags", "on", "BoxStyle", "filled"); - title ("Example of Group splitting with paired vectors"); -***** demo - boxplot (randn (100, 9), "notch", "on", "boxstyle", "filled", ... - "colors", "ygcwkmb", "whisker", 1.2); - title ("Example of different colors specified with characters"); -***** demo - colors = [0.7 0.7 0.7; ... - 0.0 0.4 0.9; ... - 0.7 0.4 0.3; ... - 0.7 0.1 0.7; ... - 0.8 0.7 0.4; ... - 0.1 0.8 0.5; ... - 0.9 0.9 0.2]; - boxplot (randn (100, 13), "notch", "on", "boxstyle", "filled", ... - "colors", colors, "whisker", 1.3, "boxwidth", "proportional"); - title ("Example of different colors specified as RGB values"); -***** error boxplot ("a") -***** error boxplot ({[1 2 3], "a"}) -***** error boxplot ([1 2 3], 1, {2, 3}) -***** error boxplot ([1 2 3], {"a", "b"}) -***** error <'Notch' input argument accepts> boxplot ([1:10], "notch", "any") -***** error boxplot ([1:10], "notch", i) -***** error boxplot ([1:10], "notch", {}) -***** error boxplot (1, "symbol", 1) -***** error <'Orientation' input argument accepts only> boxplot (1, "orientation", "diagonal") -***** error boxplot (1, "orientation", {}) -***** error <'Whisker' input argument accepts only> boxplot (1, "whisker", "a") -***** error <'Whisker' input argument accepts only> boxplot (1, "whisker", [1 3]) -***** error <'OutlierTags' input argument accepts only> boxplot (3, "OutlierTags", "maybe") -***** error boxplot (3, "OutlierTags", {}) -***** error <'Sample_IDs' input argument accepts only> boxplot (1, "sample_IDs", 1) -***** error <'BoxWidth' input argument accepts only> boxplot (1, "boxwidth", 2) -***** error <'BoxWidth' input argument accepts only> boxplot (1, "boxwidth", "anything") -***** error <'Widths' input argument accepts only> boxplot (5, "widths", "a") -***** error <'Widths' input argument accepts only> boxplot (5, "widths", [1:4]) -***** error <'Widths' input argument accepts only> boxplot (5, "widths", []) -***** error <'CapWidths' input argument accepts only> boxplot (5, "capwidths", "a") -***** error <'CapWidths' input argument accepts only> boxplot (5, "capwidths", [1:4]) -***** error <'CapWidths' input argument accepts only> boxplot (5, "capwidths", []) -***** error <'BoxStyle' input argument accepts only> boxplot (1, "Boxstyle", 1) -***** error <'BoxStyle' input argument accepts only> boxplot (1, "Boxstyle", "garbage") -***** error <'Positions' input argument accepts only> boxplot (1, "positions", "aa") -***** error <'Labels' input argument accepts only> boxplot (3, "labels", [1 5]) -***** error <'Colors' input argument accepts only> boxplot (1, "colors", {}) -***** error <'Colors' input argument accepts only> boxplot (2, "colors", [1 2 3 4]) -***** error boxplot (randn (10, 3), 'Sample_IDs', {"a", "b"}) -***** error boxplot (rand (3, 3), [1 2]) -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - [a, b] = boxplot (rand (10, 3)); - assert (size (a), [7, 3]); - assert (numel (b.box), 3); - assert (numel (b.whisker), 12); - assert (numel (b.median), 3); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - [~, b] = boxplot (rand (10, 3), "BoxStyle", "filled", "colors", "ybc"); - assert (numel (b.box_fill), 3); - set (0, "DefaultFigureVisible", visibility_setting); -33 tests, 33 passed, 0 known failure, 0 skipped -[inst/vartest2.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/vartest2.m -***** error vartest2 (); -***** error vartest2 (ones (20,1)); -***** error ... - vartest2 (rand (20,1), 5); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "alpha", 0); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "alpha", 1.2); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "alpha", "some"); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "alpha", [0.05, 0.001]); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "tail", [0.05, 0.001]); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "tail", "some"); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "dim", 3); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "alpha", 0.001, "dim", 3); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "some", 3); -***** error ... - vartest2 (rand (20,1), rand (25,1)*2, "some"); -***** test - load carsmall - [h, pval, ci, stat] = vartest2 (MPG(Model_Year==82), MPG(Model_Year==76)); - assert (h, 0); - assert (pval, 0.6288022362718455, 1e-13); - assert (ci, [0.4139; 1.7193], 1e-4); - assert (stat.fstat, 0.8384, 1e-4); - assert (stat.df1, 30); - assert (stat.df2, 33); -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/harmmean.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/harmmean.m -***** test - x = [0:10]; - y = [x;x+5;x+10]; - assert (harmmean (x), 0); - m = [0 8.907635160795225 14.30854471766802]; - assert (harmmean (y, 2), m', 4e-14); - assert (harmmean (y, "all"), 0); - y(2,4) = NaN; - m(2) = 9.009855936313949; - assert (harmmean (y', "omitnan"), m, 4e-14); - z = y + 20; - assert (harmmean (z, "all"), NaN); - m = [24.59488458841874 NaN 34.71244385944397]; - assert (harmmean (z'), m, 4e-14); - assert (harmmean (z', "includenan"), m, 4e-14); - m = [24.59488458841874 29.84104075528276 34.71244385944397]; - assert (harmmean (z', "omitnan"), m, 4e-14); - assert (harmmean (z, 2, "omitnan"), m', 4e-14); -***** test - assert (harmmean (true, "all"), 1); - assert (harmmean (false), 0); - assert (harmmean ([true false true]), 0); - assert (harmmean ([true false true], 1), [1 0 1]); - assert (harmmean ([true false NaN], 1), [1 0 NaN]); - assert (harmmean ([true false NaN], 2), NaN); - assert (harmmean ([true false NaN], 2, "omitnan"), 0); -***** test - x = repmat ([1:20;6:25], [5 2 6 3]); - assert (size (harmmean (x, [3 2])), [10 3]); - assert (size (harmmean (x, [1 2])), [6 3]); - assert (size (harmmean (x, [1 2 4])), [1 6]); - assert (size (harmmean (x, [1 4 3])), [1 40]); - assert (size (harmmean (x, [1 2 3 4])), [1 1]); -***** test - x = repmat ([1:20;6:25], [5 2 6 3]); - m = repmat ([5.559045930488016;13.04950789021461], [5,3]); - assert (harmmean (x, [3 2]), m, 4e-14); - x(2,5,6,3) = NaN; - m(2,3) = NaN; - assert (harmmean (x, [3 2]), m, 4e-14); - m(2,3) = 13.06617961315406; - assert (harmmean (x, [3 2], "omitnan"), m, 4e-14); -***** error harmmean ("char") -***** error harmmean ... - (repmat ([1:20;6:25], [5 2 6 3 5]), [1 2]) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/hmmviterbi.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hmmviterbi.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]; - 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/violin.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/violin.m -***** demo - clf - x = zeros (9e2, 10); - for i=1:10 - x(:,i) = (0.1 * randn (3e2, 3) * (randn (3,1) + 1) + 2 * randn (1,3))(:); - endfor - h = violin (x, "color", "c"); - axis tight - set (h.violin, "linewidth", 2); - set (gca, "xgrid", "on"); - xlabel ("Variables") - ylabel ("Values") -***** demo - clf - data = {randn(100,1)*5+140, randn(130,1)*8+135}; - subplot (1,2,1) - title ("Grade 3 heights - vertical"); - set (gca, "xtick", 1:2, "xticklabel", {"girls"; "boys"}); - violin (data, "Nbins", 10); - axis tight - - subplot(1,2,2) - title ("Grade 3 heights - horizontal"); - set (gca, "ytick", 1:2, "yticklabel", {"girls"; "boys"}); - violin (data, "horizontal", "Nbins", 10); - axis tight -***** demo - clf - data = exprnd (0.1, 500,4); - violin (data, "nbins", {5,10,50,100}); - axis ([0 5 0 max(data(:))]) -***** demo - clf - data = exprnd (0.1, 500,4); - violin (data, "color", jet(4)); - axis ([0 5 0 max(data(:))]) -***** demo - clf - data = repmat(exprnd (0.1, 500,1), 1, 4); - violin (data, "width", linspace (0.1,0.5,4)); - axis ([0 5 0 max(data(:))]) -***** demo - clf - data = repmat(exprnd (0.1, 500,1), 1, 4); - violin (data, "nbins", [5,10,50,100], "smoothfactor", [4 4 8 10]); - axis ([0 5 0 max(data(:))]) -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - data = exprnd (0.1, 500,4); - violin (data, "color", jet(4)); - axis ([0 5 0 max(data(:))]) - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - data = {randn(100,1)*5+140, randn(130,1)*8+135}; - subplot (1,2,1) - title ("Grade 3 heights - vertical"); - set (gca, "xtick", 1:2, "xticklabel", {"girls"; "boys"}); - violin (data, "Nbins", 10); - axis tight - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - data = {randn(100,1)*5+140, randn(130,1)*8+135}; - subplot (1,2,1) - title ("Grade 3 heights - vertical"); - set (gca, "xtick", 1:2, "xticklabel", {"girls"; "boys"}); - violin (data, "Nbins", 10); - axis tight - subplot(1,2,2) - title ("Grade 3 heights - horizontal"); - set (gca, "ytick", 1:2, "yticklabel", {"girls"; "boys"}); - violin (data, "horizontal", "Nbins", 10); - axis tight - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - data = repmat(exprnd (0.1, 500,1), 1, 4); - violin (data, "nbins", [5,10,50,100], "smoothfactor", [4 4 8 10]); - axis ([0 5 0 max(data(:))]) - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - data = repmat(exprnd (0.1, 500,1), 1, 4); - violin (data, "width", linspace (0.1,0.5,4)); - axis ([0 5 0 max(data(:))]) - set (0, "DefaultFigureVisible", visibility_setting); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/mahal.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/cluster.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cluster.m -***** error cluster () -***** error cluster ([1 1], "Cutoff", 1) -***** error cluster ([1 2 1], "Bogus", 1) -***** error cluster ([1 2 1], "Cutoff", -1) -***** error cluster ([1 2 1], "Cutoff", 1, "Bogus", 1) -***** test -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/kruskalwallis.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/kruskalwallis.m -***** demo - x = meshgrid (1:6); - x = x + normrnd (0, 1, 6, 6); - kruskalwallis (x, [], 'off'); -***** demo - x = meshgrid (1:6); - x = x + normrnd (0, 1, 6, 6); - [p, atab] = kruskalwallis(x); -***** demo - x = ones (30, 4) .* [-2, 0, 1, 5]; - x = x + normrnd (0, 2, 30, 4); - group = {"A", "B", "C", "D"}; - kruskalwallis (x, group); -***** test - data = [1.006, 0.996, 0.998, 1.000, 0.992, 0.993, 1.002, 0.999, 0.994, 1.000, ... - 0.998, 1.006, 1.000, 1.002, 0.997, 0.998, 0.996, 1.000, 1.006, 0.988, ... - 0.991, 0.987, 0.997, 0.999, 0.995, 0.994, 1.000, 0.999, 0.996, 0.996, ... - 1.005, 1.002, 0.994, 1.000, 0.995, 0.994, 0.998, 0.996, 1.002, 0.996, ... - 0.998, 0.998, 0.982, 0.990, 1.002, 0.984, 0.996, 0.993, 0.980, 0.996, ... - 1.009, 1.013, 1.009, 0.997, 0.988, 1.002, 0.995, 0.998, 0.981, 0.996, ... - 0.990, 1.004, 0.996, 1.001, 0.998, 1.000, 1.018, 1.010, 0.996, 1.002, ... - 0.998, 1.000, 1.006, 1.000, 1.002, 0.996, 0.998, 0.996, 1.002, 1.006, ... - 1.002, 0.998, 0.996, 0.995, 0.996, 1.004, 1.004, 0.998, 0.999, 0.991, ... - 0.991, 0.995, 0.984, 0.994, 0.997, 0.997, 0.991, 0.998, 1.004, 0.997]; - group = [1:10] .* ones (10,10); - group = group(:); - [p, tbl] = kruskalwallis (data, group, "off"); - assert (p, 0.048229, 1e-6); - assert (tbl{2,5}, 17.03124, 1e-5); - assert (tbl{2,3}, 9, 0); - assert (tbl{4,2}, 82655.5, 1e-16); - data = reshape (data, 10, 10); - [p, tbl, stats] = kruskalwallis (data, [], "off"); - assert (p, 0.048229, 1e-6); - assert (tbl{2,5}, 17.03124, 1e-5); - assert (tbl{2,3}, 9, 0); - assert (tbl{4,2}, 82655.5, 1e-16); - means = [51.85, 60.45, 37.6, 51.1, 29.5, 54.25, 64.55, 66.7, 53.65, 35.35]; - N = 10 * ones (1, 10); - assert (stats.meanranks, means, 1e-6); - assert (length (stats.gnames), 10, 0); - assert (stats.n, N, 0); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/ff2n.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ff2n.m -***** error ff2n (); -***** error ff2n (2, 5); -***** error ff2n (2.5); -***** error ff2n (0); -***** error ff2n (-3); -***** error ff2n (3+2i); -***** error ff2n (Inf); -***** error ff2n (NaN); -***** test - A = ff2n (3); - assert (A, fullfact (3)); -***** test - A = ff2n (8); - assert (A, fullfact (8)); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/gpfit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gpfit.m -***** error gpfit () -***** error gpfit (ones (2)) -***** error gpfit ([-1, 2]) -***** error gpfit ([0, 1, 2]) -***** error gpfit ([1, 2], 0) -***** error gpfit ([1, 2], 1.2) -***** error ... - gpfit ([1:10], 0.05, 5) -***** test - shape = 5; scale = 2; - x = gprnd (shape, scale, 0, 1, 100000); - [hat, ci] = gpfit (x); - assert (hat, [shape, scale], 1e-1); - assert (ci, [shape, scale; shape, scale], 2e-1); -***** test - shape = 1; scale = 1; - x = gprnd (shape, scale, 0, 1, 100000); - [hat, ci] = gpfit (x); - assert (hat, [shape, scale], 1e-1); - assert (ci, [shape, scale; shape, scale], 1e-1); -***** test - shape = 3; scale = 2; - x = gprnd (shape, scale, 0, 1, 100000); - [hat, ci] = gpfit (x); - assert (hat, [shape, scale], 1e-1); - assert (ci, [shape, scale; shape, scale], 1e-1); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/hmmgenerate.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/canoncorr.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/inst/pdf.m ***** test @@ -7218,862 +4161,6 @@ assert (pdf ("multivariate normal", x, mu, sigma), ... mvnpdf (x, mu, sigma), 0.001) 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/combnk.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/combnk.m -***** demo - c = combnk (1:5, 2); - disp ("All pairs of integers between 1 and 5:"); - disp (c); -***** test - c = combnk (1:3, 2); - assert (c, [1, 2; 1, 3; 2, 3]); -***** test - c = combnk (1:3, 6); - assert (isempty (c)); -***** test - c = combnk ({1, 2, 3}, 2); - assert (c, {1, 2; 1, 3; 2, 3}); -***** test - 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/jackknife.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/multcompare.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/multcompare.m -***** demo - - ## Demonstration using balanced one-way ANOVA from anova1 - - x = ones (50, 4) .* [-2, 0, 1, 5]; - x = x + normrnd (0, 2, 50, 4); - groups = {"A", "B", "C", "D"}; - [p, tbl, stats] = anova1 (x, groups, "off"); - multcompare (stats); -***** demo - - ## Demonstration using unbalanced one-way ANOVA example from anovan - - dv = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... - 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... - 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... - 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... - 25.694 ]'; - g = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 ... - 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; - - [P,ATAB, STATS] = anovan (dv, g, "varnames", "score", "display", "off"); - - [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "holm", ... - "ControlGroup", 1, "display", "on") - -***** demo - - ## Demonstration using factorial ANCOVA example from anovan - - score = [95.6 82.2 97.2 96.4 81.4 83.6 89.4 83.8 83.3 85.7 ... - 97.2 78.2 78.9 91.8 86.9 84.1 88.6 89.8 87.3 85.4 ... - 81.8 65.8 68.1 70.0 69.9 75.1 72.3 70.9 71.5 72.5 ... - 84.9 96.1 94.6 82.5 90.7 87.0 86.8 93.3 87.6 92.4 ... - 100. 80.5 92.9 84.0 88.4 91.1 85.7 91.3 92.3 87.9 ... - 91.7 88.6 75.8 75.7 75.3 82.4 80.1 86.0 81.8 82.5]'; - treatment = {"yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" ... - "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" ... - "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" ... - "no" "no" "no" "no" "no" "no" "no" "no" "no" "no" ... - "no" "no" "no" "no" "no" "no" "no" "no" "no" "no" ... - "no" "no" "no" "no" "no" "no" "no" "no" "no" "no"}'; - exercise = {"lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" ... - "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" ... - "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" ... - "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" ... - "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" ... - "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi"}'; - age = [59 65 70 66 61 65 57 61 58 55 62 61 60 59 55 57 60 63 62 57 ... - 58 56 57 59 59 60 55 53 55 58 68 62 61 54 59 63 60 67 60 67 ... - 75 54 57 62 65 60 58 61 65 57 56 58 58 58 52 53 60 62 61 61]'; - - [P, ATAB, STATS] = anovan (score, {treatment, exercise, age}, "model", ... - [1 0 0; 0 1 0; 0 0 1; 1 1 0], "continuous", 3, ... - "sstype", "h", "display", "off", "contrasts", ... - {"simple","poly",""}); - - [C, M, H, GNAMES] = multcompare (STATS, "dim", [1 2], "ctype", "holm", ... - "display", "on") - -***** demo - - ## Demonstration using one-way ANOVA from anovan, with fit by weighted least - ## squares to account for heteroskedasticity. - - g = [1, 1, 1, 1, 1, 1, 1, 1, ... - 2, 2, 2, 2, 2, 2, 2, 2, ... - 3, 3, 3, 3, 3, 3, 3, 3]'; - - y = [13, 16, 16, 7, 11, 5, 1, 9, ... - 10, 25, 66, 43, 47, 56, 6, 39, ... - 11, 39, 26, 35, 25, 14, 24, 17]'; - - [P,ATAB,STATS] = anovan(y, g, "display", "off"); - fitted = STATS.X * STATS.coeffs(:,1); # fitted values - b = polyfit (fitted, abs (STATS.resid), 1); - v = polyval (b, fitted); # Variance as a function of the fitted values - [P,ATAB,STATS] = anovan (y, g, "weights", v.^-1, "display", "off"); - [C, M] = multcompare (STATS, "display", "on", "ctype", "mvt") -***** demo - - ## Demonstration of p-value adjustments to control the false discovery rate - ## Data from Westfall (1997) JASA. 92(437):299-306 - - p = [.005708; .023544; .024193; .044895; ... - .048805; .221227; .395867; .693051; .775755]; - - padj = multcompare(p,'ctype','fdr') -***** test - - ## Tests using unbalanced one-way ANOVA example from anovan and anova1 - - ## Test for anovan - compare pairwise comparisons with matlab for CTYPE "lsd" - - dv = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... - 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... - 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... - 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... - 25.694 ]'; - g = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 ... - 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; - - [P, ATAB, STATS] = anovan (dv, g, "varnames", "score", "display", "off"); - [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "lsd", ... - "display", "off"); - assert (C(1,6), 2.85812420217898e-05, 1e-09); - assert (C(2,6), 5.22936741204085e-07, 1e-09); - assert (C(3,6), 2.12794763209146e-08, 1e-09); - assert (C(4,6), 7.82091664406946e-15, 1e-09); - assert (C(5,6), 0.546591417210693, 1e-09); - assert (C(6,6), 0.0845897945254446, 1e-09); - assert (C(7,6), 9.47436557975328e-08, 1e-09); - assert (C(8,6), 0.188873478781067, 1e-09); - assert (C(9,6), 4.08974010364197e-08, 1e-09); - assert (C(10,6), 4.44427348175241e-06, 1e-09); - assert (M(1,1), 10, 1e-09); - assert (M(2,1), 18, 1e-09); - assert (M(3,1), 19, 1e-09); - assert (M(4,1), 21.0001428571429, 1e-09); - assert (M(5,1), 29.0001111111111, 1e-09); - assert (M(1,2), 1.0177537954095, 1e-09); - assert (M(2,2), 1.28736803631001, 1e-09); - assert (M(3,2), 1.0177537954095, 1e-09); - assert (M(4,2), 1.0880245732889, 1e-09); - assert (M(5,2), 0.959547480416536, 1e-09); - - ## Compare "fdr" adjusted p-values to those obtained using p.adjust in R - - [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "fdr", ... - "display", "off"); - assert (C(1,6), 4.08303457454140e-05, 1e-09); - assert (C(2,6), 1.04587348240817e-06, 1e-09); - assert (C(3,6), 1.06397381604573e-07, 1e-09); - assert (C(4,6), 7.82091664406946e-14, 1e-09); - assert (C(5,6), 5.46591417210693e-01, 1e-09); - assert (C(6,6), 1.05737243156806e-01, 1e-09); - assert (C(7,6), 2.36859139493832e-07, 1e-09); - assert (C(8,6), 2.09859420867852e-01, 1e-09); - assert (C(9,6), 1.36324670121399e-07, 1e-09); - assert (C(10,6), 7.40712246958735e-06, 1e-09); - - ## Compare "hochberg" adjusted p-values to those obtained using p.adjust in R - - [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "hochberg", ... - "display", "off"); - assert (C(1,6), 1.14324968087159e-04, 1e-09); - assert (C(2,6), 3.13762044722451e-06, 1e-09); - assert (C(3,6), 1.91515286888231e-07, 1e-09); - assert (C(4,6), 7.82091664406946e-14, 1e-09); - assert (C(5,6), 5.46591417210693e-01, 1e-09); - assert (C(6,6), 2.53769383576334e-01, 1e-09); - assert (C(7,6), 6.63205590582730e-07, 1e-09); - assert (C(8,6), 3.77746957562134e-01, 1e-09); - assert (C(9,6), 3.27179208291358e-07, 1e-09); - assert (C(10,6), 2.22213674087620e-05, 1e-09); - - ## Compare "holm" adjusted p-values to those obtained using p.adjust in R - - [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "holm", ... - "display", "off"); - assert (C(1,6), 1.14324968087159e-04, 1e-09); - assert (C(2,6), 3.13762044722451e-06, 1e-09); - assert (C(3,6), 1.91515286888231e-07, 1e-09); - assert (C(4,6), 7.82091664406946e-14, 1e-09); - assert (C(5,6), 5.46591417210693e-01, 1e-09); - assert (C(6,6), 2.53769383576334e-01, 1e-09); - assert (C(7,6), 6.63205590582730e-07, 1e-09); - assert (C(8,6), 3.77746957562134e-01, 1e-09); - assert (C(9,6), 3.27179208291358e-07, 1e-09); - assert (C(10,6), 2.22213674087620e-05, 1e-09); - - ## Compare "scheffe" adjusted p-values to those obtained using 'scheffe' in Matlab - - [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "scheffe", ... - "display", "off"); - assert (C(1,6), 0.00108105386141085, 1e-09); - assert (C(2,6), 2.7779386789517e-05, 1e-09); - assert (C(3,6), 1.3599854038198e-06, 1e-09); - assert (C(4,6), 7.58830197867751e-13, 1e-09); - assert (C(5,6), 0.984039948220281, 1e-09); - assert (C(6,6), 0.539077018557706, 1e-09); - assert (C(7,6), 5.59475764460574e-06, 1e-09); - assert (C(8,6), 0.771173490574105, 1e-09); - assert (C(9,6), 2.52838425729905e-06, 1e-09); - assert (C(10,6), 0.000200719143889168, 1e-09); - - ## Compare "bonferroni" adjusted p-values to those obtained using p.adjust in R - - [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "bonferroni", ... - "display", "off"); - assert (C(1,6), 2.85812420217898e-04, 1e-09); - assert (C(2,6), 5.22936741204085e-06, 1e-09); - assert (C(3,6), 2.12794763209146e-07, 1e-09); - assert (C(4,6), 7.82091664406946e-14, 1e-09); - assert (C(5,6), 1.00000000000000e+00, 1e-09); - assert (C(6,6), 8.45897945254446e-01, 1e-09); - assert (C(7,6), 9.47436557975328e-07, 1e-09); - assert (C(8,6), 1.00000000000000e+00, 1e-09); - assert (C(9,6), 4.08974010364197e-07, 1e-09); - assert (C(10,6), 4.44427348175241e-05, 1e-09); - - ## Test for anova1 ("equal")- comparison of results from Matlab - - [P, ATAB, STATS] = anova1 (dv, g, "off", "equal"); - [C, M, H, GNAMES] = multcompare (STATS, "ctype", "lsd", "display", "off"); - assert (C(1,6), 2.85812420217898e-05, 1e-09); - assert (C(2,6), 5.22936741204085e-07, 1e-09); - assert (C(3,6), 2.12794763209146e-08, 1e-09); - assert (C(4,6), 7.82091664406946e-15, 1e-09); - assert (C(5,6), 0.546591417210693, 1e-09); - assert (C(6,6), 0.0845897945254446, 1e-09); - assert (C(7,6), 9.47436557975328e-08, 1e-09); - assert (C(8,6), 0.188873478781067, 1e-09); - assert (C(9,6), 4.08974010364197e-08, 1e-09); - assert (C(10,6), 4.44427348175241e-06, 1e-09); - assert (M(1,1), 10, 1e-09); - assert (M(2,1), 18, 1e-09); - assert (M(3,1), 19, 1e-09); - assert (M(4,1), 21.0001428571429, 1e-09); - assert (M(5,1), 29.0001111111111, 1e-09); - assert (M(1,2), 1.0177537954095, 1e-09); - assert (M(2,2), 1.28736803631001, 1e-09); - assert (M(3,2), 1.0177537954095, 1e-09); - assert (M(4,2), 1.0880245732889, 1e-09); - assert (M(5,2), 0.959547480416536, 1e-09); - - ## Test for anova1 ("unequal") - comparison with results from GraphPad Prism 8 - [P, ATAB, STATS] = anova1 (dv, g, "off", "unequal"); - [C, M, H, GNAMES] = multcompare (STATS, "ctype", "lsd", "display", "off"); - assert (C(1,6), 0.001247025266382, 1e-09); - assert (C(2,6), 0.000018037115146, 1e-09); - assert (C(3,6), 0.000002974595187, 1e-09); - assert (C(4,6), 0.000000000786046, 1e-09); - assert (C(5,6), 0.5693192886650109, 1e-09); - assert (C(6,6), 0.110501699029776, 1e-09); - assert (C(7,6), 0.000131226488700, 1e-09); - assert (C(8,6), 0.1912101409715992, 1e-09); - assert (C(9,6), 0.000005385256394, 1e-09); - assert (C(10,6), 0.000074089106171, 1e-09); -***** test - - ## Test for anova2 ("interaction") - comparison with results from Matlab for column effect - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - [P, ATAB, STATS] = anova2 (popcorn, 3, "off"); - [C, M, H, GNAMES] = multcompare (STATS, "estimate", "column",... - "ctype", "lsd", "display", "off"); - assert (C(1,6), 1.49311100811177e-05, 1e-09); - assert (C(2,6), 2.20506904243535e-07, 1e-09); - assert (C(3,6), 0.00449897860490058, 1e-09); - assert (M(1,1), 6.25, 1e-09); - assert (M(2,1), 4.75, 1e-09); - assert (M(3,1), 4, 1e-09); - assert (M(1,2), 0.152145154862547, 1e-09); - assert (M(2,2), 0.152145154862547, 1e-09); - assert (M(3,2), 0.152145154862547, 1e-09); -***** test - - ## Test for anova2 ("linear") - comparison with results from GraphPad Prism 8 - words = [10 13 13; 6 8 8; 11 14 14; 22 23 25; 16 18 20; ... - 15 17 17; 1 1 4; 12 15 17; 9 12 12; 8 9 12]; - [P, ATAB, STATS] = anova2 (words, 1, "off", "linear"); - [C, M, H, GNAMES] = multcompare (STATS, "estimate", "column",... - "ctype", "lsd", "display", "off"); - assert (C(1,6), 0.000020799832702, 1e-09); - assert (C(2,6), 0.000000035812410, 1e-09); - assert (C(3,6), 0.003038942449215, 1e-09); -***** test - - ## Test for anova2 ("nested") - comparison with results from GraphPad Prism 8 - data = [4.5924 7.3809 21.322; -0.5488 9.2085 25.0426; ... - 6.1605 13.1147 22.66; 2.3374 15.2654 24.1283; ... - 5.1873 12.4188 16.5927; 3.3579 14.3951 10.2129; ... - 6.3092 8.5986 9.8934; 3.2831 3.4945 10.0203]; - [P, ATAB, STATS] = anova2 (data, 4, "off", "nested"); - [C, M, H, GNAMES] = multcompare (STATS, "estimate", "column",... - "ctype", "lsd", "display", "off"); - assert (C(1,6), 0.261031111511073, 1e-09); - assert (C(2,6), 0.065879755907745, 1e-09); - assert (C(3,6), 0.241874613529270, 1e-09); -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - - ## Test for kruskalwallis - comparison with results from MATLAB - data = [3,2,4; 5,4,4; 4,2,4; 4,2,4; 4,1,5; ... - 4,2,3; 4,3,5; 4,2,4; 5,2,4; 5,3,3]; - group = [1:3] .* ones (10,3); - [P, ATAB, STATS] = kruskalwallis (data(:), group(:), "off"); - C = multcompare (STATS, "ctype", "lsd", "display", "off"); - assert (C(1,6), 0.000163089828959986, 1e-09); - assert (C(2,6), 0.630298044801257, 1e-09); - assert (C(3,6), 0.00100567660695682, 1e-09); - C = multcompare (STATS, "ctype", "bonferroni", "display", "off"); - assert (C(1,6), 0.000489269486879958, 1e-09); - assert (C(2,6), 1, 1e-09); - assert (C(3,6), 0.00301702982087047, 1e-09); - C = multcompare(STATS, "ctype", "scheffe", "display", "off"); - assert (C(1,6), 0.000819054880289573, 1e-09); - assert (C(2,6), 0.890628039849261, 1e-09); - assert (C(3,6), 0.00447816059021654, 1e-09); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - ## Test for friedman - comparison with results from MATLAB - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - [P, ATAB, STATS] = friedman (popcorn, 3, "off"); - C = multcompare(STATS, "ctype", "lsd", "display", "off"); - assert (C(1,6), 0.227424558028569, 1e-09); - assert (C(2,6), 0.0327204848315735, 1e-09); - assert (C(3,6), 0.353160353315988, 1e-09); - C = multcompare(STATS, "ctype", "bonferroni", "display", "off"); - assert (C(1,6), 0.682273674085708, 1e-09); - assert (C(2,6), 0.0981614544947206, 1e-09); - assert (C(3,6), 1, 1e-09); - C = multcompare(STATS, "ctype", "scheffe", "display", "off"); - assert (C(1,6), 0.482657360384373, 1e-09); - assert (C(2,6), 0.102266573027672, 1e-09); - assert (C(3,6), 0.649836502233148, 1e-09); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - ## Test for fitlm - same comparisons as for first anovan example - y = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... - 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... - 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... - 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... - 25.694 ]'; - X = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; - [TAB,STATS] = fitlm (X,y,"linear","categorical",1,"display","off"); - [C, M] = multcompare(STATS, "ctype", "lsd", "display", "off"); - assert (C(1,6), 2.85812420217898e-05, 1e-09); - assert (C(2,6), 5.22936741204085e-07, 1e-09); - assert (C(3,6), 2.12794763209146e-08, 1e-09); - assert (C(4,6), 7.82091664406946e-15, 1e-09); - assert (C(5,6), 0.546591417210693, 1e-09); - assert (C(6,6), 0.0845897945254446, 1e-09); - assert (C(7,6), 9.47436557975328e-08, 1e-09); - assert (C(8,6), 0.188873478781067, 1e-09); - assert (C(9,6), 4.08974010364197e-08, 1e-09); - assert (C(10,6), 4.44427348175241e-06, 1e-09); - assert (M(1,1), 10, 1e-09); - assert (M(2,1), 18, 1e-09); - assert (M(3,1), 19, 1e-09); - assert (M(4,1), 21.0001428571429, 1e-09); - assert (M(5,1), 29.0001111111111, 1e-09); - assert (M(1,2), 1.0177537954095, 1e-09); - assert (M(2,2), 1.28736803631001, 1e-09); - assert (M(3,2), 1.0177537954095, 1e-09); - assert (M(4,2), 1.0880245732889, 1e-09); - assert (M(5,2), 0.959547480416536, 1e-09); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - ## Test p-value adjustments compared to R stats package function p.adjust - ## Data from Westfall (1997) JASA. 92(437):299-306 - p = [.005708; .023544; .024193; .044895; ... - .048805; .221227; .395867; .693051; .775755]; - padj = multcompare (p); - assert (padj(1), 0.051372, 1e-06); - assert (padj(2), 0.188352, 1e-06); - assert (padj(3), 0.188352, 1e-06); - assert (padj(4), 0.269370, 1e-06); - assert (padj(5), 0.269370, 1e-06); - assert (padj(6), 0.884908, 1e-06); - assert (padj(7), 1.000000, 1e-06); - assert (padj(8), 1.000000, 1e-06); - assert (padj(9), 1.000000, 1e-06); - padj = multcompare(p,'ctype','holm'); - assert (padj(1), 0.051372, 1e-06); - assert (padj(2), 0.188352, 1e-06); - assert (padj(3), 0.188352, 1e-06); - assert (padj(4), 0.269370, 1e-06); - assert (padj(5), 0.269370, 1e-06); - assert (padj(6), 0.884908, 1e-06); - assert (padj(7), 1.000000, 1e-06); - assert (padj(8), 1.000000, 1e-06); - assert (padj(9), 1.000000, 1e-06); - padj = multcompare(p,'ctype','hochberg'); - assert (padj(1), 0.051372, 1e-06); - assert (padj(2), 0.169351, 1e-06); - assert (padj(3), 0.169351, 1e-06); - assert (padj(4), 0.244025, 1e-06); - assert (padj(5), 0.244025, 1e-06); - assert (padj(6), 0.775755, 1e-06); - assert (padj(7), 0.775755, 1e-06); - assert (padj(8), 0.775755, 1e-06); - assert (padj(9), 0.775755, 1e-06); - padj = multcompare(p,'ctype','fdr'); - assert (padj(1), 0.0513720, 1e-07); - assert (padj(2), 0.0725790, 1e-07); - assert (padj(3), 0.0725790, 1e-07); - assert (padj(4), 0.0878490, 1e-07); - assert (padj(5), 0.0878490, 1e-07); - assert (padj(6), 0.3318405, 1e-07); - assert (padj(7), 0.5089719, 1e-07); - assert (padj(8), 0.7757550, 1e-07); - assert (padj(9), 0.7757550, 1e-07); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/gplike.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gplike.m -***** error gplike () -***** error gplike (1) -***** error gplike ([1, 2], []) -***** error gplike ([1, 2], ones (2)) -***** error gplike (2, [1:10]) -***** assert (gplike ([2, 3], 4), 3.047536764863501, 1e-14) -***** assert (gplike ([1, 2], 4), 2.890371757896165, 1e-14) -***** assert (gplike ([2, 3], [1:10]), 32.57864322725392, 1e-14) -***** assert (gplike ([1, 2], [1:10]), 31.65666282460443, 1e-14) -***** assert (gplike ([1, NaN], [1:10]), NaN) -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/silhouette.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/silhouette.m -***** error silhouette (); -***** error silhouette ([1 2; 1 1]); -***** error silhouette ([1 2; 1 1], [1 2 3]'); -***** error silhouette ([1 2; 1 1], [1 2]', "xxx"); -***** demo - load fisheriris; - X = meas(:,3:4); - cidcs = kmeans (X, 3, "Replicates", 5); - silhouette (X, cidcs); - y_labels(cidcs([1 51 101])) = unique (species); - set (gca, "yticklabel", y_labels); - title ("Fisher's iris data"); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/slicesample.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/slicesample.m -***** demo - ## Define function to sample - d = 2; - mu = [-1; 2]; - Sigma = rand (d); - Sigma = (Sigma + Sigma'); - Sigma += eye (d)*abs (eigs (Sigma, 1, "sa")) * 1.1; - pdf = @(x)(2*pi)^(-d/2)*det(Sigma)^-.5*exp(-.5*sum((x.'-mu).*(Sigma\(x.'-mu)),1)); - ##Inputs - start = ones (1,2); - nsamples = 500; - K = 500; - m = 10; - [smpl, accept]=slicesample (start, nsamples, "pdf", pdf, "burnin", K, "thin", m, "width", [20, 30]); - figure; - hold on; - plot (smpl(:,1), smpl(:,2), 'x'); - [x, y] = meshgrid (linspace (-6,4), linspace(-3,7)); - z = reshape (pdf ([x(:), y(:)]), size(x)); - mesh (x, y, z, "facecolor", "None"); - ## Using sample points to find the volume of half a sphere with radius of .5 - f = @(x) ((.25-(x(:,1)+1).^2-(x(:,2)-2).^2).^.5.*(((x(:,1)+1).^2+(x(:,2)-2).^2)<.25)).'; - int = mean (f (smpl) ./ pdf (smpl)); - errest = std (f (smpl) ./ pdf (smpl)) / nsamples^.5; - trueerr = abs (2/3*pi*.25^(3/2)-int); - fprintf("Monte Carlo integral estimate int f(x) dx = %f\n", int); - fprintf("Monte Carlo integral error estimate %f\n", errest); - fprintf("The actual error %f\n", trueerr); - mesh (x,y,reshape (f([x(:), y(:)]), size(x)), "facecolor", "None"); -***** demo - ##Integrate truncated normal distribution to find normilization constant - pdf = @(x) exp (-.5*x.^2)/(pi^.5*2^.5); - nsamples = 1e3; - [smpl,accept] = slicesample (1, nsamples, "pdf", pdf, "thin", 4); - f = @(x) exp (-.5 * x .^ 2) .* (x >= -2 & x <= 2); - x=linspace(-3,3,1000); - area(x,f(x)); - xlabel ('x'); - ylabel ('f(x)'); - int = mean (f (smpl)./pdf(smpl)); - errest = std (f (smpl)./pdf(smpl))/nsamples^.5; - trueerr = abs (erf (2^.5)*2^.5*pi^.5-int); - fprintf("Monte Carlo integral estimate int f(x) dx = %f\n", int); - fprintf("Monte Carlo integral error estimate %f\n", errest); - fprintf("The actual error %f\n", trueerr); -***** test - start = 0.5; - nsamples = 1e3; - pdf = @(x) exp (-.5*(x-1).^2)/(2*pi)^.5; - [smpl, accept] = slicesample (start, nsamples, "pdf", pdf, "thin", 2, "burnin", 0, "width", 5); - assert (mean (smpl, 1), 1, .1); - assert (var (smpl, 1), 1, .2); -***** error slicesample (); -***** error slicesample (1); -***** error slicesample (1, 1); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/geomean.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/geomean.m -***** test - x = [-10:10]; - y = [x;x+5;x-5]; - assert (geomean (x), 0); - assert (geomean (y, 2), [0, 0, 0]'); - assert (geomean (y, "all"), 0); - y(2,4) = NaN; - assert (geomean (y', "omitnan"), [0 0 0]); - z = y + 20; - assert (geomean (z, "all"), NaN); - m = [19.02099329497543 NaN 13.60912525683438]; - assert (geomean (z'), m, 4e-14); - assert (geomean (z', "includenan"), m, 4e-14); - m = [19.02099329497543 24.59957418295707 13.60912525683438]; - assert (geomean (z', "omitnan"), m, 4e-14); - assert (geomean (z, 2, "omitnan"), m', 4e-14); -***** test - assert (geomean (true, "all"), 1); - assert (geomean (false), 0); - assert (geomean ([true false true]), 0); - assert (geomean ([true false true], 1), [1 0 1]); - assert (geomean ([true false NaN], 1), [1 0 NaN]); - assert (geomean ([true false NaN], 2), NaN); - assert (geomean ([true false NaN], 2, "omitnan"), 0); -***** test - x = repmat ([1:20;6:25], [5 2 6 3]); - assert (size (geomean (x, [3 2])), [10 3]); - assert (size (geomean (x, [1 2])), [6 3]); - assert (size (geomean (x, [1 2 4])), [1 6]); - assert (size (geomean (x, [1 4 3])), [1 40]); - assert (size (geomean (x, [1 2 3 4])), [1 1]); -***** test - x = repmat ([1:20;6:25], [5 2 6 3]); - m = repmat ([8.304361203739333;14.3078118884256], [5,3]); - assert (geomean (x, [3 2]), m, 4e-14); - x(2,5,6,3) = NaN; - m(2,3) = NaN; - assert (geomean (x, [3 2]), m, 4e-14); - m(2,3) = 14.3292729579901; - assert (geomean (x, [3 2], "omitnan"), m, 4e-14); -***** error geomean ("char") -***** error geomean ... - (repmat ([1:20;6:25], [5 2 6 3 5]), [1 2]) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/normstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/cdfplot.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cdfplot.m -***** demo - x = randn(100,1); - cdfplot (x); -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4]; - [hCDF, stats] = cdfplot (x); - assert (stats.min, 2); - assert (stats.max, 6); - assert (stats.median, 3.5); - assert (stats.std, 1.35400640077266, 1e-14); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - x = randn(100,1); - cdfplot (x); - set (0, "DefaultFigureVisible", visibility_setting); -***** error cdfplot (); -***** error cdfplot ([x',x']); -***** error cdfplot ([NaN, NaN, NaN, NaN]); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/optimalleaforder.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/optimalleaforder.m -***** error optimalleaforder () -***** error optimalleaforder (1) -***** error optimalleaforder (ones (2, 2), 1) -***** error optimalleaforder ([1 2 3], [1 2; 3 4], "criteria", 5) -***** error optimalleaforder ([1 2 1], [1 2 3]) -***** error optimalleaforder ([1 2 1], 1, "xxx", "xxx") -***** error optimalleaforder ([1 2 1], 1, "Transformation", "xxx") -***** demo - X = randn (10, 2); - D = pdist (X); - tree = linkage(D, 'average'); - optimalleaforder (tree, D, 'Transformation', 'linear') -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/gamstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gamstat.m -***** 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); -***** 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/evfit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/evfit.m -***** error evfit (ones (2,5)); -***** error evfit (single (ones (1,5))); -***** error evfit ([1, 2, 3, 4, NaN]); -***** error evfit ([1, 2, 3, 4, 5], 1.2); -***** error evfit ([1, 2, 3, 4, 5], 0.05, [1 1 0]); -***** error evfit ([1, 2, 3, 4, 5], 0.05, [], [1 1 0]); -***** error evfit ([1, 2, 3, 4, 5], 0.05, [], [], 2); -***** test - data = 1:50; - [paramhat, paramci] = evfit (data); - paramhat_out = [32.6811, 13.0509]; - paramci_out = [28.8504, 10.5294; 36.5118, 16.1763]; - assert (paramhat, paramhat_out, 1e-4); - assert (paramci, paramci_out, 1e-4); -***** test - data = 1:50; - [paramhat, paramci] = evfit (data, 0.01); - paramci_out = [27.6468, 9.8426; 37.7155, 17.3051]; - assert (paramci, paramci_out, 1e-4); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/gscatter.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gscatter.m -***** demo - load fisheriris; - X = meas(:,3:4); - cidcs = kmeans (X, 3, "Replicates", 5); - gscatter (X(:,1), X(:,2), cidcs, [.75 .75 0; 0 .75 .75; .75 0 .75], "os^"); - title ("Fisher's iris data"); -***** error gscatter(); -***** error gscatter([1]); -***** error gscatter([1], [2]); -***** error gscatter('abc', [1 2 3], [1]); -***** error gscatter([1 2 3], [1 2], [1]); -***** error gscatter([1 2 3], 'abc', [1]); -***** error gscatter([1 2], [1 2], [1]); -***** error gscatter([1 2], [1 2], [1 2], 'rb', 'so', 12, 'xxx'); -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - load fisheriris; - X = meas(:,3:4); - cidcs = kmeans (X, 3, "Replicates", 5); - gscatter (X(:,1), X(:,2), cidcs, [.75 .75 0; 0 .75 .75; .75 0 .75], "os^"); - title ("Fisher's iris data"); - set (0, "DefaultFigureVisible", visibility_setting); -warning: legend: 'best' not yet implemented for location specifier, using 'northeast' instead -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/expfit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/expfit.m -***** assert (expfit (1), 1) -***** assert (expfit (1:3), 2) -***** assert (expfit ([1:3]'), 2) -***** assert (expfit (1:3, []), 2) -***** assert (expfit (1:3, [], [], []), 2) -***** assert (expfit (magic (3)), [5 5 5]) -***** assert (expfit (cat (3, magic (3), 2*magic (3))), cat (3,[5 5 5], [10 10 10])) -***** assert (expfit (1:3, 0.1, [0 0 0], [1 1 1]), 2) -***** assert (expfit ([1:3]', 0.1, [0 0 0]', [1 1 1]'), 2) -***** assert (expfit (1:3, 0.1, [0 0 0]', [1 1 1]'), 2) -***** assert (expfit (1:3, 0.1, [1 0 0], [1 1 1]), 3) -***** assert (expfit (1:3, 0.1, [0 0 0], [4 1 1]), 1.5) -***** assert (expfit (1:3, 0.1, [1 0 0], [4 1 1]), 4.5) -***** assert (expfit (1:3, 0.1, [1 0 1], [4 1 1]), 9) -***** assert (expfit (1:3, 0.1, [], [-1 1 1]), 4) -***** assert (expfit (1:3, 0.1, [], [0.5 1 1]), 2.2) -***** assert (expfit (1:3, 0.1, [1 1 1]), NaN) -***** assert (expfit (1:3, 0.1, [], [0 0 0]), NaN) -***** assert (expfit (reshape (1:9, [3 3])), [2 5 8]) -***** assert (expfit (reshape (1:9, [3 3]), [], eye(3)), [3 7.5 12]) -***** assert (expfit (reshape (1:9, [3 3]), [], 2*eye(3)), [3 7.5 12]) -***** assert (expfit (reshape (1:9, [3 3]), [], [], [2 2 2; 1 1 1; 1 1 1]), [1.75 4.75 7.75]) -***** assert (expfit (reshape (1:9, [3 3]), [], [], [2 2 2; 1 1 1; 1 1 1]), [1.75 4.75 7.75]) -***** assert (expfit (reshape (1:9, [3 3]), [], eye(3), [2 2 2; 1 1 1; 1 1 1]), [3.5 19/3 31/3]) -***** assert ([~,v] = expfit (1:3, 0), [0; Inf]) -***** assert ([~,v] = expfit (1:3, 2), [Inf; 0]) -***** assert ([~,v] = expfit (1:3, 0.1, [1 1 1]), [NaN; NaN]) -***** assert ([~,v] = expfit (1:3, 0.1, [], [0 0 0]), [NaN; NaN]) -***** assert ([~,v] = expfit (1:3, -1), [NaN; NaN]) -***** assert ([~,v] = expfit (1:3, 5), [NaN; NaN]) -***** assert ([~,v] = expfit (1:3), [0.830485728373393; 9.698190330474096], 1000*eps) -***** assert ([~,v] = expfit (1:3, 0.1), [0.953017262058213; 7.337731146400207], 1000*eps) -***** assert ([~,v] = expfit ([1:3;2:4]), ... - [0.538440777613095, 0.897401296021825, 1.256361814430554; ... - 12.385982973214016, 20.643304955356694, 28.900626937499371], 1000*eps) -***** assert ([~,v] = expfit ([1:3;2:4], [], [1 1 1; 0 0 0]), ... - 100*[0.008132550920455, 0.013554251534091, 0.018975952147727; ... - 1.184936706156216, 1.974894510260360, 2.764852314364504], 1000*eps) -***** assert ([~,v] = expfit ([1:3;2:4], [], [], [3 3 3; 1 1 1]), ... - [0.570302756652583, 1.026544961974649, 1.482787167296715; ... - 4.587722594914109, 8.257900670845396, 11.928078746776684], 1000*eps) -***** assert ([~,v] = expfit ([1:3;2:4], [], [0 0 0; 1 1 1], [3 3 3; 1 1 1]), ... - [0.692071440311161, 1.245728592560089, 1.799385744809018; ... - 8.081825275395081, 14.547285495711145, 21.012745716027212], 1000*eps) -***** test - s = reshape (1:8, [4 2]); - s(4) = NaN; - [m,v] = expfit (s); - assert ({m, v}, {[NaN, 6.5], [NaN, 2.965574334593430;NaN, 23.856157493553368]}, 1000*eps); -***** test - s = magic (3); - c = [0 1 0; 0 1 0; 0 1 0]; - f = [1 1 0; 1 1 0; 1 1 0]; - [m,v] = expfit (s, [], c, f); - assert ({m, v}, {[5 NaN NaN], [[2.076214320933482; 24.245475826185242],NaN(2)]}, 1000*eps); -***** error expfit () -***** error expfit (1,2,3,4,5) -***** error [a b c] = expfit (1) -***** error expfit (1, [1 2]) -***** error expfit ([-1 2 3 4 5]) -***** error expfit ([1:5], [], "test") -***** error expfit ([1:5], [], [], "test") -***** error expfit ([1:5], [], [0 0 0 0]) -***** error expfit ([1:5], [], [], [1 1 1 1]) -47 tests, 47 passed, 0 known failure, 0 skipped -[inst/normlike.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/normlike.m -***** error normlike ([12, 15]); -***** error normlike ([12, 15], ones (2)); -***** error ... - normlike ([12, 15, 3], [1:50]); -***** error ... - normlike ([12, 15], [1:50], [1, 2, 3]); -***** error ... - normlike ([12, 15], [1:50], [], [1, 2, 3]); -***** test - data = 1:50; - [nlogL, avar] = normlike ([2.3, 1.2], data); - avar_out = [7.5767e-01, -1.8850e-02; -1.8850e-02, 4.8750e-04]; - assert (nlogL, 13014.95883783327, 1e-10); - assert (avar, avar_out, 1e-4); -***** test - data = 1:50; - [nlogL, avar] = normlike ([2.3, 1.2], data * 0.5); - avar_out = [3.0501e-01, -1.5859e-02; -1.5859e-02, 9.1057e-04]; - assert (nlogL, 2854.802587833265, 1e-10); - assert (avar, avar_out, 1e-4); -***** test - data = 1:50; - [nlogL, avar] = normlike ([21, 15], data); - avar_out = [5.460474308300396, -1.600790513833993; ... - -1.600790513833993, 2.667984189723321]; - assert (nlogL, 206.738325604233, 1e-12); - assert (avar, avar_out, 1e-14); -***** test - data = 1:50; - censor = ones (1, 50); - censor([2, 4, 6, 8, 12, 14]) = 0; - [nlogL, avar] = normlike ([2.3, 1.2], data, censor); - avar_out = [3.0501e-01, -1.5859e-02; -1.5859e-02, 9.1057e-04]; - assert (nlogL, Inf); - assert (avar, [NaN, NaN; NaN, NaN]); -***** test - data = 1:50; - censor = ones (1, 50); - censor([2, 4, 6, 8, 12, 14]) = 0; - [nlogL, avar] = normlike ([21, 15], data, censor); - avar_out = [24.4824488866131, -10.6649544179636; ... - -10.6649544179636, 6.22827849965737]; - assert (nlogL, 86.9254371829733, 1e-12); - assert (avar, avar_out, 8e-14); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/regression_ftest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/regression_ftest.m -***** error regression_ftest (); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]'); -***** error ... - regression_ftest ([1 2 NaN]', [2 3 4; 3 4 5]', [1 0.5]); -***** error ... - regression_ftest ([1 2 Inf]', [2 3 4; 3 4 5]', [1 0.5]); -***** error ... - regression_ftest ([1 2 3+i]', [2 3 4; 3 4 5]', [1 0.5]); -***** error ... - regression_ftest ([1 2 3]', [2 3 NaN; 3 4 5]', [1 0.5]); -***** error ... - regression_ftest ([1 2 3]', [2 3 Inf; 3 4 5]', [1 0.5]); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 3+i]', [1 0.5]); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", 0); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", 1.2); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", [.02 .1]); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", "a"); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "some", 0.05); -***** error ... - regression_ftest ([1 2 3]', [2 3; 3 4]', [1 0.5]); -***** error ... - regression_ftest ([1 2; 3 4]', [2 3; 3 4]', [1 0.5]); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], ones (2)); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], "alpha"); -***** error ... - regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [1 2]); -18 tests, 18 passed, 0 known failure, 0 skipped [inst/ismissing.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ismissing.m ***** assert (ismissing ([1,NaN,3]), [false,true,false]) @@ -8126,565 +4213,47 @@ ***** error <'indicator' and 'A' must have the same> ismissing (1, struct) ***** error ismissing (struct, 1) 49 tests, 49 passed, 0 known failure, 0 skipped -[inst/pca.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/pca.m -***** shared COEFF,SCORE,latent,tsquare,m,x,R,V,lambda,i,S,F -***** 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] = pca(zscore(x, 1)); -***** assert(tsquare,sumsq(F, 2),1E4*eps); -***** test - x=[1,2,3;2,1,3]'; - [COEFF,SCORE,latent,tsquare] = pca(x, "Economy", false); - 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); - [COEFF,SCORE,latent,tsquare] = pca(x, "Economy", false, "weights", [1 2 1], "variableweights", "variance"); -***** assert(COEFF, [0.632455532033676 -0.632455532033676; 0.741619848709566 0.741619848709566], 10*eps); -***** assert(SCORE, [-0.622019449426284 0.959119380657905; -0.505649896847432 -0.505649896847431; 1.633319243121148 0.052180413036957], 10*eps); -***** assert(latent, [1.783001790889027; 0.716998209110974], 10*eps); -***** xtest assert(tsquare, [1.5; 0.5; 1.5], 10*eps); #currently, [4; 2; 4]/3 is actually returned; see comments above -!!!!! known failure -ASSERT errors for: assert (tsquare,[1.5; 0.5; 1.5],10 * eps) - - Location | Observed | Expected | Reason - (1) 1.3333 1.5 Abs err 0.16667 exceeds tol 2.2204e-15 by 0.2 - (2) 0.66667 0.5 Abs err 0.16667 exceeds tol 2.2204e-15 by 0.2 - (3) 1.3333 1.5 Abs err 0.16667 exceeds tol 2.2204e-15 by 0.2 -***** test - x=x'; - [COEFF,SCORE,latent,tsquare] = pca(x, "Economy", false); - 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] = pca(x); -***** 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) -***** error pca([1 2; 3 4], "Algorithm", "xxx") -***** error <'centered' requires a boolean value> pca([1 2; 3 4], "Centered", "xxx") -***** error pca([1 2; 3 4], "NumComponents", -4) -***** error pca([1 2; 3 4], "Rows", 1) -***** error pca([1 2; 3 4], "Weights", [1 2 3]) -***** error pca([1 2; 3 4], "Weights", [-1 2]) -***** error pca([1 2; 3 4], "VariableWeights", [-1 2]) -***** error pca([1 2; 3 4], "VariableWeights", "xxx") -***** error pca([1 2; 3 4], "XXX", 1) -32 tests, 31 passed, 1 known failure, 0 skipped -[inst/nctstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/nctstat.m -***** error p = nctstat (); -***** error p = nctstat (1); -***** error p = nctstat ([4, 3], [3, 4, 5]); -***** shared df, d1 - df = [2, 0, -1, 1, 4]; - d1 = [1, NaN, 3, -1, 2]; -***** assert (nctstat (df, d1), [1.7725, NaN, NaN, NaN, 2.5066], 1e-4); -***** assert (nctstat ([df(1:2), df(4:5)], 1), [1.7725, NaN, NaN, 1.2533], 1e-4); -***** assert (nctstat ([df(1:2), df(4:5)], 3), [5.3174, NaN, NaN, 3.7599], 1e-4); -***** assert (nctstat ([df(1:2), df(4:5)], 2), [3.5449, NaN, NaN, 2.5066], 1e-4); -***** assert (nctstat (2, [d1(1), d1(3:5)]), [1.7725,5.3174,-1.7725,3.5449], 1e-4); -***** assert (nctstat (0, [d1(1), d1(3:5)]), [NaN, NaN, NaN, NaN]); -***** assert (nctstat (1, [d1(1), d1(3:5)]), [NaN, NaN, NaN, NaN]); -***** assert (nctstat (4, [d1(1), d1(3:5)]), [1.2533,3.7599,-1.2533,2.5066], 1e-4); -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/chi2test.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/chi2test.m -***** error chi2test (); -***** error chi2test ([1, 2, 3, 4, 5]); -***** error chi2test ([1, 2; 2, 1+3i]); -***** error chi2test ([NaN, 6; 34, 12]); -***** error ... - p = chi2test (ones (3, 3), "mutual", []); -***** error ... - p = chi2test (ones (3, 3, 3), "testtype", 2); -***** error ... - p = chi2test (ones (3, 3, 3), "mutual"); -***** error ... - p = chi2test (ones (3, 3, 3), "joint", ["a"]); -***** error ... - p = chi2test (ones (3, 3, 3), "joint", [2, 3]); -***** error ... - p = chi2test (ones (3, 3, 3, 4), "mutual", []) -***** warning p = chi2test (ones (2)); -***** warning p = chi2test (ones (3, 2)); -***** warning p = chi2test (0.4 * ones (3)); -***** test - x = [11, 3, 8; 2, 9, 14; 12, 13, 28]; - p = chi2test (x); - assert (p, 0.017787, 1e-6); -***** test - x = [11, 3, 8; 2, 9, 14; 12, 13, 28]; - [p, chisq] = chi2test (x); - assert (chisq, 11.9421, 1e-4); -***** test - x = [11, 3, 8; 2, 9, 14; 12, 13, 28]; - [p, chisq, df] = chi2test (x); - assert (df, 4); -***** test -***** shared x - x(:,:,1) = [59, 32; 9,16]; - x(:,:,2) = [55, 24;12,33]; - x(:,:,3) = [107,80;17,56];%! -***** assert (chi2test (x), 2.282063427117009e-11, 1e-14); -***** assert (chi2test (x, "mutual", []), 2.282063427117009e-11, 1e-14); -***** assert (chi2test (x, "joint", 1), 1.164834895206468e-11, 1e-14); -***** assert (chi2test (x, "joint", 2), 7.771350230001417e-11, 1e-14); -***** assert (chi2test (x, "joint", 3), 0.07151361728026107, 1e-14); -***** assert (chi2test (x, "marginal", 1), 0, 1e-14); -***** assert (chi2test (x, "marginal", 2), 6.347555814301131e-11, 1e-14); -***** assert (chi2test (x, "marginal", 3), 0, 1e-14); -***** assert (chi2test (x, "conditional", 1), 0.2303114201312508, 1e-14); -***** assert (chi2test (x, "conditional", 2), 0.0958810684407079, 1e-14); -***** assert (chi2test (x, "conditional", 3), 2.648037344954446e-11, 1e-14); -***** assert (chi2test (x, "homogeneous", []), 0.4485579470993741, 1e-14); -***** test - [pval, chisq, df, E] = chi2test (x); - assert (chisq, 64.0982, 1e-4); - assert (df, 7); - assert (E(:,:,1), [42.903, 39.921; 17.185, 15.991], ones (2, 2) * 1e-3); -***** test - [pval, chisq, df, E] = chi2test (x, "joint", 2); - assert (chisq, 56.0943, 1e-4); - assert (df, 5); - assert (E(:,:,2), [40.922, 23.310; 38.078, 21.690], ones (2, 2) * 1e-3); -***** test - [pval, chisq, df, E] = chi2test (x, "marginal", 3); - assert (chisq, 146.6058, 1e-4); - assert (df, 9); - assert (E(:,1,1), [61.642; 57.358], ones (2, 1) * 1e-3); -***** test - [pval, chisq, df, E] = chi2test (x, "conditional", 3); - assert (chisq, 52.2509, 1e-4); - assert (df, 3); - assert (E(:,:,1), [53.345, 37.655; 14.655, 10.345], ones (2, 2) * 1e-3); -***** test - [pval, chisq, df, E] = chi2test (x, "homogeneous", []); - assert (chisq, 1.6034, 1e-4); - assert (df, 2); - assert (E(:,:,1), [60.827, 31.382; 7.173, 16.618], ones (2, 2) * 1e-3); -34 tests, 34 passed, 0 known failure, 0 skipped -[inst/kstest2.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/kstest2.m -***** error kstest2 ([1,2,3,4,5,5]) -***** error kstest2 (ones(2,4), [1,2,3,4,5,5]) -***** error kstest2 ([2,3,5,7,3+3i], [1,2,3,4,5,5]) -***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"tail") -***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"tail", "whatever") -***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"badoption", 0.51) -***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"tail", 0) -***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"alpha", 0) -***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"alpha", NaN) -***** error kstest2 ([NaN,NaN,NaN,NaN,NaN],[3;5;7;8;7;6;5],"tail", "unequal") -***** test - load examgrades - [h, p] = kstest2 (grades(:,1), grades(:,2)); - assert (h, false); - assert (p, 0.1222791870137312, 1e-14); -***** test - load examgrades - [h, p] = kstest2 (grades(:,1), grades(:,2), "tail", "larger"); - assert (h, false); - assert (p, 0.1844421391011258, 1e-14); -***** test - load examgrades - [h, p] = kstest2 (grades(:,1), grades(:,2), "tail", "smaller"); - assert (h, false); - assert (p, 0.06115357930171663, 1e-14); -***** test - load examgrades - [h, p] = kstest2 (grades(:,1), grades(:,2), "tail", "smaller", "alpha", 0.1); - assert (h, true); - assert (p, 0.06115357930171663, 1e-14); -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/grpstats.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/grpstats.m -***** demo - load carsmall; - [m,p,g] = grpstats (Weight, Model_Year, {"mean", "predci", "gname"}) - n = length(m); - errorbar((1:n)',m,p(:,2)-m); - set (gca, "xtick", 1:n, "xticklabel", g); - title ("95% prediction intervals for mean weight by year"); -***** demo - load carsmall; - [m,p,g] = grpstats ([Acceleration,Weight/1000],Cylinders, ... - {"mean", "meanci", "gname"}, 0.05) - [c,r] = size (m); - errorbar((1:c)'.*ones(c,r),m,p(:,[(1:r)])-m); - set (gca, "xtick", 1:c, "xticklabel", g); - title ("95% prediction intervals for mean weight by year"); -***** test - load carsmall - means = grpstats (Acceleration, Origin); - assert (means, [14.4377; 18.0500; 15.8867; 16.3778; 16.6000; 15.5000], 0.001); -***** test - load carsmall - [grpMin,grpMax,grp] = grpstats (Acceleration, Origin, {"min","max","gname"}); - assert (grpMin, [8.0; 15.3; 13.9; 12.2; 15.7; 15.5]); - assert (grpMax, [22.2; 21.9; 18.2; 24.6; 17.5; 15.5]); -***** test - load carsmall - [grpMin,grpMax,grp] = grpstats (Acceleration, Origin, {"min","max","gname"}); - assert (grp', {"USA", "France", "Japan", "Germany", "Sweden", "Italy"}); -***** test - load carsmall - [m,p,g] = grpstats ([Acceleration,Weight/1000], Cylinders, ... - {"mean", "meanci", "gname"}, 0.05); - assert (p(:,1), [11.17621760075134, 16.13845847655224, 16.16222663683362]', ... - [1e-14, 2e-14, 1e-14]'); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/hmmestimate.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/ttest2.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ttest2.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]; - 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); + a = 1:5; + b = 6:10; + b(5) = NaN; + [h,p,ci,stats] = ttest2 (a,b); + assert (h, 1); + assert (p, 0.002535996080258229, 1e-14); + assert (ci, [-6.822014919225481, -2.17798508077452], 1e-14); + assert (stats.tstat, -4.582575694955839, 1e-14); + assert (stats.df, 7); + assert (stats.sd, 1.4638501094228, 1e-13); +***** error ttest2 ([8:0.1:12], [8:0.1:12], "tail", "invalid"); +***** error ttest2 ([8:0.1:12], [8:0.1:12], "tail", 25); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/fullfact.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/fullfact.m -***** demo - ## Full factorial design with 3 binary variables - fullfact (3) -***** demo - ## Full factorial design with 3 ordinal variables - fullfact ([2, 3, 4]) -***** error fullfact (); -***** error fullfact (2, 5); -***** error fullfact (2.5); -***** error fullfact (0); -***** error fullfact (-3); -***** error fullfact (3+2i); -***** error fullfact (Inf); -***** error fullfact (NaN); -***** error fullfact ([1, 2, -3]); -***** error fullfact ([0, 1, 2]); -***** error fullfact ([1, 2, NaN]); -***** error fullfact ([1, 2, Inf]); -***** test - A = fullfact (2); - assert (A, [0, 0; 0, 1; 1, 0; 1, 1]); -***** test - A = fullfact ([1, 2]); - assert (A, [1, 1; 1, 2]); -***** test - A = fullfact ([1, 2, 4]); - A_out = [1, 1, 1; 1, 1, 2; 1, 1, 3; 1, 1, 4; ... - 1, 2, 1; 1, 2, 2; 1, 2, 3; 1, 2, 4]; - assert (A, A_out); -15 tests, 15 passed, 0 known failure, 0 skipped -[inst/unidstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/datasample.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/datasample.m -***** error datasample(); -***** error datasample(1); -***** error datasample({1, 2, 3}, 1); -***** error datasample([1 2], -1); -***** error datasample([1 2], 1.5); -***** error datasample([1 2], [1 1]); -***** error datasample([1 2], 'g', [1 1]); -***** error datasample([1 2], 1, -1); -***** error datasample([1 2], 1, 1.5); -***** error datasample([1 2], 1, [1 1]); -***** error datasample([1 2], 1, 1, "Replace", -2); -***** error datasample([1 2], 1, 1, "Weights", "abc"); -***** error datasample([1 2], 1, 1, "Weights", [1 -2 3]); -***** error datasample([1 2], 1, 1, "Weights", ones (2)); -***** error datasample([1 2], 1, 1, "Weights", [1 2 3]); -***** test - dat = randn (10, 4); - assert (size (datasample (dat, 3, 1)), [3 4]); -***** test - dat = randn (10, 4); - assert (size (datasample (dat, 3, 2)), [10 3]); -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/randsample.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/distributions/stdnormal_inv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/stdnormal_inv.m +[inst/distributions/finv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/finv.m ***** shared p p = [-1 0 0.5 1 2]; -***** assert (stdnormal_inv (p), [NaN -Inf 0 Inf NaN]) -***** assert (stdnormal_inv ([p, NaN]), [NaN -Inf 0 Inf NaN NaN]) -***** assert (stdnormal_inv (single ([p, 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/ncx2pdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2pdf.m -***** error p = ncx2pdf (2); -***** error p = ncx2pdf (2, 4); -***** error p = ncx2pdf (2, [4, 3], [3, 4, 5]); -***** shared x1, df, d1 - x1 = [-Inf, 2, NaN, 4, Inf]; - df = [2, 0, -1, 1, 4]; - d1 = [1, NaN, 3, -1, 2]; -***** assert (ncx2pdf (x1, df, d1), [0, NaN, NaN, NaN, 0]); -***** assert (ncx2pdf (x1, df, 1), [0, 0.07093996461786045, NaN, ... - 0.06160064323277038, 0], 1e-14); -***** assert (ncx2pdf (x1, df, 3), [0, 0.1208364909271113, NaN, ... - 0.09631299762429098, 0], 1e-14); -***** assert (ncx2pdf (x1, df, 2), [0, 0.1076346446244688, NaN, ... - 0.08430464047296625, 0], 1e-14); -***** assert (ncx2pdf (x1, 2, d1), [0, NaN, NaN, NaN, 0]); -***** assert (ncx2pdf (2, df, d1), [0.1747201674611283, NaN, NaN, ... - NaN, 0.1076346446244688], 1e-14); -***** assert (ncx2pdf (4, df, d1), [0.09355987820265799, NaN, NaN, ... - NaN, 0.1192317192431485], 1e-14); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/distributions/gpinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gpinv.m -***** shared p,y1,y2,y3 - p = [-1, 0, 1/2, 1, 2]; - y1 = [NaN, 0, 0.6931471805599453, Inf, NaN]; - y2 = [NaN, 0, 1, Inf, NaN]; - y3 = [NaN, 0, 1/2, 1, NaN]; -***** assert (gpinv (p, zeros (1,5), ones (1,5), zeros (1,5)), y1) -***** assert (gpinv (p, 0, 1, zeros (1,5)), y1) -***** assert (gpinv (p, 0, ones (1,5), 0), y1) -***** assert (gpinv (p, zeros (1,5), 1, 0), y1) -***** assert (gpinv (p, 0, 1, 0), y1) -***** assert (gpinv (p, 0, 1, [0, 0, NaN, 0, 0]), [y1(1:2), NaN, y1(4:5)]) -***** assert (gpinv (p, 0, [1, 1, NaN, 1, 1], 0), [y1(1:2), NaN, y1(4:5)]) -***** assert (gpinv (p, [0, 0, NaN, 0, 0], 1, 0), [y1(1:2), NaN, y1(4:5)]) -***** assert (gpinv ([p(1:2), NaN, p(4:5)], 0, 1, 0), [y1(1:2), NaN, y1(4:5)]) -***** assert (gpinv (p, ones (1,5), ones (1,5), zeros (1,5)), y2) -***** assert (gpinv (p, 1, 1, zeros (1,5)), y2) -***** assert (gpinv (p, 1, ones (1,5), 0), y2) -***** assert (gpinv (p, ones (1,5), 1, 0), y2) -***** assert (gpinv (p, 1, 1, 0), y2) -***** assert (gpinv (p, 1, 1, [0, 0, NaN, 0, 0]), [y2(1:2), NaN, y2(4:5)]) -***** assert (gpinv (p, 1, [1, 1, NaN, 1, 1], 0), [y2(1:2), NaN, y2(4:5)]) -***** assert (gpinv (p, [1, 1, NaN, 1, 1], 1, 0), [y2(1:2), NaN, y2(4:5)]) -***** assert (gpinv ([p(1:2), NaN, p(4:5)], 1, 1, 0), [y2(1:2), NaN, y2(4:5)]) -***** assert (gpinv (p, -ones (1,5), ones (1,5), zeros (1,5)), y3) -***** assert (gpinv (p, -1, 1, zeros (1,5)), y3) -***** assert (gpinv (p, -1, ones (1,5), 0), y3) -***** assert (gpinv (p, -ones (1,5), 1, 0), y3) -***** assert (gpinv (p, -1, 1, 0), y3) -***** assert (gpinv (p, -1, 1, [0, 0, NaN, 0, 0]), [y3(1:2), NaN, y3(4:5)]) -***** assert (gpinv (p, -1, [1, 1, NaN, 1, 1], 0), [y3(1:2), NaN, y3(4:5)]) -***** assert (gpinv (p, -[1, 1, NaN, 1, 1], 1, 0), [y3(1:2), NaN, y3(4:5)]) -***** assert (gpinv ([p(1:2), NaN, p(4:5)], -1, 1, 0), [y3(1:2), NaN, y3(4:5)]) -***** assert (gpinv (single ([p, NaN]), 0, 1, 0), single ([y1, NaN])) -***** assert (gpinv ([p, NaN], 0, 1, single (0)), single ([y1, NaN])) -***** assert (gpinv ([p, NaN], 0, single (1), 0), single ([y1, NaN])) -***** assert (gpinv ([p, NaN], single (0), 1, 0), single ([y1, NaN])) -***** assert (gpinv (single ([p, NaN]), 1, 1, 0), single ([y2, NaN])) -***** assert (gpinv ([p, NaN], 1, 1, single (0)), single ([y2, NaN])) -***** assert (gpinv ([p, NaN], 1, single (1), 0), single ([y2, NaN])) -***** assert (gpinv ([p, NaN], single (1), 1, 0), single ([y2, NaN])) -***** assert (gpinv (single ([p, NaN]), -1, 1, 0), single ([y3, NaN])) -***** assert (gpinv ([p, NaN], -1, 1, single (0)), single ([y3, NaN])) -***** assert (gpinv ([p, NaN], -1, single (1), 0), single ([y3, NaN])) -***** assert (gpinv ([p, NaN], single (-1), 1, 0), single ([y3, NaN])) -***** error gpinv () -***** error gpinv (1) -***** error gpinv (1,2) -***** error gpinv (1,2,3) -***** error gpinv (1,2,3,4,5) -***** error gpinv (ones (3), ones (2), ones (2), ones (2)) -***** error gpinv (ones (2), ones (3), ones (2), ones (2)) -***** error gpinv (ones (2), ones (2), ones (3), ones (2)) -***** error gpinv (ones (2), ones (2), ones (2), ones (3)) -***** error gpinv (i, 2, 2, 2) -***** error gpinv (2, i, 2, 2) -***** error gpinv (2, 2, i, 2) -***** error gpinv (2, 2, 2, i) -52 tests, 52 passed, 0 known failure, 0 skipped -[inst/distributions/mvnpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvnpdf.m -***** demo - mu = [1, -1]; - sigma = [0.9, 0.4; 0.4, 0.3]; - [X1, X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); - x = [X1(:), X2(:)]; - p = mvnpdf (x, mu, sigma); - surf (X1, X2, reshape (p, 25, 25)); -***** error y = mvnpdf (); -***** error y = mvnpdf ([]); -***** error y = mvnpdf (ones (3,3,3)); -***** error ... - y = mvnpdf (ones (10, 2), [4, 2, 3]); -***** error ... - y = mvnpdf (ones (10, 2), [4, 2; 3, 2]); -***** error ... - y = mvnpdf (ones (10, 2), ones (3, 3, 3)); -***** shared x, mu, sigma - x = [1, 2, 5, 4, 6]; - mu = [2, 0, -1, 1, 4]; - sigma = [2, 2, 2, 2, 2]; -***** assert (mvnpdf (x), 1.579343404440977e-20, 1e-30); -***** assert (mvnpdf (x, mu), 1.899325144348102e-14, 1e-25); -***** assert (mvnpdf (x, mu, sigma), 2.449062307156273e-09, 1e-20); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/betapdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/betapdf.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 -[inst/distributions/burrinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/burrinv.m -***** shared p,y - p = [-Inf, -1, 0, 1/2, 1, 2, Inf]; - y = [NaN, NaN, 0, 1 , Inf, NaN, NaN]; -***** assert (burrinv (p, ones (1,7), ones (1,7), ones(1,7)), y, eps) -***** assert (burrinv (p, 1, 1, 1), y, eps) -***** assert (burrinv (p, [1, 1, 1, NaN, 1, 1, 1], 1, 1), [y(1:3), NaN, y(5:7)], eps) -***** assert (burrinv (p, 1, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) -***** assert (burrinv (p, 1, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) -***** assert (burrinv ([p, NaN], 1, 1, 1), [y, NaN], eps) -***** assert (burrinv (single ([p, NaN]), 1, 1, 1), single ([y, NaN]), eps('single')) -***** assert (burrinv ([p, NaN], single (1), 1, 1), single ([y, NaN]), eps('single')) -***** assert (burrinv ([p, NaN], 1, single (1), 1), single ([y, NaN]), eps('single')) -***** assert (burrinv ([p, 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 +***** assert (finv (p, 2*ones (1,5), 2*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (finv (p, 2, 2*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (finv (p, 2*ones (1,5), 2), [NaN 0 1 Inf NaN]) +***** assert (finv (p, [2 -Inf NaN Inf 2], 2), [NaN NaN NaN NaN NaN]) +***** assert (finv (p, 2, [2 -Inf NaN Inf 2]), [NaN NaN NaN NaN NaN]) +***** assert (finv ([p(1:2) NaN p(4:5)], 2, 2), [NaN 0 NaN Inf NaN]) +***** assert (finv ([p, NaN], 2, 2), [NaN 0 1 Inf NaN NaN]) +***** assert (finv (single ([p, NaN]), 2, 2), single ([NaN 0 1 Inf NaN NaN])) +***** assert (finv ([p, NaN], single (2), 2), single ([NaN 0 1 Inf NaN NaN])) +***** assert (finv ([p, 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/hygernd.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/hygernd.m ***** assert (size (hygernd (4,2,2)), [1, 1]) @@ -8720,108 +4289,117 @@ ***** 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/unidpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/unidpdf.m -***** 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 -[inst/distributions/poisspdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/logistic_rnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logistic_rnd.m -***** assert (size (logistic_rnd (1, 1, 1)), [1, 1]) -***** assert (size (logistic_rnd (1, 1, 2)), [2, 2]) -***** assert (size (logistic_rnd (1, 1, [2, 1])), [2, 1]) -***** assert (size (logistic_rnd (1, zeros (2, 2))), [2, 2]) -***** assert (size (logistic_rnd (1, ones (2, 1))), [2, 1]) -***** assert (size (logistic_rnd (1, ones (2, 2))), [2, 2]) -***** assert (size (logistic_rnd (ones (2, 1), 1)), [2, 1]) -***** assert (size (logistic_rnd (ones (2, 2), 1)), [2, 2]) -***** assert (size (logistic_rnd (1, 1, 3)), [3, 3]) -***** assert (size (logistic_rnd (1, 1, [4 1])), [4, 1]) -***** assert (size (logistic_rnd (1, 1, 4, 1)), [4, 1]) +[inst/distributions/unifinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/unifinv.m +***** shared p + p = [-1 0 0.5 1 2]; +***** assert (unifinv (p, ones (1,5), 2*ones (1,5)), [NaN 1 1.5 2 NaN]) +***** assert (unifinv (p), [NaN 1 1.5 2 NaN] - 1) +***** assert (unifinv (p, 0), [NaN 1 1.5 2 NaN] - 1) +***** assert (unifinv (p, 0, 1), [NaN 1 1.5 2 NaN] - 1) +***** assert (unifinv (p, 1, 2*ones (1,5)), [NaN 1 1.5 2 NaN]) +***** assert (unifinv (p, ones (1,5), 2), [NaN 1 1.5 2 NaN]) +***** assert (unifinv (p, [1 2 NaN 1 1], 2), [NaN NaN NaN 2 NaN]) +***** assert (unifinv (p, 1, 2*[1 0 NaN 1 1]), [NaN NaN NaN 2 NaN]) +***** assert (unifinv ([p(1:2) NaN p(4:5)], 1, 2), [NaN 1 NaN 2 NaN]) +***** assert (unifinv ([p, NaN], 1, 2), [NaN 1 1.5 2 NaN NaN]) +***** assert (unifinv (single ([p, NaN]), 1, 2), single ([NaN 1 1.5 2 NaN NaN])) +***** assert (unifinv ([p, NaN], single (1), 2), single ([NaN 1 1.5 2 NaN NaN])) +***** assert (unifinv ([p, NaN], 1, single (2)), single ([NaN 1 1.5 2 NaN NaN])) +***** error unifinv () +***** 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) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/distributions/bvncdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/bvncdf.m +***** demo + mu = [1, -1]; + sigma = [0.9, 0.4; 0.4, 0.3]; + [X1, X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); + x = [X1(:), X2(:)]; + p = bvncdf (x, mu, sigma); + Z = reshape (p, 25, 25); + surf (X1, X2, Z); + title ("Bivariate Normal Distribution"); + ylabel "X1" + xlabel "X2" +***** test + mu = [1, -1]; + sigma = [0.9, 0.4; 0.4, 0.3]; + [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); + x = [X1(:), X2(:)]; + p = bvncdf (x, mu, sigma); + p_out = [0.00011878988774500, 0.00034404112322371, ... + 0.00087682502191813, 0.00195221905058185, ... + 0.00378235566873474, 0.00638175749734415, ... + 0.00943764224329656, 0.01239164888125426, ... + 0.01472750274376648, 0.01623228313374828]'; + assert (p([1:10]), p_out, 1e-16); +***** test + mu = [1, -1]; + sigma = [0.9, 0.4; 0.4, 0.3]; + [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); + x = [X1(:), X2(:)]; + p = bvncdf (x, mu, sigma); + p_out = [0.8180695783608276, 0.8854485749482751, ... + 0.9308108777385832, 0.9579855743025508, ... + 0.9722897881414742, 0.9788150170059926, ... + 0.9813597788804785, 0.9821977956568989, ... + 0.9824283794464095, 0.9824809345614861]'; + assert (p([616:625]), p_out, 2e-16); +***** error bvncdf (randn (25,3), [], [1, 1; 1, 1]); +***** error bvncdf (randn (25,2), [], [1, 1; 1, 1]); +***** error bvncdf (randn (25,2), [], ones (3, 2)); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/distributions/laplace_rnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/laplace_rnd.m +***** assert (size (laplace_rnd (1, 1, 1)), [1, 1]) +***** assert (size (laplace_rnd (1, 1, 2)), [2, 2]) +***** assert (size (laplace_rnd (1, 1, [2, 1])), [2, 1]) +***** assert (size (laplace_rnd (1, zeros (2, 2))), [2, 2]) +***** assert (size (laplace_rnd (1, ones (2, 1))), [2, 1]) +***** assert (size (laplace_rnd (1, ones (2, 2))), [2, 2]) +***** assert (size (laplace_rnd (ones (2, 1), 1)), [2, 1]) +***** assert (size (laplace_rnd (ones (2, 2), 1)), [2, 2]) +***** assert (size (laplace_rnd (1, 1, 3)), [3, 3]) +***** assert (size (laplace_rnd (1, 1, [4 1])), [4, 1]) +***** assert (size (laplace_rnd (1, 1, 4, 1)), [4, 1]) ***** test - r = logistic_rnd (1, [1, 0, -1]); + r = laplace_rnd (1, [1, 0, -1]); assert (r([2:3]), [NaN, NaN]) -***** assert (class (logistic_rnd (1, 0)), "double") -***** assert (class (logistic_rnd (1, single (0))), "single") -***** assert (class (logistic_rnd (1, single ([0 0]))), "single") -***** assert (class (logistic_rnd (1, single (1))), "single") -***** assert (class (logistic_rnd (1, single ([1 1]))), "single") -***** assert (class (logistic_rnd (single (1), 1)), "single") -***** assert (class (logistic_rnd (single ([1 1]), 1)), "single") -***** error logistic_rnd () -***** error logistic_rnd (1) -***** error ... - logistic_rnd (ones (3), ones (2)) -***** error ... - logistic_rnd (ones (2), ones (3)) -***** error logistic_rnd (i, 2) -***** error logistic_rnd (1, i) -***** error ... - logistic_rnd (0, 1, [3, -1]) -***** error ... - logistic_rnd (0, 1, -1) -***** error ... - logistic_rnd (0, 1, 3, -1) -***** error ... - logistic_rnd (2, ones (2), 3) -***** error ... - logistic_rnd (2, ones (2), [3, 2]) -***** error ... - logistic_rnd (2, ones (2), 3, 2) +***** assert (class (laplace_rnd (1, 0)), "double") +***** assert (class (laplace_rnd (1, single (0))), "single") +***** assert (class (laplace_rnd (1, single ([0 0]))), "single") +***** assert (class (laplace_rnd (1, single (1))), "single") +***** assert (class (laplace_rnd (1, single ([1 1]))), "single") +***** assert (class (laplace_rnd (single (1), 1)), "single") +***** assert (class (laplace_rnd (single ([1 1]), 1)), "single") +***** error laplace_rnd () +***** error laplace_rnd (1) +***** error ... + laplace_rnd (ones (3), ones (2)) +***** error ... + laplace_rnd (ones (2), ones (3)) +***** error laplace_rnd (i, 2) +***** error laplace_rnd (1, i) +***** error ... + laplace_rnd (0, 1, [3, -1]) +***** error ... + laplace_rnd (0, 1, -1) +***** error ... + laplace_rnd (0, 1, 3, -1) +***** error ... + laplace_rnd (2, ones (2), 3) +***** error ... + laplace_rnd (2, ones (2), [3, 2]) +***** error ... + laplace_rnd (2, ones (2), 3, 2) 31 tests, 31 passed, 0 known failure, 0 skipped -[inst/distributions/nctpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctpdf.m -***** error y = nctpdf (); -***** error y = nctpdf (2); -***** error y = nctpdf (2, 4); -***** error y = nctpdf (5, [4, 3], [3, 4, 5]); -***** shared x1, df, delta - x1 = [-Inf, 2, NaN, 4, Inf]; - df = [2, 0, -1, 1, 4]; - delta = [1, NaN, 3, -1, 2]; -***** assert (nctpdf (x1, df, delta), [0, NaN, NaN, 0.00401787561306999, 0], 1e-14); -***** assert (nctpdf (x1, df, 1), [0, NaN, NaN, 0.0482312135423008, 0], 1e-14); -***** assert (nctpdf (x1, df, 3), [0, NaN, NaN, 0.1048493126401585, 0], 1e-14); -***** assert (nctpdf (x1, df, 2), [0, NaN, NaN, 0.08137377919890307, 0], 1e-14); -***** assert (nctpdf (x1, 3, delta), [0, NaN, NaN, 0.001185305171654381, 0], 1e-14); -***** assert (nctpdf (2, df, delta), [0.1791097459405861, NaN, NaN, ... - 0.0146500727180389, 0.3082302682110299], 1e-14); -***** assert (nctpdf (4, df, delta), [0.04467929612254971, NaN, NaN, ... - 0.00401787561306999, 0.0972086534042828], 1e-14); -11 tests, 11 passed, 0 known failure, 0 skipped [inst/distributions/unidinv.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/unidinv.m ***** shared p @@ -8841,48 +4419,592 @@ ***** error unidinv (i, 2) ***** error unidinv (2, i) 14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/triinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/triinv.m -***** shared p,y - p = [-1, 0, 0.02, 0.5, 0.98, 1, 2]; - y = [NaN, 0, 0.1, 0.5, 0.9, 1, NaN] + 1; -***** assert (triinv (p, ones (1,7), 2*ones (1,7), 1.5*ones (1,7)), y, eps) -***** assert (triinv (p, 1*ones (1,7), 2, 1.5), y, eps) -***** assert (triinv (p, 1, 2*ones (1,7), 1.5), y, eps) -***** assert (triinv (p, 1, 2, 1.5*ones (1,7)), y, eps) -***** assert (triinv (p, 1, 2, 1.5), y, eps) -***** assert (triinv (p, [1, 1, NaN, 1, 1, 1, 1], 2, 1.5), [y(1:2), NaN, y(4:7)], eps) -***** assert (triinv (p, 1, 2*[1, 1, NaN, 1, 1, 1, 1], 1.5), [y(1:2), NaN, y(4:7)], eps) -***** assert (triinv (p, 1, 2, 1.5*[1, 1, NaN, 1, 1, 1, 1]), [y(1:2), NaN, y(4:7)], eps) -***** assert (triinv ([p, NaN], 1, 2, 1.5), [y, NaN], eps) -***** assert (triinv (single ([p, NaN]), 1, 2, 1.5), single ([y, NaN]), eps('single')) -***** assert (triinv ([p, NaN], single (1), 2, 1.5), single ([y, NaN]), eps('single')) -***** assert (triinv ([p, NaN], 1, single (2), 1.5), single ([y, NaN]), eps('single')) -***** assert (triinv ([p, NaN], 1, 2, single (1.5)), single ([y, NaN]), eps('single')) -***** error triinv () -***** error triinv (1) -***** error triinv (1,2) -***** error triinv (1,2,3) -***** error triinv (1,2,3,4,5) -***** error triinv (1, ones (3), ones (2), ones (2)) -***** error triinv (1, ones (2), ones (3), ones (2)) -***** error triinv (1, ones (2), ones (2), ones (3)) -***** error triinv (i, 2, 2, 2) -***** error triinv (2, i, 2, 2) -***** error triinv (2, 2, i, 2) -***** error triinv (2, 2, 2, i) -25 tests, 25 passed, 0 known failure, 0 skipped -[inst/distributions/iwishrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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) +[inst/distributions/mvtrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtrnd.m +***** test + sigma = [1, 0.5; 0.5, 1]; + df = 3; + n = 10; + r = mvtrnd (sigma, df, n); + assert (size (r), [10, 2]); +***** test + sigma = [1, 0.5; 0.5, 1]; + df = [2; 3]; + n = 2; + r = mvtrnd (sigma, df, 2); + assert (size (r), [2, 2]); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/distributions/gevrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/nakacdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/wblpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/evpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evpdf.m +***** error evpdf () +***** error ... + evpdf (ones (3), ones (2), ones (2)) +***** error evpdf (i, 2, 2) +***** error evpdf (2, i, 2) +***** error evpdf (2, 2, i) +***** shared x, y0, y1 + x = [-5, 0, 1, 2, 3]; + y0 = [0.0067, 0.3679, 0.1794, 0.0046, 0]; + y1 = [0.0025, 0.2546, 0.3679, 0.1794, 0.0046]; +***** assert (evpdf (x), y0, 1e-4) +***** assert (evpdf (x, zeros (1,5), ones (1,5)), y0, 1e-4) +***** assert (evpdf (x, ones (1,5), ones (1,5)), y1, 1e-4) 8 tests, 8 passed, 0 known failure, 0 skipped +[inst/distributions/tricdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/normpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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,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) +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/distributions/logninv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logninv.m +***** shared p + p = [-1 0 0.5 1 2]; +***** assert (logninv (p, ones (1,5), ones (1,5)), [NaN 0 e Inf NaN]) +***** assert (logninv (p, 1, ones (1,5)), [NaN 0 e Inf NaN]) +***** assert (logninv (p, ones (1,5), 1), [NaN 0 e Inf NaN]) +***** assert (logninv (p, [1 1 NaN 0 1], 1), [NaN 0 NaN Inf NaN]) +***** assert (logninv (p, 1, [1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (logninv ([p(1:2) NaN p(4:5)], 1, 2), [NaN 0 NaN Inf NaN]) +***** assert (logninv ([p, NaN], 1, 1), [NaN 0 e Inf NaN NaN]) +***** assert (logninv (single ([p, NaN]), 1, 1), single ([NaN 0 e Inf NaN NaN])) +***** assert (logninv ([p, NaN], single (1), 1), single ([NaN 0 e Inf NaN NaN])) +***** assert (logninv ([p, NaN], 1, single (1)), single ([NaN 0 e Inf NaN NaN])) +***** error logninv () +***** 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) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/distributions/ncx2cdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2cdf.m +***** demo + ## Compare the noncentral chi-square cdf with DELTA = 2 to the + ## chi-square cdf with the same number of degrees of freedom (4): + + x = (0:0.1:10)'; + ncx2 = ncx2cdf (x, 4, 2); + chi2 = chi2cdf (x, 4); + plot(x, ncx2, "b-", "LineWidth", 2); + hold on + plot (x, chi2, "g--", "LineWidth", 2); + legend ("ncx2", "chi2", "Location", "NorthWest"); +***** error p = ncx2cdf (2); +***** error p = ncx2cdf (2, 4); +***** error p = ncx2cdf (2, [4, 3], [3, 4, 5]); +***** error ... + p = ncx2cdf (2, 4, 2, "lower"); +***** test + x = (-2:0.1:2)'; + p = ncx2cdf (x, 10, 1); + assert (p([1:21]), zeros (21, 1), 3e-84); + assert (p(22), 1.521400636466575e-09, 1e-14); + assert (p(30), 6.665480510026046e-05, 1e-14); + assert (p(41), 0.002406447308399836, 1e-14); +***** test + p = ncx2cdf (12, 10, 3); + assert (p, 0.4845555602398649, 1e-14); +***** test + p = ncx2cdf (2, 3, 2); + assert (p, 0.2207330870741212, 1e-14); +***** test + p = ncx2cdf (2, 3, 2, "upper"); + assert (p, 0.7792669129258789, 1e-14); +***** test + p = ncx2cdf ([3, 6], 3, 2, "upper"); + assert (p, [0.6423318186400054, 0.3152299878943012], 1e-14); +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/cauchy_inv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/cauchy_inv.m +***** shared p + p = [-1 0 0.5 1 2]; +***** assert (cauchy_inv (p, ones (1,5), 2*ones (1,5)), [NaN -Inf 1 Inf NaN], eps) +***** assert (cauchy_inv (p, 1, 2*ones (1,5)), [NaN -Inf 1 Inf NaN], eps) +***** assert (cauchy_inv (p, ones (1,5), 2), [NaN -Inf 1 Inf NaN], eps) +***** assert (cauchy_inv (p, [1 -Inf NaN Inf 1], 2), [NaN NaN NaN NaN NaN]) +***** assert (cauchy_inv (p, 1, 2*[1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (cauchy_inv ([p(1:2) NaN p(4:5)], 1, 2), [NaN -Inf NaN Inf NaN]) +***** assert (cauchy_inv ([p, NaN], 1, 2), [NaN -Inf 1 Inf NaN NaN], eps) +***** assert (cauchy_inv (single ([p, NaN]), 1, 2), ... + single ([NaN -Inf 1 Inf NaN NaN]), eps ("single")) +***** assert (cauchy_inv ([p, NaN], single (1), 2), ... + single ([NaN -Inf 1 Inf NaN NaN]), eps ("single")) +***** assert (cauchy_inv ([p, NaN], 1, single (2)), ... + single ([NaN -Inf 1 Inf NaN NaN]), eps ("single")) +***** error cauchy_inv () +***** error cauchy_inv (1,2) +***** error cauchy_inv (1,2,3,4) +***** error cauchy_inv (ones (3), ones (2), ones (2)) +***** error cauchy_inv (ones (2), ones (3), ones (2)) +***** error cauchy_inv (ones (2), ones (2), ones (3)) +***** error cauchy_inv (i, 2, 2) +***** error cauchy_inv (2, i, 2) +***** error cauchy_inv (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped +[inst/distributions/vmcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/vmcdf.m +***** shared theta, p0, p1 + theta = [-pi:pi/2:pi]; + p0 = [0, 0.10975, 0.5, 0.89025, 1]; + p1 = [0, 0.03752, 0.5, 0.99622, 1]; +***** assert (vmcdf (theta), p0, 1e-5) +***** assert (vmcdf (theta, zeros (1,5), ones (1,5)), p0, 1e-5) +***** assert (vmcdf (theta, 0, [1 2 3 4 5]), p1, 1e-5) +***** assert (isa (vmcdf (single (pi), 0, 1), "single"), true) +***** assert (isa (vmcdf (pi, single (0), 1), "single"), true) +***** assert (isa (vmcdf (pi, 0, single (1)), "single"), true) +***** error vmcdf () +***** error vmcdf (1, 2, 3, 4) +***** error vmcdf (ones (3), ones (2), ones (2)) +***** error vmcdf (ones (2), ones (3), ones (2)) +***** error vmcdf (ones (2), ones (2), ones (3)) +***** error vmcdf (i, 2, 2) +***** error vmcdf (2, i, 2) +***** error vmcdf (2, 2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/mnpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mnpdf.m +***** test + x = [1, 4, 2]; + pk = [0.2, 0.5, 0.3]; + y = mnpdf (x, pk); + assert (y, 0.11812, 0.001); +***** test + x = [1, 4, 2; 1, 0, 9]; + pk = [0.2, 0.5, 0.3; 0.1, 0.1, 0.8]; + y = mnpdf (x, pk); + assert (y, [0.11812; 0.13422], 0.001); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/distributions/binopdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/binopdf.m +***** shared x,y + 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, eps) +***** assert (binopdf (x, 2, 0.5*ones (1,5)), y, eps) +***** assert (binopdf (x, 2*ones (1,5), 0.5), y, eps) +***** 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], eps) +***** assert (binopdf (cat(3,x,x), 2, 0.5), cat(3,y,y), eps) +***** assert (binopdf (1, 1, 1), 1) +***** assert (binopdf (0, 3, 0), 1) +***** assert (binopdf (2, 2, 1), 1) +***** assert (binopdf (1, 2, 1), 0) +***** assert (binopdf (0, 1.1, 0), NaN) +***** assert (binopdf (1, 2, -1), NaN) +***** assert (binopdf (1, 2, 1.5), NaN) +***** assert (binopdf (i, 2, 0.5), NaN) ##matlab incompatibility +***** assert (binopdf (1, i, 0.5), NaN) ##matlab incompatibility +***** assert (binopdf (1, 2, i), NaN) ##matlab incompatibility +***** assert (binopdf ([], 1, 1), []) +***** assert (binopdf (1, [], 1), []) +***** assert (binopdf (1, 1, []), []) +***** assert (binopdf (ones (1, 0), 2, .5), ones(1, 0)) +***** assert (binopdf (ones (0, 1), 2, .5), ones(0, 1)) +***** assert (binopdf (ones (0, 1, 2), 2, .5), ones(0, 1, 2)) +***** assert (binopdf (1, ones (0, 1, 2), .5), ones(0, 1, 2)) +***** assert (binopdf (1, 2, ones (0, 1, 2)), ones(0, 1, 2)) +***** assert (binopdf (ones (1, 0, 2), 2, .5), ones(1, 0, 2)) +***** assert (binopdf (ones (1, 2, 0), 2, .5), ones(1, 2, 0)) +***** assert (binopdf (ones (0, 1, 2), NaN, .5), ones(0, 1, 2)) +***** assert (binopdf (ones (0, 1, 2), 2, NaN), ones(0, 1, 2)) +***** 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 (1, ones (2), ones (3)) +***** error binopdf (ones (3), 1, ones (2)) +***** error binopdf (ones (3), ones (2), 1) +***** error binopdf (ones (3), ones (2), ones (2)) +***** error binopdf (ones (2), ones (3), ones (2)) +***** error binopdf (ones (2), ones (2), ones (3)) +42 tests, 42 passed, 0 known failure, 0 skipped +[inst/distributions/chi2cdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/chi2cdf.m +***** shared x, p, u + x = [-1, 0, 0.5, 1, 2]; + p = [0, (1 - exp (-x(2:end) / 2))]; + u = [1, 0, NaN, 0.3934693402873666, 0.6321205588285577]; +***** assert (chi2cdf (x, 2 * ones (1,5)), p, eps) +***** assert (chi2cdf (x, 2), p, eps) +***** assert (chi2cdf (x, 2 * [1, 0, NaN, 1, 1]), [p(1), 1, NaN, p(4:5)], eps) +***** assert (chi2cdf (x, 2 * [1, 0, NaN, 1, 1], "upper"), ... + [p(1), 1, NaN, u(4:5)], eps) +***** assert (chi2cdf ([x(1:2), NaN, x(4:5)], 2), [p(1:2), NaN, p(4:5)], eps) +***** assert (chi2cdf ([x, NaN], 2), [p, NaN], eps) +***** assert (chi2cdf (single ([x, NaN]), 2), single ([p, NaN]), eps ("single")) +***** assert (chi2cdf ([x, NaN], single (2)), single ([p, NaN]), eps ("single")) +***** error chi2cdf () +***** error chi2cdf (1) +***** error chi2cdf (1, 2, 3) +***** error chi2cdf (1, 2, "uper") +***** error ... + chi2cdf (ones (3), ones (2)) +***** error ... + chi2cdf (ones (2), ones (3)) +***** error chi2cdf (i, 2) +***** error chi2cdf (2, i) +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/distributions/expinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/expinv.m +***** shared p + p = [-1 0 0.3934693402873666 1 2]; +***** assert (expinv (p, 2*ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (expinv (p, 2), [NaN 0 1 Inf NaN], eps) +***** assert (expinv (p, 2*[1 0 NaN 1 1]), [NaN NaN NaN Inf NaN], eps) +***** assert (expinv ([p(1:2) NaN p(4:5)], 2), [NaN 0 NaN Inf NaN], eps) +***** assert (expinv ([p, NaN], 2), [NaN 0 1 Inf NaN NaN], eps) +***** assert (expinv (single ([p, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), eps) +***** assert (expinv ([p, 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/reproducible-path/octave-statistics-1.5.3/inst/distributions/unidrnd.m +***** assert (size (unidrnd (2)), [1, 1]) +***** assert (size (unidrnd (ones (2,1))), [2, 1]) +***** assert (size (unidrnd (ones (2,2))), [2, 2]) +***** assert (size (unidrnd (10, [4 1])), [4, 1]) +***** assert (size (unidrnd (10, 4, 1)), [4, 1]) +***** assert (class (unidrnd (2)), "double") +***** assert (class (unidrnd (single (2))), "single") +***** assert (class (unidrnd (single ([2 2]))), "single") +***** error unidrnd () +***** error unidrnd (10, [1;2;3]) +***** error unidrnd (10, 2, ones (2)) +***** error unidrnd (10*ones (2), 2, 1) +***** error unidrnd (i) +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/distributions/betarnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/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/wblinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/wblinv.m +***** shared p + p = [-1 0 0.63212055882855778 1 2]; +***** assert (wblinv (p, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (wblinv (p, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (wblinv (p, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) +***** assert (wblinv (p, [1 -1 NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) +***** assert (wblinv (p, 1, [1 -1 NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (wblinv ([p(1:2) NaN p(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) +***** assert (wblinv ([p, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) +***** assert (wblinv (single ([p, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** assert (wblinv ([p, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) +***** assert (wblinv ([p, 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/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/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,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) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/distributions/unidcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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*ones (1,5), "upper"), 1 - y) +***** assert (unidcdf (x, 10), y) +***** assert (unidcdf (x, 10, "upper"), 1 - 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 (1, 2, "upper", 4) +***** error unidcdf (ones (3), ones (2)) +***** error unidcdf (ones (2), ones (3)) +***** error unidcdf (i, 2) +***** error unidcdf (2, i) +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/distributions/ncfcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncfcdf.m +***** demo + ## Compare the noncentral F cdf with DELTA = 10 to the F cdf with the + ## same number of numerator and denominator degrees of freedom (5, 20) + + x = (0.01:0.1:10.01)'; + p1 = ncfcdf (x, 5, 20, 10); + p = fcdf (x, 5, 20); + plot (x, p, "-", x, p1, "-"); +***** error p = ncfcdf (2, 4); +***** error p = ncfcdf (2, 4, 3); +***** error p = ncfcdf (2, 2, [4, 3], [3, 4, 5]); +***** error ... + p = ncfcdf (2, 4, 2, 3, "lower"); +***** test + x = (-2:0.1:2)'; + p = ncfcdf (x, 10, 1, 3); + assert (p([1:21]), zeros (21, 1), 1e-76); + assert (p(22), 0.004530737275319753, 1e-14); + assert (p(30), 0.255842099135669, 1e-14); + assert (p(41), 0.4379890998457305, 1e-14); +***** test + p = ncfcdf (12, 10, 3, 2); + assert (p, 0.9582287900447416, 1e-14); +***** test + p = ncfcdf (2, 3, 2, 1); + assert (p, 0.5731985522994989, 1e-14); +***** test + p = ncfcdf (2, 3, 2, 1, "upper"); + assert (p, 0.4268014477004823, 1e-14); +***** test + p = ncfcdf ([3, 6], 3, 2, 5, "upper"); + assert (p, [0.530248523596927, 0.3350482341323044], 1e-14); +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/betainv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/betainv.m +***** shared p + p = [-1 0 0.75 1 2]; +***** assert (betainv (p, ones (1,5), 2*ones (1,5)), [NaN 0 0.5 1 NaN], eps) +***** assert (betainv (p, 1, 2*ones (1,5)), [NaN 0 0.5 1 NaN], eps) +***** assert (betainv (p, ones (1,5), 2), [NaN 0 0.5 1 NaN], eps) +***** assert (betainv (p, [1 0 NaN 1 1], 2), [NaN NaN NaN 1 NaN]) +***** assert (betainv (p, 1, 2*[1 0 NaN 1 1]), [NaN NaN NaN 1 NaN]) +***** assert (betainv ([p(1:2) NaN p(4:5)], 1, 2), [NaN 0 NaN 1 NaN]) +***** assert (betainv ([p, NaN], 1, 2), [NaN 0 0.5 1 NaN NaN], eps) +***** assert (betainv (single ([p, NaN]), 1, 2), single ([NaN 0 0.5 1 NaN NaN])) +***** assert (betainv ([p, NaN], single (1), 2), single ([NaN 0 0.5 1 NaN NaN]), eps("single")) +***** assert (betainv ([p, NaN], 1, single (2)), single ([NaN 0 0.5 1 NaN NaN]), eps("single")) +***** error betainv () +***** error betainv (1) +***** error betainv (1,2) +***** error betainv (1,2,3,4) +***** error betainv (ones (3), ones (2), ones (2)) +***** error betainv (ones (2), ones (3), ones (2)) +***** error betainv (ones (2), ones (2), ones (3)) +***** error betainv (i, 2, 2) +***** error betainv (2, i, 2) +***** error betainv (2, 2, i) +20 tests, 20 passed, 0 known failure, 0 skipped [inst/distributions/hygeinv.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/hygeinv.m ***** shared x @@ -8915,227 +5037,75 @@ ***** error hygeinv (2, 2, i, 2) ***** error hygeinv (2, 2, 2, i) 27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/chi2cdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/chi2cdf.m -***** shared x, p, u - x = [-1, 0, 0.5, 1, 2]; - p = [0, (1 - exp (-x(2:end) / 2))]; - u = [1, 0, NaN, 0.3934693402873666, 0.6321205588285577]; -***** assert (chi2cdf (x, 2 * ones (1,5)), p, eps) -***** assert (chi2cdf (x, 2), p, eps) -***** assert (chi2cdf (x, 2 * [1, 0, NaN, 1, 1]), [p(1), 1, NaN, p(4:5)], eps) -***** assert (chi2cdf (x, 2 * [1, 0, NaN, 1, 1], "upper"), ... - [p(1), 1, NaN, u(4:5)], eps) -***** assert (chi2cdf ([x(1:2), NaN, x(4:5)], 2), [p(1:2), NaN, p(4:5)], eps) -***** assert (chi2cdf ([x, NaN], 2), [p, NaN], eps) -***** assert (chi2cdf (single ([x, NaN]), 2), single ([p, NaN]), eps ("single")) -***** assert (chi2cdf ([x, NaN], single (2)), single ([p, NaN]), eps ("single")) -***** error chi2cdf () -***** error chi2cdf (1) -***** error chi2cdf (1, 2, 3) -***** error chi2cdf (1, 2, "uper") -***** error ... - chi2cdf (ones (3), ones (2)) -***** error ... - chi2cdf (ones (2), ones (3)) -***** error chi2cdf (i, 2) -***** error chi2cdf (2, i) -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/distributions/chi2inv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/chi2inv.m -***** shared p - p = [-1 0 0.3934693402873666 1 2]; -***** assert (chi2inv (p, 2*ones (1,5)), [NaN 0 1 Inf NaN], 5*eps) -***** assert (chi2inv (p, 2), [NaN 0 1 Inf NaN], 5*eps) -***** assert (chi2inv (p, 2*[0 1 NaN 1 1]), [NaN 0 NaN Inf NaN], 5*eps) -***** assert (chi2inv ([p(1:2) NaN p(4:5)], 2), [NaN 0 NaN Inf NaN], 5*eps) -***** assert (chi2inv ([p, NaN], 2), [NaN 0 1 Inf NaN NaN], 5*eps) -***** assert (chi2inv (single ([p, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), 5*eps ("single")) -***** assert (chi2inv ([p, 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/binoinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/binoinv.m -***** shared p - p = [-1 0 0.5 1 2]; -***** assert (binoinv (p, 2*ones (1,5), 0.5*ones (1,5)), [NaN 0 1 2 NaN]) -***** assert (binoinv (p, 2, 0.5*ones (1,5)), [NaN 0 1 2 NaN]) -***** assert (binoinv (p, 2*ones (1,5), 0.5), [NaN 0 1 2 NaN]) -***** assert (binoinv (p, 2*[0 -1 NaN 1.1 1], 0.5), [NaN NaN NaN NaN NaN]) -***** assert (binoinv (p, 2, 0.5*[0 -1 NaN 3 1]), [NaN NaN NaN NaN NaN]) -***** assert (binoinv ([p(1:2) NaN p(4:5)], 2, 0.5), [NaN 0 NaN 2 NaN]) -***** assert (binoinv ([p, NaN], 2, 0.5), [NaN 0 1 2 NaN NaN]) -***** assert (binoinv (single ([p, NaN]), 2, 0.5), single ([NaN 0 1 2 NaN NaN])) -***** assert (binoinv ([p, NaN], single (2), 0.5), single ([NaN 0 1 2 NaN NaN])) -***** assert (binoinv ([p, NaN], 2, single (0.5)), single ([NaN 0 1 2 NaN NaN])) -***** shared x, tol - x = 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 (x, 2*x, 1./x), 2*x, 1./x), x, 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) +[inst/distributions/burrinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/burrinv.m +***** shared p,y + p = [-Inf, -1, 0, 1/2, 1, 2, Inf]; + y = [NaN, NaN, 0, 1 , Inf, NaN, NaN]; +***** assert (burrinv (p, ones (1,7), ones (1,7), ones(1,7)), y, eps) +***** assert (burrinv (p, 1, 1, 1), y, eps) +***** assert (burrinv (p, [1, 1, 1, NaN, 1, 1, 1], 1, 1), [y(1:3), NaN, y(5:7)], eps) +***** assert (burrinv (p, 1, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) +***** assert (burrinv (p, 1, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) +***** assert (burrinv ([p, NaN], 1, 1, 1), [y, NaN], eps) +***** assert (burrinv (single ([p, NaN]), 1, 1, 1), single ([y, NaN]), eps('single')) +***** assert (burrinv ([p, NaN], single (1), 1, 1), single ([y, NaN]), eps('single')) +***** assert (burrinv ([p, NaN], 1, single (1), 1), single ([y, NaN]), eps('single')) +***** assert (burrinv ([p, 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/distributions/mvtcdfqmc.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtcdfqmc.m -***** error mvtcdfqmc (1, 2, 3); -***** error mvtcdfqmc (1, 2, 3, 4, 5, 6, 7, 8); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_pdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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 (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), 0.25, 0]) -***** assert (laplace_pdf (single ([x, NaN])), single ([y, NaN])) -***** error laplace_pdf () -***** error laplace_pdf (1, 2, 3, 4) -***** error ... - laplace_pdf (1, ones (2), ones (3)) -***** error ... - laplace_pdf (ones (2), 1, ones (3)) -***** error ... - laplace_pdf (ones (2), ones (3), 1) -***** error laplace_pdf (i, 2, 3) -***** error laplace_pdf (1, i, 3) -***** error laplace_pdf (1, 2, i) -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/distributions/tinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/tinv.m -***** shared p - p = [-1 0 0.5 1 2]; -***** assert (tinv (p, ones (1,5)), [NaN -Inf 0 Inf NaN]) -***** assert (tinv (p, 1), [NaN -Inf 0 Inf NaN], eps) -***** assert (tinv (p, [1 0 NaN 1 1]), [NaN NaN NaN Inf NaN], eps) -***** assert (tinv ([p(1:2) NaN p(4:5)], 1), [NaN -Inf NaN Inf NaN]) -***** assert (tinv ([p, NaN], 1), [NaN -Inf 0 Inf NaN NaN], eps) -***** assert (tinv (single ([p, NaN]), 1), single ([NaN -Inf 0 Inf NaN NaN]), eps ("single")) -***** assert (tinv ([p, NaN], single (1)), single ([NaN -Inf 0 Inf NaN NaN]), eps ("single")) -***** error tinv () -***** error tinv (1) -***** error tinv (1,2,3) -***** error tinv (ones (3), ones (2)) -***** error tinv (ones (2), ones (3)) -***** error tinv (i, 2) -***** error tinv (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/gamcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gamcdf.m -***** shared x, y, u - x = [-1, 0, 0.5, 1, 2, Inf]; - y = [0, gammainc(x(2:end), 1)]; - u = [0, NaN, NaN, 1, 0.1353352832366127, 0]; -***** assert (gamcdf (x, ones (1,6), ones (1,6)), y, eps) -***** assert (gamcdf (x, ones (1,6), ones (1,6), []), y, eps) -***** assert (gamcdf (x, 1, ones (1,6)), y, eps) -***** assert (gamcdf (x, ones (1,6), 1), y, eps) -***** assert (gamcdf (x, [0, -Inf, NaN, Inf, 1, 1], 1), [1, NaN, NaN, 0, y(5:6)], eps) -***** assert (gamcdf (x, [0, -Inf, NaN, Inf, 1, 1], 1, "upper"), u, eps) -***** assert (gamcdf (x, 1, [0, -Inf, NaN, Inf, 1, 1]), [NaN, NaN, NaN, 0, y(5:6)], eps) -***** assert (gamcdf ([x(1:2), NaN, x(4:6)], 1, 1), [y(1:2), NaN, y(4:6)], eps) -***** assert (gamcdf ([x, NaN], 1, 1), [y, NaN]) -***** assert (gamcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) -***** assert (gamcdf ([x, NaN], single (1), 1), single ([y, NaN]), eps ("single")) -***** assert (gamcdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps ("single")) -***** error gamcdf () -***** error gamcdf (1) -***** error gamcdf (1, 2, 3, 4, 5, 6, 7) -***** error gamcdf (1, 2, 3, "uper") -***** error gamcdf (1, 2, 3, 4, 5, "uper") -***** error gamcdf (2, 3, 4, [1, 2]) -***** error ... - [p, plo, pup] = gamcdf (1, 2, 3) -***** error ... - [p, plo, pup] = gamcdf (1, 2, 3, "upper") -***** error [p, plo, pup] = ... - gamcdf (1, 2, 3, [1, 0; 0, 1], 0) -***** error [p, plo, pup] = ... - gamcdf (1, 2, 3, [1, 0; 0, 1], 1.22) -***** error [p, plo, pup] = ... - gamcdf (1, 2, 3, [1, 0; 0, 1], "alpha", "upper") -***** 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) -***** error ... - [p, plo, pup] = gamcdf (1, 2, 3, [1, 0; 0, -inf], 0.04) -30 tests, 30 passed, 0 known failure, 0 skipped -[inst/distributions/gprnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/cauchy_rnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/iwishpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/iwishpdf.m +***** assert(iwishpdf(4, 3, 3.1), 0.04226595, 1E-7); +***** assert(iwishpdf([2 -0.3;-0.3 4], [1 0.3;0.3 1], 4), 1.60166e-05, 1E-10); +***** assert(iwishpdf([6 2 5; 2 10 -5; 5 -5 25], ... + [9 5 5; 5 10 -8; 5 -8 22], 5.1), 4.946831e-12, 1E-17); +***** error iwishpdf () +***** error iwishpdf (1, 2) +***** error iwishpdf (1, 2, 0) +6 tests, 6 passed, 0 known failure, 0 skipped [inst/distributions/ncfrnd.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncfrnd.m ***** error ncfrnd () @@ -9154,135 +5124,119 @@ ***** assert (size (ncfrnd (5, ones (3, 5), 2 * ones (3, 5), [3, 5])), [3, 5]) ***** assert (size (ncfrnd (2, 3, 5)), [1, 1]) 11 tests, 11 passed, 0 known failure, 0 skipped -[inst/distributions/gevrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/mvncdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvncdf.m -***** demo - mu = [1, -1]; - Sigma = [0.9, 0.4; 0.4, 0.3]; - [X1, X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); - X = [X1(:), X2(:)]; - p = mvncdf (X, mu, Sigma); - Z = reshape (p, 25, 25); - surf (X1, X2, Z); - title ("Bivariate Normal Distribution"); - ylabel "X1" - xlabel "X2" -***** demo - mu = [0, 0]; - Sigma = [0.25, 0.3; 0.3, 1]; - p = mvncdf ([0 0], [1 1], mu, Sigma); - x1 = -3:.2:3; - x2 = -3:.2:3; - [X1, X2] = meshgrid (x1, x2); - X = [X1(:), X2(:)]; - y = mvnpdf (X, mu, Sigma); - y = reshape (y, length (x2), length (x1)); - contour (x1, x2, y, [0.0001, 0.001, 0.01, 0.05, 0.15, 0.25, 0.35]); - xlabel ("x"); - ylabel ("y"); - title ("Probability over Rectangular Region"); - line ([0, 0, 1, 1, 0], [1, 0, 0, 1, 1], "Linestyle", "--", "Color", "k"); -***** test - fD = (-2:2)'; - X = repmat (fD, 1, 4); - p = mvncdf (X); - assert (p, [0; 0.0006; 0.0625; 0.5011; 0.9121], ones (5, 1) * 1e-4); -***** test - mu = [1, -1]; - Sigma = [0.9, 0.4; 0.4, 0.3]; - [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); - X = [X1(:), X2(:)]; - p = mvncdf (X, mu, Sigma); - p_out = [0.00011878988774500, 0.00034404112322371, ... - 0.00087682502191813, 0.00195221905058185, ... - 0.00378235566873474, 0.00638175749734415, ... - 0.00943764224329656, 0.01239164888125426, ... - 0.01472750274376648, 0.01623228313374828]'; - assert (p([1:10]), p_out, 1e-16); -***** test - mu = [1, -1]; - Sigma = [0.9, 0.4; 0.4, 0.3]; - [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); - X = [X1(:), X2(:)]; - p = mvncdf (X, mu, Sigma); - p_out = [0.8180695783608276, 0.8854485749482751, ... - 0.9308108777385832, 0.9579855743025508, ... - 0.9722897881414742, 0.9788150170059926, ... - 0.9813597788804785, 0.9821977956568989, ... - 0.9824283794464095, 0.9824809345614861]'; - assert (p([616:625]), p_out, 2e-16); -***** test - mu = [0, 0]; - Sigma = [0.25, 0.3; 0.3, 1]; - [p, err] = mvncdf ([0 0], [1 1], mu, Sigma); - assert (p, 0.2097424404755626, 1e-16); - assert (err, 1e-08); -***** test - x = [1 2]; - mu = [0.5 1.5]; - sigma = [1.0 0.5; 0.5 1.0]; - p = mvncdf (x, mu, sigma); - assert (p, 0.546244443857090, 1e-15); +[inst/distributions/tpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/tpdf.m ***** test - x = [1 2]; - mu = [0.5 1.5]; - sigma = [1.0 0.5; 0.5 1.0]; - a = [-inf 0]; - p = mvncdf (a, x, mu, sigma); - assert (p, 0.482672935215631, 1e-15); -***** error p = mvncdf (randn (25,26), [], eye (26)); -***** error p = mvncdf (randn (25,8), [], eye (9)); -***** error p = mvncdf (randn (25,4), randn (25,5), [], eye (4)); -***** error p = mvncdf (randn (25,4), randn (25,4), [2, 3; 2, 3], eye (4)); -***** error p = mvncdf (randn (25,4), randn (25,4), ones (1, 5), eye (4)); -***** error p = mvncdf ([-inf 0], [1, 2], [0.5 1.5], [1.0 0.5; 0.5 1.0], option); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_cdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/laplace_cdf.m + x = rand (10,1); + y = 1./(pi * (1 + x.^2)); + assert (tpdf (x, 1), y, 5*eps); ***** 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 (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), 0.75, 1]) -***** assert (laplace_cdf (single ([x, NaN])), single ([y, NaN])) -***** error laplace_cdf () -***** error laplace_cdf (1, 2, 3, 4) -***** error ... - laplace_cdf (1, ones (2), ones (3)) -***** error ... - laplace_cdf (ones (2), 1, ones (3)) -***** error ... - laplace_cdf (ones (2), ones (3), 1) -***** error laplace_cdf (i, 2, 3) -***** error laplace_cdf (1, i, 3) -***** error laplace_cdf (1, 2, i) -11 tests, 11 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/reproducible-path/octave-statistics-1.5.3/inst/distributions/gaminv.m +***** shared p + p = [-1 0 0.63212055882855778 1 2]; +***** assert (gaminv (p, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (gaminv (p, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) +***** assert (gaminv (p, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) +***** assert (gaminv (p, [1 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) +***** assert (gaminv (p, 1, [1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (gaminv ([p(1:2) NaN p(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) +***** assert (gaminv ([p(1:2) NaN p(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) +***** assert (gaminv (1e-16, 1, 1), 1e-16, eps) +***** assert (gaminv (1e-16, 1, 2), 2e-16, eps) +***** assert (gaminv (1e-20, 3, 5), 1.957434012161815e-06, eps) +***** assert (gaminv (1e-15, 1, 1), 1e-15, eps) +***** assert (gaminv (1e-35, 1, 1), 1e-35, eps) +***** assert (gaminv ([p, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) +***** assert (gaminv (single ([p, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), ... + eps ("single")) +***** assert (gaminv ([p, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), ... + eps ("single")) +***** assert (gaminv ([p, 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) +26 tests, 26 passed, 0 known failure, 0 skipped +[inst/distributions/binornd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/nakainv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nakainv.m +***** shared p,y + p = [-Inf, -1, 0, 1/2, 1, 2, Inf]; + y = [NaN, NaN, 0, 0.83255461115769769, Inf, NaN, NaN]; +***** assert (nakainv (p, ones (1,7), ones (1,7)), y, eps) +***** assert (nakainv (p, 1, 1), y, eps) +***** assert (nakainv (p, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) +***** assert (nakainv (p, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) +***** assert (nakainv ([p, NaN], 1, 1), [y, NaN], eps) +***** assert (nakainv (single ([p, NaN]), 1, 1), single ([y, NaN])) +***** assert (nakainv ([p, NaN], single (1), 1), single ([y, NaN])) +***** assert (nakainv ([p, 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/distributions/binocdf.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/binocdf.m ***** shared x,p,p1 @@ -9320,6 +5274,383 @@ ***** error binocdf (2, i, 2) ***** error binocdf (2, 2, i) 27 tests, 27 passed, 0 known failure, 0 skipped +[inst/distributions/mvnrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvnrnd.m +***** error mvnrnd () +***** error mvnrnd ([2, 3, 4]) +***** error mvnrnd (ones (2, 2, 2), ones (1, 2, 3, 4)) +***** error mvnrnd (ones (1, 3), ones (1, 2, 3, 4)) +***** assert (size (mvnrnd ([2, 3, 4], [2, 2, 2])), [1, 3]) +***** assert (size (mvnrnd ([2, 3, 4], [2, 2, 2], 10)), [10, 3]) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/distributions/wishpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/betacdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/betacdf.m +***** shared x, y, x1, x2 + 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)]) + x1 = [0.1:0.2:0.9]; +***** assert (betacdf (x1, 2, 2), [0.028, 0.216, 0.5, 0.784, 0.972], 1e-14); +***** assert (betacdf (x1, 2, 2, "upper"), 1 - [0.028, 0.216, 0.5, 0.784, 0.972],... + 1e-14); + x2 = [1, 2, 3]; +***** assert (betacdf (0.5, x2, x2), [0.5, 0.5, 0.5], 1e-14); +***** 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,5) +***** error betacdf (1,2,3,"tail") +***** error ... + betacdf (ones (3), ones (2), ones (2)) +***** error ... + betacdf (ones (2), ones (3), ones (2)) +***** error ... + betacdf (ones (2), ones (2), ones (3)) +***** error betacdf (i, 2, 2) +***** error betacdf (2, i, 2) +***** error betacdf (2, 2, i) +24 tests, 24 passed, 0 known failure, 0 skipped +[inst/distributions/nbininv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nbininv.m +***** shared p + p = [-1 0 3/4 1 2]; +***** assert (nbininv (p, ones (1,5), 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (nbininv (p, 1, 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (nbininv (p, ones (1,5), 0.5), [NaN 0 1 Inf NaN]) +***** assert (nbininv (p, [1 0 NaN Inf 1], 0.5), [NaN NaN NaN NaN NaN]) +***** assert (nbininv (p, [1 0 1.5 Inf 1], 0.5), [NaN NaN 2 NaN NaN]) +***** assert (nbininv (p, 1, 0.5*[1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (nbininv ([p(1:2) NaN p(4:5)], 1, 0.5), [NaN 0 NaN Inf NaN]) +***** assert (nbininv ([p, NaN], 1, 0.5), [NaN 0 1 Inf NaN NaN]) +***** assert (nbininv (single ([p, NaN]), 1, 0.5), single ([NaN 0 1 Inf NaN NaN])) +***** assert (nbininv ([p, NaN], single (1), 0.5), single ([NaN 0 1 Inf NaN NaN])) +***** assert (nbininv ([p, 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/reproducible-path/octave-statistics-1.5.3/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 (x), [1 1 0 0 0]) +***** assert (unifpdf (x, 0), [1 1 0 0 0]) +***** assert (unifpdf (x, 0, 1), [1 1 0 0 0]) +***** 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,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) +20 tests, 20 passed, 0 known failure, 0 skipped +[inst/distributions/evinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evinv.m +***** error evinv () +***** error evinv (1,2,3,4,5,6) +***** error ... + evinv (ones (3), ones (2), ones (2)) +***** error ... + [p, plo, pup] = evinv (2, 3, 4, [1, 2]) +***** error ... + [p, plo, pup] = evinv (1, 2, 3) +***** error [p, plo, pup] = ... + evinv (1, 2, 3, [1, 0; 0, 1], 0) +***** error [p, plo, pup] = ... + evinv (1, 2, 3, [1, 0; 0, 1], 1.22) +***** error evinv (i, 2, 2) +***** error evinv (2, i, 2) +***** error evinv (2, 2, i) +***** error ... + [p, plo, pup] = evinv (1, 2, 3, [-1, -10; -Inf, -Inf], 0.04) +***** shared p, x + p = [0, 0.05, 0.5 0.95]; + x = [-Inf, -2.9702, -0.3665, 1.0972]; +***** assert (evinv (p), x, 1e-4) +***** assert (evinv (p, zeros (1,4), ones (1,4)), x, 1e-4) +***** assert (evinv (p, 0, ones (1,4)), x, 1e-4) +***** assert (evinv (p, zeros (1,4), 1), x, 1e-4) +***** assert (evinv (p, [0, -Inf, NaN, Inf], 1), [-Inf, -Inf, NaN, Inf], 1e-4) +***** assert (evinv (p, 0, [Inf, NaN, -1, 0]), [-Inf, NaN, NaN, NaN], 1e-4) +***** assert (evinv ([p(1:2), NaN, p(4)], 0, 1), [x(1:2), NaN, x(4)], 1e-4) +***** assert (evinv ([p, NaN], 0, 1), [x, NaN], 1e-4) +***** assert (evinv (single ([p, NaN]), 0, 1), single ([x, NaN]), 1e-4) +***** assert (evinv ([p, NaN], single (0), 1), single ([x, NaN]), 1e-4) +***** assert (evinv ([p, NaN], 0, single (1)), single ([x, NaN]), 1e-4) +22 tests, 22 passed, 0 known failure, 0 skipped +[inst/distributions/laplace_cdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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 (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), 0.75, 1]) +***** assert (laplace_cdf (single ([x, NaN])), single ([y, NaN])) +***** error laplace_cdf () +***** error laplace_cdf (1, 2, 3, 4) +***** error ... + laplace_cdf (1, ones (2), ones (3)) +***** error ... + laplace_cdf (ones (2), 1, ones (3)) +***** error ... + laplace_cdf (ones (2), ones (3), 1) +***** error laplace_cdf (i, 2, 3) +***** error laplace_cdf (1, i, 3) +***** error laplace_cdf (1, 2, i) +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/distributions/hygecdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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, 5*eps) +***** assert (hygecdf (x, 4, 2*ones (1,5), 2), y, 5*eps) +***** assert (hygecdf (x, 4, 2, 2*ones (1,5)), y, 5*eps) +***** assert (hygecdf (x, 4*[1 -1 NaN 1.1 1], 2, 2), [y(1) NaN NaN NaN y(5)], 5*eps) +***** assert (hygecdf (x, 4*[1 -1 NaN 1.1 1], 2, 2, "upper"), ... + [y(5) NaN NaN NaN y(1)], 5*eps) +***** assert (hygecdf (x, 4, 2*[1 -1 NaN 1.1 1], 2), [y(1) NaN NaN NaN y(5)], 5*eps) +***** assert (hygecdf (x, 4, 2*[1 -1 NaN 1.1 1], 2, "upper"), ... + [y(5) NaN NaN NaN y(1)], 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)], 5*eps) +***** assert (hygecdf (x, 4, 2, 2*[1 -1 NaN 1.1 1], "upper"), ... + [y(5) NaN NaN NaN y(1)], 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)], 5*eps) +***** test + p = hygecdf (x, 10, [1 2 3 4 5], 2, "upper"); + assert (p, [1, 34/90, 2/30, 0, 0], 10*eps); +***** test + p = hygecdf (2*x, 10, [1 2 3 4 5], 2, "upper"); + assert (p, [1, 34/90, 0, 0, 0], 10*eps); +***** assert (hygecdf ([x, NaN], 4, 2, 2), [y, NaN], 5*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 (1,2,3,4,"uper") +***** 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) +32 tests, 32 passed, 0 known failure, 0 skipped +[inst/distributions/gevinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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); +***** error gevinv () +***** error ... + gevinv (ones (3), ones (2)) +***** error ... + gevinv (ones (3), ones (2), 1) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/distributions/bbspdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/raylrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/raylrnd.m +***** test + sigma = 1:6; + r = raylrnd (sigma); + assert (size (r), size (sigma)); + assert (all (r >= 0)); +***** test + sigma = 0.5; + sz = [2, 3]; + r = raylrnd (sigma, sz); + assert (size (r), sz); + assert (all (r >= 0)); +***** test + sigma = 0.5; + rows = 2; + cols = 3; + r = raylrnd (sigma, rows, cols); + assert (size (r), [rows, cols]); + assert (all (r >= 0)); +***** error poissrnd () +***** error poissrnd (1, -1) +***** error poissrnd (1, ones (2)) +***** error poissrnd (1, 2, ones (2)) +***** error poissrnd (i) +***** error poissrnd (1, 2, -1) +***** error poissrnd (1, [2 -1 2]) +***** error poissrnd (ones (2,2), 3) +***** error poissrnd (ones (2,2), [3, 2]) +***** error poissrnd (ones (2,2), 2, 3) +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/distributions/jsucdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/jsucdf.m +***** error jsucdf () +***** error jsucdf (1, 2, 3, 4) +***** error ... + jsucdf (1, ones (2), ones (3)) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/distributions/cauchy_pdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/inst/distributions/nbincdf.m +***** shared x, y + x = [-1 0 1 2 Inf]; + y = [0 1/2 3/4 7/8 1]; +***** assert (nbincdf (x, ones (1,5), 0.5*ones (1,5)), y) +***** assert (nbincdf (x, 1, 0.5*ones (1,5)), y) +***** assert (nbincdf (x, ones (1,5), 0.5), y) +***** assert (nbincdf (x, ones (1,5), 0.5, "upper"), 1 - y, eps) +***** assert (nbincdf ([x(1:3) 0 x(5)], [0 1 NaN 1.5 Inf], 0.5), ... + [NaN 1/2 NaN nbinpdf(0,1.5,0.5) NaN], eps) +***** assert (nbincdf (x, 1, 0.5*[-1 NaN 4 1 1]), [NaN NaN NaN y(4:5)]) +***** assert (nbincdf ([x(1:2) NaN x(4:5)], 1, 0.5), [y(1:2) NaN y(4:5)]) +***** assert (nbincdf ([x, NaN], 1, 0.5), [y, NaN]) +***** assert (nbincdf (single ([x, NaN]), 1, 0.5), single ([y, NaN])) +***** assert (nbincdf ([x, NaN], single (1), 0.5), single ([y, NaN])) +***** assert (nbincdf ([x, NaN], 1, single (0.5)), single ([y, NaN])) +***** error nbincdf () +***** error nbincdf (1) +***** error nbincdf (1, 2) +***** error nbincdf (1, 2, 3, 4, 5) +***** error nbincdf (1, 2, 3, 4) +***** error nbincdf (1, 2, 3, "some") +***** error nbincdf (ones (3), ones (2), ones (2)) +***** error nbincdf (ones (2), ones (3), ones (2)) +***** error nbincdf (ones (2), ones (2), ones (3)) +***** error nbincdf (i, 2, 2) +***** error nbincdf (2, i, 2) +***** error nbincdf (2, 2, i) +23 tests, 23 passed, 0 known failure, 0 skipped [inst/distributions/unifcdf.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/unifcdf.m ***** shared x,y @@ -9351,242 +5682,97 @@ ***** error unifcdf (2, i, 2) ***** error unifcdf (2, 2, i) 25 tests, 25 passed, 0 known failure, 0 skipped -[inst/distributions/wblpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/wblpdf.m +[inst/distributions/poissinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/poissinv.m +***** shared p + p = [-1 0 0.5 1 2]; +***** assert (poissinv (p, ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (poissinv (p, 1), [NaN 0 1 Inf NaN]) +***** assert (poissinv (p, [1 0 NaN 1 1]), [NaN NaN NaN Inf NaN]) +***** assert (poissinv ([p(1:2) NaN p(4:5)], 1), [NaN 0 NaN Inf NaN]) +***** assert (poissinv ([p, NaN], 1), [NaN 0 1 Inf NaN NaN]) +***** assert (poissinv (single ([p, NaN]), 1), single ([NaN 0 1 Inf NaN NaN])) +***** assert (poissinv ([p, 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/reproducible-path/octave-statistics-1.5.3/inst/distributions/gampdf.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/vmpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/vmpdf.m -***** shared theta, p0, p1 - theta = [-pi:pi/2:pi]; - p0 = [0.046245, 0.125708, 0.341710, 0.125708, 0.046245]; - p1 = [0.046245, 0.069817, 0.654958, 0.014082, 0.000039]; -***** assert (vmpdf (theta), p0, 1e-5) -***** assert (vmpdf (theta, zeros (1,5), ones (1,5)), p0, 1e-6) -***** assert (vmpdf (theta, 0, [1 2 3 4 5]), p1, 1e-6) -***** assert (isa (vmpdf (single (pi), 0, 1), "single"), true) -***** assert (isa (vmpdf (pi, single (0), 1), "single"), true) -***** assert (isa (vmpdf (pi, 0, single (1)), "single"), true) -***** error vmcdf () -***** error vmcdf (1, 2, 3, 4) -***** error vmcdf (ones (3), ones (2), ones (2)) -***** error vmcdf (ones (2), ones (3), ones (2)) -***** error vmcdf (ones (2), ones (2), ones (3)) -***** error vmcdf (i, 2, 2) -***** error vmcdf (2, i, 2) -***** error vmcdf (2, 2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/finv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/finv.m + y = [0 exp(-x(2:end))]; +***** assert (gampdf (x, ones (1,5), ones (1,5)), y) +***** assert (gampdf (x, 1, ones (1,5)), y) +***** assert (gampdf (x, ones (1,5), 1), y) +***** assert (gampdf (x, [0 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN y(5)]) +***** assert (gampdf (x, 1, [0 -Inf NaN Inf 1]), [NaN NaN NaN 0 y(5)]) +***** assert (gampdf ([x, NaN], 1, 1), [y, NaN]) +***** assert (gampdf (single ([x, NaN]), 1, 1), single ([y, NaN])) +***** assert (gampdf ([x, NaN], single (1), 1), single ([y, NaN])) +***** assert (gampdf ([x, NaN], 1, single (1)), single ([y, NaN])) +***** error gampdf () +***** error gampdf (1) +***** error gampdf (1,2) +***** error gampdf (1,2,3,4) +***** error gampdf (ones (3), ones (2), ones (2)) +***** error gampdf (ones (2), ones (3), ones (2)) +***** error gampdf (ones (2), ones (2), ones (3)) +***** error gampdf (i, 2, 2) +***** error gampdf (2, i, 2) +***** error gampdf (2, 2, i) +19 tests, 19 passed, 0 known failure, 0 skipped +[inst/distributions/evcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evcdf.m +***** error evcdf () +***** error evcdf (1,2,3,4,5,6,7) +***** error evcdf (1, 2, 3, 4, "uper") +***** error ... + evcdf (ones (3), ones (2), ones (2)) +***** error evcdf (2, 3, 4, [1, 2]) +***** error ... + [p, plo, pup] = evcdf (1, 2, 3) +***** error [p, plo, pup] = ... + evcdf (1, 2, 3, [1, 0; 0, 1], 0) +***** error [p, plo, pup] = ... + evcdf (1, 2, 3, [1, 0; 0, 1], 1.22) +***** error [p, plo, pup] = ... + evcdf (1, 2, 3, [1, 0; 0, 1], "alpha", "upper") +***** error evcdf (i, 2, 2) +***** error evcdf (2, i, 2) +***** error evcdf (2, 2, i) +***** error ... + [p, plo, pup] = evcdf (1, 2, 3, [1, 0; 0, -inf], 0.04) +***** shared x, y + x = [-Inf, 1, 2, Inf]; + y = [0, 0.6321, 0.9340, 1]; +***** assert (evcdf (x, ones (1,4), ones (1,4)), y, 1e-4) +***** assert (evcdf (x, 1, ones (1,4)), y, 1e-4) +***** assert (evcdf (x, ones (1,4), 1), y, 1e-4) +***** assert (evcdf (x, [0, -Inf, NaN, Inf], 1), [0, 1, NaN, NaN], 1e-4) +***** assert (evcdf (x, 1, [Inf, NaN, -1, 0]), [NaN, NaN, NaN, NaN], 1e-4) +***** assert (evcdf ([x(1:2), NaN, x(4)], 1, 1), [y(1:2), NaN, y(4)], 1e-4) +***** assert (evcdf (x, "upper"), [1, 0.0660, 0.0006, 0], 1e-4) +***** assert (evcdf ([x, NaN], 1, 1), [y, NaN], 1e-4) +***** assert (evcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), 1e-4) +***** assert (evcdf ([x, NaN], single (1), 1), single ([y, NaN]), 1e-4) +***** assert (evcdf ([x, NaN], 1, single (1)), single ([y, NaN]), 1e-4) +24 tests, 24 passed, 0 known failure, 0 skipped +[inst/distributions/stdnormal_inv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/stdnormal_inv.m ***** shared p p = [-1 0 0.5 1 2]; -***** assert (finv (p, 2*ones (1,5), 2*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (finv (p, 2, 2*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (finv (p, 2*ones (1,5), 2), [NaN 0 1 Inf NaN]) -***** assert (finv (p, [2 -Inf NaN Inf 2], 2), [NaN NaN NaN NaN NaN]) -***** assert (finv (p, 2, [2 -Inf NaN Inf 2]), [NaN NaN NaN NaN NaN]) -***** assert (finv ([p(1:2) NaN p(4:5)], 2, 2), [NaN 0 NaN Inf NaN]) -***** assert (finv ([p, NaN], 2, 2), [NaN 0 1 Inf NaN NaN]) -***** assert (finv (single ([p, NaN]), 2, 2), single ([NaN 0 1 Inf NaN NaN])) -***** assert (finv ([p, NaN], single (2), 2), single ([NaN 0 1 Inf NaN NaN])) -***** assert (finv ([p, 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/mvtrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtrnd.m -***** test - sigma = [1, 0.5; 0.5, 1]; - df = 3; - n = 10; - r = mvtrnd (sigma, df, n); - assert (size (r), [10, 2]); -***** test - sigma = [1, 0.5; 0.5, 1]; - df = [2; 3]; - n = 2; - r = mvtrnd (sigma, df, 2); - assert (size (r), [2, 2]); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/distributions/ncfcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncfcdf.m -***** demo - ## Compare the noncentral F cdf with DELTA = 10 to the F cdf with the - ## same number of numerator and denominator degrees of freedom (5, 20) - - x = (0.01:0.1:10.01)'; - p1 = ncfcdf (x, 5, 20, 10); - p = fcdf (x, 5, 20); - plot (x, p, "-", x, p1, "-"); -***** error p = ncfcdf (2, 4); -***** error p = ncfcdf (2, 4, 3); -***** error p = ncfcdf (2, 2, [4, 3], [3, 4, 5]); -***** error ... - p = ncfcdf (2, 4, 2, 3, "lower"); -***** test - x = (-2:0.1:2)'; - p = ncfcdf (x, 10, 1, 3); - assert (p([1:21]), zeros (21, 1), 1e-76); - assert (p(22), 0.004530737275319753, 1e-14); - assert (p(30), 0.255842099135669, 1e-14); - assert (p(41), 0.4379890998457305, 1e-14); -***** test - p = ncfcdf (12, 10, 3, 2); - assert (p, 0.9582287900447416, 1e-14); -***** test - p = ncfcdf (2, 3, 2, 1); - assert (p, 0.5731985522994989, 1e-14); -***** test - p = ncfcdf (2, 3, 2, 1, "upper"); - assert (p, 0.4268014477004823, 1e-14); -***** test - p = ncfcdf ([3, 6], 3, 2, 5, "upper"); - assert (p, [0.530248523596927, 0.3350482341323044], 1e-14); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/burrcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/burrcdf.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) -23 tests, 23 passed, 0 known failure, 0 skipped -[inst/distributions/chi2rnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/geopdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/copularnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/copularnd.m -***** test - theta = 0.5; - r = copularnd ("Gaussian", theta); - assert (size (r), [1, 2]); - assert (all ((r >= 0) & (r <= 1))); -***** test - theta = 0.5; - df = 2; - r = copularnd ("t", theta, df); - assert (size (r), [1, 2]); - assert (all ((r >= 0) & (r <= 1))); -***** test - theta = 0.5; - r = copularnd ("Clayton", theta); - assert (size (r), [1, 2]); - assert (all ((r >= 0) & (r <= 1))); -***** test - theta = 0.5; - n = 2; - r = copularnd ("Clayton", theta, n); - assert (size (r), [n, 2]); - assert (all ((r >= 0) & (r <= 1))); -***** test - theta = [1; 2]; - n = 2; - d = 3; - r = copularnd ("Clayton", theta, n, d); - assert (size (r), [n, d]); - assert (all ((r >= 0) & (r <= 1))); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/distributions/mvtcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtcdf.m -***** error mvtcdf (1) -***** error mvtcdf (1, 2) -***** error ... - mvtcdf (1, [2, 3; 3, 2], 1) -***** error ... - mvtcdf ([2, 3, 4], ones (2), 1) -***** error ... - mvtcdf ([1, 2, 3], [2, 3], ones (2), 1) -***** error ... - mvtcdf ([2, 3], ones (2), [1, 2, 3]) -***** error ... - mvtcdf ([2, 3], [2, 3; 0, 0], 1) -7 tests, 7 passed, 0 known failure, 0 skipped +***** assert (stdnormal_inv (p), [NaN -Inf 0 Inf NaN]) +***** assert (stdnormal_inv ([p, NaN]), [NaN -Inf 0 Inf NaN NaN]) +***** assert (stdnormal_inv (single ([p, 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/reproducible-path/octave-statistics-1.5.3/inst/distributions/wblcdf.m ***** shared x, y @@ -9627,72 +5813,48 @@ ***** error ... [p, plo, pup] =wblcdf (1, 2, 3, [1, 0; 0, -inf], 0.04) 28 tests, 28 passed, 0 known failure, 0 skipped -[inst/distributions/copulacdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/nctcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctcdf.m -***** demo - ## Compare the noncentral t cdf with DELTA = 1 to the t cdf - ## with the same number of degrees of freedom (10). - - x = (-5:0.1:5)'; - p1 = nctcdf (x, 10, 1); - p = tcdf (x, 10); - plot (x, p, "-", x, p1, ":") -***** error p = nctcdf (2, 4); -***** error p = nctcdf (2, [4, 3], [3, 4, 5]); -***** error ... - p = nctcdf (2, 4, 2, "lower"); -***** test - x = (-2:0.1:2)'; - p = nctcdf (x, 10, 1); - assert (p(1), 0.003302485766631558, 1e-14); - assert (p(2), 0.004084668193532631, 1e-14); - assert (p(3), 0.005052800319478737, 1e-14); - assert (p(41), 0.8076115625303751, 1e-14); -***** test - p = nctcdf (12, 10, 3); - assert (p, 0.9997719343243797, 1e-14); -***** test - p = nctcdf (2, 3, 2); - assert (p, 0.4430757822176028, 1e-14); -***** test - p = nctcdf (2, 3, 2, "upper"); - assert (p, 0.5569242177823971, 1e-14); -***** test - p = nctcdf ([3, 6], 3, 2, "upper"); - assert (p, [0.3199728259444777, 0.07064855592441913], 1e-14); -8 tests, 8 passed, 0 known failure, 0 skipped +[inst/distributions/unidpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/unidpdf.m +***** 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 +[inst/distributions/logistic_pdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logistic_pdf.m +***** shared x, y + x = [-Inf -log(4) 0 log(4) Inf]; + y = [0, 0.16, 1/4, 0.16, 0]; +***** assert (logistic_pdf ([x, NaN]), [y, NaN], eps) +***** assert (logistic_pdf (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), y([4:5])], eps) +***** assert (logistic_pdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) +***** error logistic_pdf () +***** error logistic_pdf (1, 2, 3, 4) +***** error ... + logistic_pdf (1, ones (2), ones (3)) +***** error ... + logistic_pdf (ones (2), 1, ones (3)) +***** error ... + logistic_pdf (ones (2), ones (3), 1) +***** error ... + logistic_pdf (i, 2, 3) +***** error ... + logistic_pdf (1, i, 3) +***** error ... + logistic_pdf (1, 2, i) +11 tests, 11 passed, 0 known failure, 0 skipped [inst/distributions/raylcdf.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/raylcdf.m ***** test @@ -9721,36 +5883,115 @@ ***** error raylcdf (i, 2) ***** error raylcdf (2, i) 12 tests, 12 passed, 0 known failure, 0 skipped -[inst/distributions/mvtpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtpdf.m -***** assert (mvtpdf ([0 0], eye(2), 1), 0.1591549, 1E-7) -***** assert (mvtpdf ([1 0], [1 0.5; 0.5 1], 2), 0.06615947, 1E-7) -***** 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) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/distributions/trnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/trnd.m -***** assert (size (trnd (2)), [1, 1]) -***** assert (size (trnd (ones (2,1))), [2, 1]) -***** assert (size (trnd (ones (2,2))), [2, 2]) -***** assert (size (trnd (1, 3)), [3, 3]) -***** assert (size (trnd (1, [4 1])), [4, 1]) -***** assert (size (trnd (1, 4, 1)), [4, 1]) -***** assert (class (trnd (1)), "double") -***** assert (class (trnd (single (1))), "single") -***** assert (class (trnd (single ([1 1]))), "single") -***** error trnd () -***** error trnd (1, -1) -***** error trnd (1, ones (2)) -***** error trnd (i) -***** error trnd (1, [2 -1 2]) -***** error trnd (1, 2, ones (2)) -***** error trnd (1, 2, -1) -***** error trnd (ones (2,2), 3) -***** 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/copulapdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/copulapdf.m +***** test + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + theta = [1; 2]; + y = copulapdf ("Clayton", x, theta); + expected_p = [0.9872; 0.7295]; + assert (y, expected_p, 0.001); +***** test + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + y = copulapdf ("Gumbel", x, 2); + expected_p = [0.9468; 0.9468]; + assert (y, expected_p, 0.001); +***** test + x = [0.2, 0.6; 0.2, 0.6]; + theta = [1; 2]; + y = copulapdf ("Frank", x, theta); + expected_p = [0.9378; 0.8678]; + assert (y, expected_p, 0.001); +***** test + x = [0.2, 0.6; 0.2, 0.6]; + theta = [0.3; 0.7]; + y = copulapdf ("AMH", x, theta); + expected_p = [0.9540; 0.8577]; + assert (y, expected_p, 0.001); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/distributions/trirnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/normrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/exppdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/exppdf.m +***** shared x,y + x = [-1 0 0.5 1 Inf]; + y = gampdf (x, 1, 2); +***** assert (exppdf (x, 2*ones (1,5)), y) +***** assert (exppdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) +***** assert (exppdf ([x, NaN], 2), [y, NaN]) +***** assert (exppdf (single ([x, NaN]), 2), single ([y, NaN])) +***** assert (exppdf ([x, NaN], single (2)), single ([y, NaN])) +***** error exppdf () +***** error exppdf (1) +***** error exppdf (1,2,3) +***** error exppdf (ones (3), ones (2)) +***** error exppdf (ones (2), ones (3)) +***** error exppdf (i, 2) +***** error exppdf (2, i) +12 tests, 12 passed, 0 known failure, 0 skipped [inst/distributions/expcdf.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/expcdf.m ***** error expcdf () @@ -9797,79 +6038,297 @@ assert (plo, 0.20191708150860, 1e-14); assert (pup, 0.85533681958325, 1e-14); 21 tests, 21 passed, 0 known failure, 0 skipped -[inst/distributions/unidrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/unidrnd.m -***** assert (size (unidrnd (2)), [1, 1]) -***** assert (size (unidrnd (ones (2,1))), [2, 1]) -***** assert (size (unidrnd (ones (2,2))), [2, 2]) -***** assert (size (unidrnd (10, [4 1])), [4, 1]) -***** assert (size (unidrnd (10, 4, 1)), [4, 1]) -***** assert (class (unidrnd (2)), "double") -***** assert (class (unidrnd (single (2))), "single") -***** assert (class (unidrnd (single ([2 2]))), "single") -***** error unidrnd () -***** error unidrnd (10, [1;2;3]) -***** error unidrnd (10, 2, ones (2)) -***** error unidrnd (10*ones (2), 2, 1) -***** error unidrnd (i) -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/distributions/fpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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); +[inst/distributions/mvtcdfqmc.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtcdfqmc.m +***** error mvtcdfqmc (1, 2, 3); +***** error mvtcdfqmc (1, 2, 3, 4, 5, 6, 7, 8); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/distributions/logistic_cdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logistic_cdf.m ***** 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/gevpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gevpdf.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 (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), 0.75, 1]) +***** assert (logistic_cdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) +***** error logistic_cdf () +***** error logistic_cdf (1, 2, 3, 4) +***** error ... + logistic_cdf (1, ones (2), ones (3)) +***** error ... + logistic_cdf (ones (2), 1, ones (3)) +***** error ... + logistic_cdf (ones (2), ones (3), 1) +***** error ... + logistic_cdf (i, 2, 3) +***** error ... + logistic_cdf (1, i, 3) +***** error ... + logistic_cdf (1, 2, i) +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/distributions/gpcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gpcdf.m +***** shared x, y1, y1u, y2, y2u, y3, y3u + x = [-Inf, -1, 0, 1/2, 1, Inf]; + y1 = [0, 0, 0, 0.3934693402873666, 0.6321205588285577, 1]; + y1u = [1, 1, 1, 0.6065306597126334, 0.3678794411714423, 0]; + y2 = [0, 0, 0, 1/3, 1/2, 1]; + y2u = [1, 1, 1, 2/3, 1/2, 0]; + y3 = [0, 0, 0, 1/2, 1, 1]; + y3u = [1, 1, 1, 1/2, 0, 0]; +***** 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, zeros (1,6), ones (1,6), zeros (1,6), "upper"), y1u, eps) +***** assert (gpcdf (x, 0, 1, zeros (1,6), "upper"), y1u, eps) +***** assert (gpcdf (x, 0, ones (1,6), 0, "upper"), y1u, eps) +***** assert (gpcdf (x, zeros (1,6), 1, 0, "upper"), y1u, eps) +***** assert (gpcdf (x, 0, 1, 0, "upper"), y1u, 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), "upper"), y2u, eps) +***** assert (gpcdf (x, 1, 1, zeros (1,6), "upper"), y2u, eps) +***** assert (gpcdf (x, 1, ones (1,6), 0, "upper"), y2u, eps) +***** assert (gpcdf (x, ones (1,6), 1, 0, "upper"), y2u, eps) +***** assert (gpcdf (x, 1, 1, 0, "upper"), y2u, eps) +***** assert (gpcdf (x, 1, 1, [0, 0, 0, NaN, 0, 0], "upper"), ... + [y2u(1:3), NaN, y2u(5:6)], eps) +***** assert (gpcdf (x, 1, [1, 1, 1, NaN, 1, 1], 0, "upper"), ... + [y2u(1:3), NaN, y2u(5:6)], eps) +***** assert (gpcdf (x, [1, 1, 1, NaN, 1, 1], 1, 0, "upper"), ... + [y2u(1:3), NaN, y2u(5:6)], eps) +***** assert (gpcdf ([x(1:3), NaN, x(5:6)], 1, 1, 0, "upper"), ... + [y2u(1:3), NaN, y2u(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]), [y3(1:3), NaN, y3(5:6)], eps) +***** assert (gpcdf (x, -1, [1, 1, 1, NaN, 1, 1], 0), [y3(1:3), NaN, y3(5:6)], eps) +***** assert (gpcdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0), [y3(1:3), NaN, y3(5:6)], eps) +***** assert (gpcdf ([x(1:3), NaN, x(5:6)], -1, 1, 0), [y3(1:3), NaN, y3(5:6)], eps) +***** assert (gpcdf (x, -ones (1,6), ones (1,6), zeros (1,6), "upper"), y3u, eps) +***** assert (gpcdf (x, -1, 1, zeros (1,6), "upper"), y3u, eps) +***** assert (gpcdf (x, -1, ones (1,6), 0, "upper"), y3u, eps) +***** assert (gpcdf (x, -ones (1,6), 1, 0, "upper"), y3u, eps) +***** assert (gpcdf (x, -1, 1, 0, "upper"), y3u, eps) +***** assert (gpcdf (x, -1, 1, [0, 0, 0, NaN, 0, 0], "upper"), ... + [y3u(1:3), NaN, y3u(5:6)], eps) +***** assert (gpcdf (x, -1, [1, 1, 1, NaN, 1, 1], 0, "upper"), ... + [y3u(1:3), NaN, y3u(5:6)], eps) +***** assert (gpcdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0, "upper"), ... + [y3u(1:3), NaN, y3u(5:6)], eps) +***** assert (gpcdf ([x(1:3), NaN, x(5:6)], -1, 1, 0, "upper"), ... + [y3u(1:3), NaN, y3u(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, 2, 3, 4, 5, 6) +***** 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) +72 tests, 72 passed, 0 known failure, 0 skipped +[inst/distributions/jsupdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/jsupdf.m +***** error jsupdf () +***** error jsupdf (1, 2, 3, 4) +***** error ... + jsupdf (1, ones (2), ones (3)) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/distributions/laplace_pdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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 (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), 0.25, 0]) +***** assert (laplace_pdf (single ([x, NaN])), single ([y, NaN])) +***** error laplace_pdf () +***** error laplace_pdf (1, 2, 3, 4) +***** error ... + laplace_pdf (1, ones (2), ones (3)) +***** error ... + laplace_pdf (ones (2), 1, ones (3)) +***** error ... + laplace_pdf (ones (2), ones (3), 1) +***** error laplace_pdf (i, 2, 3) +***** error laplace_pdf (1, i, 3) +***** error laplace_pdf (1, 2, i) +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/distributions/nbinpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/evrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evrnd.m +***** error evrnd () +***** error ... + evrnd (ones (3), ones (2), []) +***** error ... + evrnd (ones (3), ones (2)) +***** error ... + evrnd (ones (2), ones (2), 3, 2) +***** error ... + evrnd (ones (2), ones (2), 1, 2) +***** assert (size (evrnd (2, 3, 3, 5, 7)), [3, 5, 7]) +***** assert (size (evrnd (2, 3, [3, 5, 7])), [3, 5, 7]) +***** assert (size (evrnd (ones (3, 5), 2 * ones (3, 5), [3, 5])), [3, 5]) +***** assert (size (evrnd (2, 3)), [1, 1]) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/mvnpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvnpdf.m +***** demo + mu = [1, -1]; + sigma = [0.9, 0.4; 0.4, 0.3]; + [X1, X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); + x = [X1(:), X2(:)]; + p = mvnpdf (x, mu, sigma); + surf (X1, X2, reshape (p, 25, 25)); +***** error y = mvnpdf (); +***** error y = mvnpdf ([]); +***** error y = mvnpdf (ones (3,3,3)); +***** error ... + y = mvnpdf (ones (10, 2), [4, 2, 3]); +***** error ... + y = mvnpdf (ones (10, 2), [4, 2; 3, 2]); +***** error ... + y = mvnpdf (ones (10, 2), ones (3, 3, 3)); +***** shared x, mu, sigma + x = [1, 2, 5, 4, 6]; + mu = [2, 0, -1, 1, 4]; + sigma = [2, 2, 2, 2, 2]; +***** assert (mvnpdf (x), 1.579343404440977e-20, 1e-30); +***** assert (mvnpdf (x, mu), 1.899325144348102e-14, 1e-25); +***** assert (mvnpdf (x, mu, sigma), 2.449062307156273e-09, 1e-20); +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/norminv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/norminv.m +***** shared p + p = [-1 0 0.5 1 2]; +***** assert (norminv (p, ones (1,5), ones (1,5)), [NaN -Inf 1 Inf NaN]) +***** assert (norminv (p, 1, ones (1,5)), [NaN -Inf 1 Inf NaN]) +***** assert (norminv (p, ones (1,5), 1), [NaN -Inf 1 Inf NaN]) +***** assert (norminv (p, [1 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) +***** assert (norminv (p, 1, [1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) +***** assert (norminv ([p(1:2) NaN p(4:5)], 1, 1), [NaN -Inf NaN Inf NaN]) +***** assert (norminv ([p, NaN], 1, 1), [NaN -Inf 1 Inf NaN NaN]) +***** assert (norminv (single ([p, NaN]), 1, 1), single ([NaN -Inf 1 Inf NaN NaN])) +***** assert (norminv ([p, NaN], single (1), 1), single ([NaN -Inf 1 Inf NaN NaN])) +***** assert (norminv ([p, NaN], 1, single (1)), single ([NaN -Inf 1 Inf NaN NaN])) +***** error norminv () +***** error norminv (1,2,3,4) +***** error norminv (ones (3), ones (2), ones (2)) +***** error norminv (ones (2), ones (3), ones (2)) +***** error norminv (ones (2), ones (2), ones (3)) +***** error norminv (i, 2, 2) +***** error norminv (2, i, 2) +***** error norminv (2, 2, i) +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/distributions/raylpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/raylpdf.m ***** test x = 0:0.5:2.5; sigma = 1:6; - k = 1; - mu = 0; - y = gevpdf (x, k, sigma, mu); - expected_y = [0.367879 0.143785 0.088569 0.063898 0.049953 0.040997]; + 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.5:0.5:2.5; - sigma = 0.5; - k = 1; - mu = 0; - y = gevpdf (x, k, sigma, mu); - expected_y = [0 0.735759 0.303265 0.159229 0.097350 0.065498 0.047027]; - assert (y, expected_y, 0.001); -***** test #check for continuity for k near 0 - x = 1; - sigma = 0.5; - k = -0.03:0.01:0.03; - mu = 0; - y = gevpdf (x, k, sigma, mu); - expected_y = [0.23820 0.23764 0.23704 0.23641 0.23576 0.23508 0.23438]; + 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); -3 tests, 3 passed, 0 known failure, 0 skipped +***** error poissinv () +***** 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) +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/distributions/bbsrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/wishrnd.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/wishrnd.m ***** assert(size (wishrnd (1,2)), [1, 1]); @@ -9882,361 +6341,368 @@ ***** error wishrnd (1) ***** error wishrnd ([1; 1], 2) 9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/stdnormal_cdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/poisscdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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) 1 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/unifpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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 (x), [1 1 0 0 0]) -***** assert (unifpdf (x, 0), [1 1 0 0 0]) -***** assert (unifpdf (x, 0, 1), [1 1 0 0 0]) -***** 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,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) -20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/unifrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/fcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/fcdf.m -***** shared x,y - x = [-1, 0, 0.5, 1, 2, Inf]; - y = [0, 0, 1/3, 1/2, 2/3, 1]; -***** assert (fcdf (x, 2*ones (1,6), 2*ones (1,6)), y, eps) -***** assert (fcdf (x, 2, 2*ones (1,6)), y, eps) -***** assert (fcdf (x, 2*ones (1,6), 2), y, eps) -***** assert (fcdf (x, [0 NaN Inf 2 2 2], 2), [NaN NaN 0.1353352832366127 y(4:6)], eps) -***** assert (fcdf (x, 2, [0 NaN Inf 2 2 2]), [NaN NaN 0.3934693402873666 y(4:6)], eps) -***** assert (fcdf ([x(1:2) NaN x(4:6)], 2, 2), [y(1:2) NaN y(4:6)], eps) -***** assert (fcdf ([x, NaN], 2, 2), [y, NaN], eps) -***** assert (fcdf (single ([x, NaN]), 2, 2), single ([y, NaN]), eps ("single")) -***** assert (fcdf ([x, NaN], single (2), 2), single ([y, NaN]), eps ("single")) -***** assert (fcdf ([x, NaN], 2, single (2)), single ([y, NaN]), eps ("single")) -***** error fcdf () -***** error fcdf (1) -***** error fcdf (1, 2) -***** error fcdf (1, 2, 3, 4) -***** error fcdf (1, 2, 3, "tail") -***** error fcdf (ones (3), ones (2), ones (2)) -***** error fcdf (ones (2), ones (3), ones (2)) -***** error fcdf (ones (2), ones (2), ones (3)) -***** error fcdf (i, 2, 2) -***** error fcdf (2, i, 2) -***** error fcdf (2, 2, i) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/distributions/iwishpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/iwishpdf.m -***** assert(iwishpdf(4, 3, 3.1), 0.04226595, 1E-7); -***** assert(iwishpdf([2 -0.3;-0.3 4], [1 0.3;0.3 1], 4), 1.60166e-05, 1E-10); -***** assert(iwishpdf([6 2 5; 2 10 -5; 5 -5 25], ... - [9 5 5; 5 10 -8; 5 -8 22], 5.1), 4.946831e-12, 1E-17); -***** error iwishpdf () -***** error iwishpdf (1, 2) -***** error iwishpdf (1, 2, 0) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/distributions/wblrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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) +[inst/distributions/binoinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/binoinv.m +***** shared p + p = [-1 0 0.5 1 2]; +***** assert (binoinv (p, 2*ones (1,5), 0.5*ones (1,5)), [NaN 0 1 2 NaN]) +***** assert (binoinv (p, 2, 0.5*ones (1,5)), [NaN 0 1 2 NaN]) +***** assert (binoinv (p, 2*ones (1,5), 0.5), [NaN 0 1 2 NaN]) +***** assert (binoinv (p, 2*[0 -1 NaN 1.1 1], 0.5), [NaN NaN NaN NaN NaN]) +***** assert (binoinv (p, 2, 0.5*[0 -1 NaN 3 1]), [NaN NaN NaN NaN NaN]) +***** assert (binoinv ([p(1:2) NaN p(4:5)], 2, 0.5), [NaN 0 NaN 2 NaN]) +***** assert (binoinv ([p, NaN], 2, 0.5), [NaN 0 1 2 NaN NaN]) +***** assert (binoinv (single ([p, NaN]), 2, 0.5), single ([NaN 0 1 2 NaN NaN])) +***** assert (binoinv ([p, NaN], single (2), 0.5), single ([NaN 0 1 2 NaN NaN])) +***** assert (binoinv ([p, NaN], 2, single (0.5)), single ([NaN 0 1 2 NaN NaN])) +***** shared x, tol + x = 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 (x, 2*x, 1./x), 2*x, 1./x), x, 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/nctrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctrnd.m +***** error nctrnd () +***** error nctrnd (1) +***** error ... + nctrnd (ones (3), ones (2), []) +***** error ... + nctrnd (ones (2), ones (3)) +***** error ... + nctrnd (ones (2), ones (2), 3, 2) +***** error ... + nctrnd (ones (2), ones (2), 1, 2) +***** assert (size (nctrnd (5, 2, 3, 5, 7)), [3, 5, 7]) +***** assert (size (nctrnd (5, 2, [3, 5, 7])), [3, 5, 7]) +***** assert (size (nctrnd (5, 2 * ones (3, 5), [3, 5])), [3, 5]) +***** assert (size (nctrnd (2, 5)), [1, 1]) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/distributions/frnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/frnd.m +***** assert (size (frnd (1,2)), [1, 1]) +***** assert (size (frnd (ones (2,1), 2)), [2, 1]) +***** assert (size (frnd (ones (2,2), 2)), [2, 2]) +***** assert (size (frnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (frnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (frnd (1, 2, 3)), [3, 3]) +***** assert (size (frnd (1, 2, [4 1])), [4, 1]) +***** assert (size (frnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (frnd (1, 2)), "double") +***** assert (class (frnd (single (1), 2)), "single") +***** assert (class (frnd (single ([1 1]), 2)), "single") +***** assert (class (frnd (1, single (2))), "single") +***** assert (class (frnd (1, single ([2 2]))), "single") +***** error frnd () +***** error frnd (1) +***** error frnd (ones (3), ones (2)) +***** error frnd (ones (2), ones (3)) +***** error frnd (i, 2) +***** error frnd (2, i) +***** error frnd (1,2, -1) +***** error frnd (1,2, ones (2)) +***** error frnd (1, 2, [2 -1 2]) +***** error frnd (1,2, 1, ones (2)) +***** error frnd (1,2, 1, -1) +***** error frnd (ones (2,2), 2, 3) +***** 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/poissrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/poissrnd.m -***** assert (size (poissrnd (2)), [1, 1]) -***** assert (size (poissrnd (ones (2,1))), [2, 1]) -***** assert (size (poissrnd (ones (2,2))), [2, 2]) -***** assert (size (poissrnd (1, 3)), [3, 3]) -***** assert (size (poissrnd (1, [4 1])), [4, 1]) -***** assert (size (poissrnd (1, 4, 1)), [4, 1]) -***** assert (class (poissrnd (2)), "double") -***** assert (class (poissrnd (single (2))), "single") -***** assert (class (poissrnd (single ([2 2]))), "single") -***** error poissrnd () -***** error poissrnd (1, -1) -***** error poissrnd (1, ones (2)) -***** error poissrnd (1, 2, ones (2)) -***** error poissrnd (i) -***** error poissrnd (1, 2, -1) -***** error poissrnd (1, [2 -1 2]) -***** error poissrnd (ones (2,2), 3) -***** error poissrnd (ones (2,2), [3, 2]) -***** error poissrnd (ones (2,2), 2, 3) -***** 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/jsucdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/jsucdf.m -***** error jsucdf () -***** error jsucdf (1, 2, 3, 4) -***** error ... - jsucdf (1, ones (2), ones (3)) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/distributions/ncfinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncfinv.m -***** error p = ncfinv (); -***** error p = ncfinv (1); -***** error p = ncfinv (1, 2); -***** error p = ncfinv (1, 2, 3); -***** error p = ncfinv (1, [4, 3], [3, 4, 5], 3); +[inst/distributions/nctcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctcdf.m +***** demo + ## Compare the noncentral t cdf with DELTA = 1 to the t cdf + ## with the same number of degrees of freedom (10). + + x = (-5:0.1:5)'; + p1 = nctcdf (x, 10, 1); + p = tcdf (x, 10); + plot (x, p, "-", x, p1, ":") +***** error p = nctcdf (2, 4); +***** error p = nctcdf (2, [4, 3], [3, 4, 5]); +***** error ... + p = nctcdf (2, 4, 2, "lower"); ***** test - x = [0,0.1775,0.3864,0.6395,0.9564,1.3712,1.9471,2.8215,4.3679,8.1865,Inf]; - assert (ncfinv ([0:0.1:1], 2, 3, 1), x, 1e-4); + x = (-2:0.1:2)'; + p = nctcdf (x, 10, 1); + assert (p(1), 0.003302485766631558, 1e-14); + assert (p(2), 0.004084668193532631, 1e-14); + assert (p(3), 0.005052800319478737, 1e-14); + assert (p(41), 0.8076115625303751, 1e-14); ***** test - x = [0,0.7492,1.3539,2.0025,2.7658,3.7278,5.0324,6.9826,10.3955,18.7665,Inf]; - assert (ncfinv ([0:0.1:1], 2, 3, 5), x, 1e-4); + p = nctcdf (12, 10, 3); + assert (p, 0.9997719343243797, 1e-14); ***** test - x = [0,0.2890,0.8632,1.5653,2.4088,3.4594,4.8442,6.8286,10.0983,17.3736,Inf]; - assert (ncfinv ([0:0.1:1], 1, 4, 3), x, 1e-4); + p = nctcdf (2, 3, 2); + assert (p, 0.4430757822176028, 1e-14); ***** test - x = [0.078410, 0.212716, 0.288618, 0.335752, 0.367963, 0.391460]; - assert (ncfinv (0.05, [1, 2, 3, 4, 5, 6], 10, 3), x, 1e-6); + p = nctcdf (2, 3, 2, "upper"); + assert (p, 0.5569242177823971, 1e-14); ***** test - x = [0.2574, 0.2966, 0.3188, 0.3331, 0.3432, 0.3507]; - assert (ncfinv (0.05, 5, [1, 2, 3, 4, 5, 6], 3), x, 1e-4); + p = nctcdf ([3, 6], 3, 2, "upper"); + assert (p, [0.3199728259444777, 0.07064855592441913], 1e-14); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/distributions/copulacdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/copulacdf.m ***** test - x = [1.6090, 1.8113, 1.9215, 1.9911, NaN, 2.0742]; - assert (ncfinv (0.05, 1, [1, 2, 3, 4, -1, 6], 10), x, 1e-4); + 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 - assert (ncfinv (0.996, 3, 5, 8), 58.0912074080671, 2e-13); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/distributions/binornd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/stdnormal_pdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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) + 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/distributions/gaminv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gaminv.m -***** shared p - p = [-1 0 0.63212055882855778 1 2]; -***** assert (gaminv (p, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (gaminv (p, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (gaminv (p, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) -***** assert (gaminv (p, [1 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) -***** assert (gaminv (p, 1, [1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (gaminv ([p(1:2) NaN p(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) -***** assert (gaminv ([p(1:2) NaN p(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) -***** assert (gaminv (1e-16, 1, 1), 1e-16, eps) -***** assert (gaminv (1e-16, 1, 2), 2e-16, eps) -***** assert (gaminv (1e-20, 3, 5), 1.957434012161815e-06, eps) -***** assert (gaminv (1e-15, 1, 1), 1e-15, eps) -***** assert (gaminv (1e-35, 1, 1), 1e-35, eps) -***** assert (gaminv ([p, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) -***** assert (gaminv (single ([p, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), ... - eps ("single")) -***** assert (gaminv ([p, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), ... - eps ("single")) -***** assert (gaminv ([p, 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) -26 tests, 26 passed, 0 known failure, 0 skipped -[inst/distributions/unifinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/unifinv.m +[inst/distributions/gamcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gamcdf.m +***** shared x, y, u + x = [-1, 0, 0.5, 1, 2, Inf]; + y = [0, gammainc(x(2:end), 1)]; + u = [0, NaN, NaN, 1, 0.1353352832366127, 0]; +***** assert (gamcdf (x, ones (1,6), ones (1,6)), y, eps) +***** assert (gamcdf (x, ones (1,6), ones (1,6), []), y, eps) +***** assert (gamcdf (x, 1, ones (1,6)), y, eps) +***** assert (gamcdf (x, ones (1,6), 1), y, eps) +***** assert (gamcdf (x, [0, -Inf, NaN, Inf, 1, 1], 1), [1, NaN, NaN, 0, y(5:6)], eps) +***** assert (gamcdf (x, [0, -Inf, NaN, Inf, 1, 1], 1, "upper"), u, eps) +***** assert (gamcdf (x, 1, [0, -Inf, NaN, Inf, 1, 1]), [NaN, NaN, NaN, 0, y(5:6)], eps) +***** assert (gamcdf ([x(1:2), NaN, x(4:6)], 1, 1), [y(1:2), NaN, y(4:6)], eps) +***** assert (gamcdf ([x, NaN], 1, 1), [y, NaN]) +***** assert (gamcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), eps ("single")) +***** assert (gamcdf ([x, NaN], single (1), 1), single ([y, NaN]), eps ("single")) +***** assert (gamcdf ([x, NaN], 1, single (1)), single ([y, NaN]), eps ("single")) +***** error gamcdf () +***** error gamcdf (1) +***** error gamcdf (1, 2, 3, 4, 5, 6, 7) +***** error gamcdf (1, 2, 3, "uper") +***** error gamcdf (1, 2, 3, 4, 5, "uper") +***** error gamcdf (2, 3, 4, [1, 2]) +***** error ... + [p, plo, pup] = gamcdf (1, 2, 3) +***** error ... + [p, plo, pup] = gamcdf (1, 2, 3, "upper") +***** error [p, plo, pup] = ... + gamcdf (1, 2, 3, [1, 0; 0, 1], 0) +***** error [p, plo, pup] = ... + gamcdf (1, 2, 3, [1, 0; 0, 1], 1.22) +***** error [p, plo, pup] = ... + gamcdf (1, 2, 3, [1, 0; 0, 1], "alpha", "upper") +***** 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) +***** error ... + [p, plo, pup] = gamcdf (1, 2, 3, [1, 0; 0, -inf], 0.04) +30 tests, 30 passed, 0 known failure, 0 skipped +[inst/distributions/mvtcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtcdf.m +***** error mvtcdf (1) +***** error mvtcdf (1, 2) +***** error ... + mvtcdf (1, [2, 3; 3, 2], 1) +***** error ... + mvtcdf ([2, 3, 4], ones (2), 1) +***** error ... + mvtcdf ([1, 2, 3], [2, 3], ones (2), 1) +***** error ... + mvtcdf ([2, 3], ones (2), [1, 2, 3]) +***** error ... + mvtcdf ([2, 3], [2, 3; 0, 0], 1) +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/distributions/nctinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctinv.m +***** error p = nctinv (); +***** error p = nctinv (1); +***** error p = nctinv (1, [4, 3], [3, 4, 5]); +***** test + x = [-Inf,-0.3347,0.1756,0.5209,0.8279,1.1424,1.5021,1.9633,2.6571,4.0845,Inf]; + assert (nctinv ([0:0.1:1], 2, 1), x, 1e-4); +***** test + x = [-Inf,1.5756,2.0827,2.5343,3.0043,3.5406,4.2050,5.1128,6.5510,9.6442,Inf]; + assert (nctinv ([0:0.1:1], 2, 3), x, 1e-4); +***** test + x = [-Inf,2.2167,2.9567,3.7276,4.6464,5.8455,7.5619,10.3327,15.7569,31.8159,Inf]; + assert (nctinv ([0:0.1:1], 1, 4), x, 1e-4); +***** test + x = [1.7791 1.9368 2.0239 2.0801 2.1195 2.1489]; + assert (nctinv (0.05, [1, 2, 3, 4, 5, 6], 4), x, 1e-4); +***** test + x = [-0.7755, 0.3670, 1.2554, 2.0239, 2.7348, 3.4154]; + assert (nctinv (0.05, 3, [1, 2, 3, 4, 5, 6]), x, 1e-4); +***** test + x = [-0.7183, 0.3624, 1.2878, 2.1195, -3.5413, 3.6430]; + assert (nctinv (0.05, 5, [1, 2, 3, 4, -1, 6]), x, 1e-4); +***** test + assert (nctinv (0.996, 5, 8), 30.02610554063658, 2e-11); +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/distributions/gevcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gevcdf.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); +***** 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); +***** error gevcdf () +***** error gevcdf (1, 2 ,3 ,4 ,5, 6) +***** error gevcdf (1, 2, 3, 4, "uper") +***** error ... + gevcdf (ones (3), ones (2)) +***** error ... + gevcdf (ones (3), ones (2), 3) +***** error ... + gevcdf (1 , ones (2), 3, ones (3)) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/logistic_inv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logistic_inv.m +***** test + p = [0.01:0.01:0.99]; + assert (logistic_inv (p), log (p ./ (1-p)), 25*eps); ***** shared p p = [-1 0 0.5 1 2]; -***** assert (unifinv (p, ones (1,5), 2*ones (1,5)), [NaN 1 1.5 2 NaN]) -***** assert (unifinv (p), [NaN 1 1.5 2 NaN] - 1) -***** assert (unifinv (p, 0), [NaN 1 1.5 2 NaN] - 1) -***** assert (unifinv (p, 0, 1), [NaN 1 1.5 2 NaN] - 1) -***** assert (unifinv (p, 1, 2*ones (1,5)), [NaN 1 1.5 2 NaN]) -***** assert (unifinv (p, ones (1,5), 2), [NaN 1 1.5 2 NaN]) -***** assert (unifinv (p, [1 2 NaN 1 1], 2), [NaN NaN NaN 2 NaN]) -***** assert (unifinv (p, 1, 2*[1 0 NaN 1 1]), [NaN NaN NaN 2 NaN]) -***** assert (unifinv ([p(1:2) NaN p(4:5)], 1, 2), [NaN 1 NaN 2 NaN]) -***** assert (unifinv ([p, NaN], 1, 2), [NaN 1 1.5 2 NaN NaN]) -***** assert (unifinv (single ([p, NaN]), 1, 2), single ([NaN 1 1.5 2 NaN NaN])) -***** assert (unifinv ([p, NaN], single (1), 2), single ([NaN 1 1.5 2 NaN NaN])) -***** assert (unifinv ([p, NaN], 1, single (2)), single ([NaN 1 1.5 2 NaN NaN])) -***** error unifinv () -***** 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) -21 tests, 21 passed, 0 known failure, 0 skipped -[inst/distributions/betacdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/betacdf.m -***** shared x, y, x1, x2 - 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)]) - x1 = [0.1:0.2:0.9]; -***** assert (betacdf (x1, 2, 2), [0.028, 0.216, 0.5, 0.784, 0.972], 1e-14); -***** assert (betacdf (x1, 2, 2, "upper"), 1 - [0.028, 0.216, 0.5, 0.784, 0.972],... - 1e-14); - x2 = [1, 2, 3]; -***** assert (betacdf (0.5, x2, x2), [0.5, 0.5, 0.5], 1e-14); -***** 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,5) -***** error betacdf (1,2,3,"tail") -***** error ... - betacdf (ones (3), ones (2), ones (2)) -***** error ... - betacdf (ones (2), ones (3), ones (2)) -***** error ... - betacdf (ones (2), ones (2), ones (3)) -***** error betacdf (i, 2, 2) -***** error betacdf (2, i, 2) -***** error betacdf (2, 2, i) -24 tests, 24 passed, 0 known failure, 0 skipped +***** assert (logistic_inv (p), [NaN -Inf 0 Inf NaN]) +***** assert (logistic_inv (p, 0, [-1, 0, 1, 2, 3]), [NaN NaN 0 Inf NaN]) +***** assert (logistic_inv ([p, NaN]), [NaN -Inf 0 Inf NaN NaN]) +***** assert (logistic_inv (single ([p, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) +***** error logistic_inv () +***** error logistic_inv (1, 2, 3, 4) +***** error ... + logistic_inv (1, ones (2), ones (3)) +***** error ... + logistic_inv (ones (2), 1, ones (3)) +***** error ... + logistic_inv (ones (2), ones (3), 1) +***** error ... + logistic_inv (i, 2, 3) +***** error ... + logistic_inv (1, i, 3) +***** error ... + logistic_inv (1, 2, i) +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/distributions/bbsinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/bbsinv.m +***** shared p,y,f + f = @(p,a,b,c) (a + b * (c * norminv (p) + sqrt (4 + (c * norminv(p))^2))^2) / 4; + p = [-1, 0, 1/4, 1/2, 1, 2]; + y = [0, 0, f(1/4, 0, 1, 1), 1, Inf, NaN]; +***** assert (bbsinv (p, ones (1,6), ones (1,6), zeros (1,6)), y) +***** assert (bbsinv (p, 1, 1, zeros (1,6)), y) +***** assert (bbsinv (p, 1, ones (1,6), 0), y) +***** assert (bbsinv (p, ones (1,6), 1, 0), y) +***** assert (bbsinv (p, 1, 1, 0), y) +***** assert (bbsinv (p, 1, 1, [0, 0, 0, NaN, 0, 0]), [y(1:3), NaN, y(5:6)]) +***** assert (bbsinv (p, 1, [1, 1, 1, NaN, 1, 1], 0), [y(1:3), NaN, y(5:6)]) +***** assert (bbsinv (p, [1, 1, 1, NaN, 1, 1], 1, 0), [y(1:3), NaN, y(5:6)]) +***** assert (bbsinv ([p, NaN], 1, 1, 0), [y, NaN]) +***** assert (bbsinv (single ([p, NaN]), 1, 1, 0), single ([y, NaN])) +***** assert (bbsinv ([p, NaN], 1, 1, single (0)), single ([y, NaN])) +***** assert (bbsinv ([p, NaN], 1, single (1), 0), single ([y, NaN])) +***** assert (bbsinv ([p, 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/distributions/mvtpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvtpdf.m +***** assert (mvtpdf ([0 0], eye(2), 1), 0.1591549, 1E-7) +***** assert (mvtpdf ([1 0], [1 0.5; 0.5 1], 2), 0.06615947, 1E-7) +***** 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) +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/distributions/burrpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/bbscdf.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/bbscdf.m ***** shared x,y @@ -10268,58 +6734,6 @@ ***** error bbscdf (1, 4, i, 2) ***** error bbscdf (1, 4, 3, i) 25 tests, 25 passed, 0 known failure, 0 skipped -[inst/distributions/vmcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/vmcdf.m -***** shared theta, p0, p1 - theta = [-pi:pi/2:pi]; - p0 = [0, 0.10975, 0.5, 0.89025, 1]; - p1 = [0, 0.03752, 0.5, 0.99622, 1]; -***** assert (vmcdf (theta), p0, 1e-5) -***** assert (vmcdf (theta, zeros (1,5), ones (1,5)), p0, 1e-5) -***** assert (vmcdf (theta, 0, [1 2 3 4 5]), p1, 1e-5) -***** assert (isa (vmcdf (single (pi), 0, 1), "single"), true) -***** assert (isa (vmcdf (pi, single (0), 1), "single"), true) -***** assert (isa (vmcdf (pi, 0, single (1)), "single"), true) -***** error vmcdf () -***** error vmcdf (1, 2, 3, 4) -***** error vmcdf (ones (3), ones (2), ones (2)) -***** error vmcdf (ones (2), ones (3), ones (2)) -***** error vmcdf (ones (2), ones (2), ones (3)) -***** error vmcdf (i, 2, 2) -***** error vmcdf (2, i, 2) -***** error vmcdf (2, 2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/raylrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/raylrnd.m -***** test - sigma = 1:6; - r = raylrnd (sigma); - assert (size (r), size (sigma)); - assert (all (r >= 0)); -***** test - sigma = 0.5; - sz = [2, 3]; - r = raylrnd (sigma, sz); - assert (size (r), sz); - assert (all (r >= 0)); -***** test - sigma = 0.5; - rows = 2; - cols = 3; - r = raylrnd (sigma, rows, cols); - assert (size (r), [rows, cols]); - assert (all (r >= 0)); -***** error poissrnd () -***** error poissrnd (1, -1) -***** error poissrnd (1, ones (2)) -***** error poissrnd (1, 2, ones (2)) -***** error poissrnd (i) -***** error poissrnd (1, 2, -1) -***** error poissrnd (1, [2 -1 2]) -***** error poissrnd (ones (2,2), 3) -***** error poissrnd (ones (2,2), [3, 2]) -***** error poissrnd (ones (2,2), 2, 3) -13 tests, 13 passed, 0 known failure, 0 skipped [inst/distributions/tcdf.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/tcdf.m ***** shared x,y @@ -10362,688 +6776,248 @@ ***** assert (tcdf (-10^4, 2.5), 7.1933970159922115e-11, -tol_rel) ***** assert (tcdf (-10^5, 2.5), 2.2747519231756221e-13, -tol_rel) 31 tests, 31 passed, 0 known failure, 0 skipped -[inst/distributions/gppdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gppdf.m -***** shared x,y1,y2,y3 - x = [-Inf, -1, 0, 1/2, 1, Inf]; - y1 = [0, 0, 1, 0.6065306597126334, 0.36787944117144233, 0]; - y2 = [0, 0, 1, 4/9, 1/4, 0]; - y3 = [0, 0, 1, 1, 1, 0]; -***** assert (gppdf (x, zeros (1,6), ones (1,6), zeros (1,6)), y1, eps) -***** assert (gppdf (x, 0, 1, zeros (1,6)), y1, eps) -***** assert (gppdf (x, 0, ones (1,6), 0), y1, eps) -***** assert (gppdf (x, zeros (1,6), 1, 0), y1, eps) -***** assert (gppdf (x, 0, 1, 0), y1, eps) -***** assert (gppdf (x, 0, 1, [0, 0, 0, NaN, 0, 0]), [y1(1:3), NaN, y1(5:6)]) -***** assert (gppdf (x, 0, [1, 1, 1, NaN, 1, 1], 0), [y1(1:3), NaN, y1(5:6)]) -***** assert (gppdf (x, [0, 0, 0, NaN, 0, 0], 1, 0), [y1(1:3), NaN, y1(5:6)]) -***** assert (gppdf ([x(1:3), NaN, x(5:6)], 0, 1, 0), [y1(1:3), NaN, y1(5:6)]) -***** assert (gppdf (x, ones (1,6), ones (1,6), zeros (1,6)), y2, eps) -***** assert (gppdf (x, 1, 1, zeros (1,6)), y2, eps) -***** assert (gppdf (x, 1, ones (1,6), 0), y2, eps) -***** assert (gppdf (x, ones (1,6), 1, 0), y2, eps) -***** assert (gppdf (x, 1, 1, 0), y2, eps) -***** assert (gppdf (x, 1, 1, [0, 0, 0, NaN, 0, 0]), [y2(1:3), NaN, y2(5:6)]) -***** assert (gppdf (x, 1, [1, 1, 1, NaN, 1, 1], 0), [y2(1:3), NaN, y2(5:6)]) -***** assert (gppdf (x, [1, 1, 1, NaN, 1, 1], 1, 0), [y2(1:3), NaN, y2(5:6)]) -***** assert (gppdf ([x(1:3), NaN, x(5:6)], 1, 1, 0), [y2(1:3), NaN, y2(5:6)]) -***** assert (gppdf (x, -ones (1,6), ones (1,6), zeros (1,6)), y3, eps) -***** assert (gppdf (x, -1, 1, zeros (1,6)), y3, eps) -***** assert (gppdf (x, -1, ones (1,6), 0), y3, eps) -***** assert (gppdf (x, -ones (1,6), 1, 0), y3, eps) -***** assert (gppdf (x, -1, 1, 0), y3, eps) -***** assert (gppdf (x, -1, 1, [0, 0, 0, NaN, 0, 0]), [y3(1:3), NaN, y3(5:6)]) -***** assert (gppdf (x, -1, [1, 1, 1, NaN, 1, 1], 0), [y3(1:3), NaN, y3(5:6)]) -***** assert (gppdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0), [y3(1:3), NaN, y3(5:6)]) -***** assert (gppdf ([x(1:3), NaN, x(5:6)], -1, 1, 0), [y3(1:3), NaN, y3(5:6)]) -***** assert (gppdf (single ([x, NaN]), 0, 1, 0), single ([y1, NaN])) -***** assert (gppdf ([x, NaN], 0, 1, single (0)), single ([y1, NaN])) -***** assert (gppdf ([x, NaN], 0, single (1), 0), single ([y1, NaN])) -***** assert (gppdf ([x, NaN], single (0), 1, 0), single ([y1, NaN])) -***** assert (gppdf (single ([x, NaN]), 1, 1, 0), single ([y2, NaN])) -***** assert (gppdf ([x, NaN], 1, 1, single (0)), single ([y2, NaN])) -***** assert (gppdf ([x, NaN], 1, single (1), 0), single ([y2, NaN])) -***** assert (gppdf ([x, NaN], single (1), 1, 0), single ([y2, NaN])) -***** assert (gppdf (single ([x, NaN]), -1, 1, 0), single ([y3, NaN])) -***** assert (gppdf ([x, NaN], -1, 1, single (0)), single ([y3, NaN])) -***** assert (gppdf ([x, NaN], -1, single (1), 0), single ([y3, NaN])) -***** assert (gppdf ([x, NaN], single (-1), 1, 0), single ([y3, NaN])) -***** error gppdf () -***** error gppdf (1) -***** error gppdf (1,2) -***** error gppdf (1,2,3) -***** error gppdf (1,2,3,4,5) -***** error gppdf (1, ones (2), ones (2), ones (3)) -***** error gppdf (1, ones (2), ones (3), ones (2)) -***** error gppdf (1, ones (3), ones (2), ones (2)) -***** error gppdf (i, 2, 2, 2) -***** error gppdf (2, i, 2, 2) -***** error gppdf (2, 2, i, 2) -***** error gppdf (2, 2, 2, i) -51 tests, 51 passed, 0 known failure, 0 skipped -[inst/distributions/jsupdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/jsupdf.m -***** error jsupdf () -***** error jsupdf (1, 2, 3, 4) -***** error ... - jsupdf (1, ones (2), ones (3)) -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/distributions/burrrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/burrrnd.m -***** assert (size (burrrnd (1, 1, 1)), [1 1]) -***** assert (size (burrrnd (ones (2,1), 1, 1)), [2, 1]) -***** assert (size (burrrnd (ones (2,2), 1, 1)), [2, 2]) -***** assert (size (burrrnd (1, ones (2,1), 1)), [2, 1]) -***** assert (size (burrrnd (1, ones (2,2), 1)), [2, 2]) -***** assert (size (burrrnd (1, 1, ones (2,1))), [2, 1]) -***** assert (size (burrrnd (1, 1, ones (2,2))), [2, 2]) -***** assert (size (burrrnd (1, 1, 1, 3)), [3, 3]) -***** assert (size (burrrnd (1, 1, 1, [4 1])), [4, 1]) -***** assert (size (burrrnd (1, 1, 1, 4, 1)), [4, 1]) -***** assert (class (burrrnd (1,1,1)), "double") -***** assert (class (burrrnd (single (1),1,1)), "single") -***** assert (class (burrrnd (single ([1 1]),1,1)), "single") -***** assert (class (burrrnd (1,single (1),1)), "single") -***** assert (class (burrrnd (1,single ([1 1]),1)), "single") -***** assert (class (burrrnd (1,1,single (1))), "single") -***** assert (class (burrrnd (1,1,single ([1 1]))), "single") -***** error burrrnd () -***** error burrrnd (1) -***** error burrrnd (1,2) -***** error burrrnd (ones (3), ones (2), ones (2), 2) -***** error burrrnd (ones (2), ones (3), ones (2), 2) -***** error burrrnd (ones (2), ones (2), ones (3), 2) -***** error burrrnd (i, 2, 2) -***** error burrrnd (2, i, 2) -***** error burrrnd (2, 2, i) -***** error burrrnd (4,2,2, -1) -***** error burrrnd (4,2,2, ones (2)) -***** error burrrnd (4,2,2, [2 -1 2]) -***** error burrrnd (4*ones (2),2,2, 3) -***** 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/distributions/exppdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/exppdf.m -***** shared x,y - x = [-1 0 0.5 1 Inf]; - y = gampdf (x, 1, 2); -***** assert (exppdf (x, 2*ones (1,5)), y) -***** assert (exppdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) -***** assert (exppdf ([x, NaN], 2), [y, NaN]) -***** assert (exppdf (single ([x, NaN]), 2), single ([y, NaN])) -***** assert (exppdf ([x, NaN], single (2)), single ([y, NaN])) -***** error exppdf () -***** error exppdf (1) -***** error exppdf (1,2,3) -***** error exppdf (ones (3), ones (2)) -***** error exppdf (ones (2), ones (3)) -***** error exppdf (i, 2) -***** error exppdf (2, i) -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/distributions/nbinpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/normcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/normcdf.m -***** error normcdf () -***** error normcdf (1,2,3,4,5,6,7) -***** error normcdf (1, 2, 3, 4, "uper") -***** error ... - normcdf (ones (3), ones (2), ones (2)) -***** error normcdf (2, 3, 4, [1, 2]) -***** error ... - [p, plo, pup] = normcdf (1, 2, 3) -***** error [p, plo, pup] = ... - normcdf (1, 2, 3, [1, 0; 0, 1], 0) -***** error [p, plo, pup] = ... - normcdf (1, 2, 3, [1, 0; 0, 1], 1.22) -***** error [p, plo, pup] = ... - normcdf (1, 2, 3, [1, 0; 0, 1], "alpha", "upper") -***** error normcdf (i, 2, 2) -***** error normcdf (2, i, 2) -***** error normcdf (2, 2, i) -***** error ... - [p, plo, pup] =normcdf (1, 2, 3, [1, 0; 0, -inf], 0.04) +[inst/distributions/ncx2rnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2rnd.m +***** error ncx2rnd () +***** error ... + ncx2rnd (ones (3), ones (2), []) +***** error ... + ncx2rnd (ones (3), ones (2)) +***** error ... + ncx2rnd (ones (2), ones (2), 3, 2) +***** error ... + ncx2rnd (ones (2), ones (2), 1, 2) +***** assert (size (ncx2rnd (2, 3, 3, 5, 7)), [3, 5, 7]) +***** assert (size (ncx2rnd (2, 3, [3, 5, 7])), [3, 5, 7]) +***** assert (size (ncx2rnd (ones (3, 5), 2 * ones (3, 5), [3, 5])), [3, 5]) +***** assert (size (ncx2rnd (2, 3)), [1, 1]) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/tripdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/stdnormal_cdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/stdnormal_cdf.m ***** shared x,y - x = [-Inf 1 2 Inf]; + x = [-Inf 0 1 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), [0, 1, NaN, NaN]) -***** assert (normcdf (x, 1, [Inf, NaN, -1, 0]), [NaN, NaN, NaN, 1]) -***** assert (normcdf ([x(1:2), NaN, x(4)], 1, 1), [y(1:2), NaN, y(4)]) -***** assert (normcdf (x, "upper"), [1, 0.1587, 0.0228, 0], 1e-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")) -24 tests, 24 passed, 0 known failure, 0 skipped -[inst/distributions/logistic_pdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logistic_pdf.m -***** shared x, y - x = [-Inf -log(4) 0 log(4) Inf]; - y = [0, 0.16, 1/4, 0.16, 0]; -***** assert (logistic_pdf ([x, NaN]), [y, NaN], eps) -***** assert (logistic_pdf (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), y([4:5])], eps) -***** assert (logistic_pdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) -***** error logistic_pdf () -***** error logistic_pdf (1, 2, 3, 4) -***** error ... - logistic_pdf (1, ones (2), ones (3)) -***** error ... - logistic_pdf (ones (2), 1, ones (3)) -***** error ... - logistic_pdf (ones (2), ones (3), 1) -***** error ... - logistic_pdf (i, 2, 3) -***** error ... - logistic_pdf (1, i, 3) -***** error ... - logistic_pdf (1, 2, i) -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/distributions/gampdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gampdf.m -***** shared x,y - x = [-1 0 0.5 1 Inf]; - y = [0 exp(-x(2:end))]; -***** assert (gampdf (x, ones (1,5), ones (1,5)), y) -***** assert (gampdf (x, 1, ones (1,5)), y) -***** assert (gampdf (x, ones (1,5), 1), y) -***** assert (gampdf (x, [0 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN y(5)]) -***** assert (gampdf (x, 1, [0 -Inf NaN Inf 1]), [NaN NaN NaN 0 y(5)]) -***** assert (gampdf ([x, NaN], 1, 1), [y, NaN]) -***** assert (gampdf (single ([x, NaN]), 1, 1), single ([y, NaN])) -***** assert (gampdf ([x, NaN], single (1), 1), single ([y, NaN])) -***** assert (gampdf ([x, NaN], 1, single (1)), single ([y, NaN])) -***** error gampdf () -***** error gampdf (1) -***** error gampdf (1,2) -***** error gampdf (1,2,3,4) -***** error gampdf (ones (3), ones (2), ones (2)) -***** error gampdf (ones (2), ones (3), ones (2)) -***** error gampdf (ones (2), ones (2), ones (3)) -***** error gampdf (i, 2, 2) -***** error gampdf (2, i, 2) -***** error gampdf (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/hygepdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/hygepdf.m -***** shared x,y - x = [-1 0 1 2 3]; - y = [0 1/6 4/6 1/6 0]; -***** assert (hygepdf (x, 4*ones (1,5), 2, 2), y, eps) -***** assert (hygepdf (x, 4, 2*ones (1,5), 2), y, eps) -***** assert (hygepdf (x, 4, 2, 2*ones (1,5)), y, eps) -***** assert (hygepdf (x, 4*[1 -1 NaN 1.1 1], 2, 2), [0 NaN NaN NaN 0], eps) -***** assert (hygepdf (x, 4, 2*[1 -1 NaN 1.1 1], 2), [0 NaN NaN NaN 0], eps) -***** assert (hygepdf (x, 4, 5, 2), [NaN NaN NaN NaN NaN], eps) -***** assert (hygepdf (x, 4, 2, 2*[1 -1 NaN 1.1 1]), [0 NaN NaN NaN 0], eps) -***** assert (hygepdf (x, 4, 2, 5), [NaN NaN NaN NaN NaN], eps) -***** assert (hygepdf ([x, NaN], 4, 2, 2), [y, NaN], eps) -***** assert (hygepdf (single ([x, NaN]), 4, 2, 2), single ([y, NaN]), eps("single")) -***** assert (hygepdf ([x, NaN], single (4), 2, 2), single ([y, NaN]), eps("single")) -***** assert (hygepdf ([x, NaN], 4, single (2), 2), single ([y, NaN]), eps("single")) -***** assert (hygepdf ([x, NaN], 4, 2, single (2)), single ([y, NaN]), eps("single")) -***** test - z = zeros(3,5); - z([4,5,6,8,9,12]) = [1, 0.5, 1/6, 0.5, 2/3, 1/6]; - assert (hygepdf (x, 4, [0 1 2], 2,"vectorexpand"), z, eps); - assert (hygepdf (x, 4, [0 1 2]', 2,"vectorexpand"), z, eps); - assert (hygepdf (x', 4, [0 1 2], 2,"vectorexpand"), z, eps); - assert (hygepdf (2, 4, [0 1 2], 2,"vectorexpand"), z(:,4), eps); - assert (hygepdf (x, 4, 1, 2,"vectorexpand"), z(2,:), eps); - assert (hygepdf ([NaN,x], 4, [0 1 2]', 2,"vectorexpand"),[NaN(3,1), z], eps); -***** error hygepdf () -***** error hygepdf (1) -***** error hygepdf (1,2) -***** error hygepdf (1,2,3) -***** error hygepdf (1,2,3,4,5,6) -***** error hygepdf (1, ones (3), ones (2), ones (2)) -***** error hygepdf (1, ones (2), ones (3), ones (2)) -***** error hygepdf (1, ones (2), ones (2), ones (3)) -***** error hygepdf (i, 2, 2, 2) -***** error hygepdf (2, i, 2, 2) -***** error hygepdf (2, 2, i, 2) -***** error hygepdf (2, 2, 2, i) -26 tests, 26 passed, 0 known failure, 0 skipped -[inst/distributions/chi2pdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/chi2pdf.m +***** 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/reproducible-path/octave-statistics-1.5.3/inst/distributions/poissrnd.m +***** assert (size (poissrnd (2)), [1, 1]) +***** assert (size (poissrnd (ones (2,1))), [2, 1]) +***** assert (size (poissrnd (ones (2,2))), [2, 2]) +***** assert (size (poissrnd (1, 3)), [3, 3]) +***** assert (size (poissrnd (1, [4 1])), [4, 1]) +***** assert (size (poissrnd (1, 4, 1)), [4, 1]) +***** assert (class (poissrnd (2)), "double") +***** assert (class (poissrnd (single (2))), "single") +***** assert (class (poissrnd (single ([2 2]))), "single") +***** error poissrnd () +***** error poissrnd (1, -1) +***** error poissrnd (1, ones (2)) +***** error poissrnd (1, 2, ones (2)) +***** error poissrnd (i) +***** error poissrnd (1, 2, -1) +***** error poissrnd (1, [2 -1 2]) +***** error poissrnd (ones (2,2), 3) +***** error poissrnd (ones (2,2), [3, 2]) +***** error poissrnd (ones (2,2), 2, 3) +***** 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/reproducible-path/octave-statistics-1.5.3/inst/distributions/geopdf.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) + 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/gevcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gevcdf.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); +[inst/distributions/fpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/fpdf.m ***** 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); -***** error gevcdf () -***** error gevcdf (1, 2 ,3 ,4 ,5, 6) -***** error gevcdf (1, 2, 3, 4, "uper") -***** error ... - gevcdf (ones (3), ones (2)) -***** error ... - gevcdf (ones (3), ones (2), 3) -***** error ... - gevcdf (1 , ones (2), 3, ones (3)) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/evrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evrnd.m -***** error evrnd () -***** error ... - evrnd (ones (3), ones (2), []) -***** error ... - evrnd (ones (3), ones (2)) -***** error ... - evrnd (ones (2), ones (2), 3, 2) -***** error ... - evrnd (ones (2), ones (2), 1, 2) -***** assert (size (evrnd (2, 3, 3, 5, 7)), [3, 5, 7]) -***** assert (size (evrnd (2, 3, [3, 5, 7])), [3, 5, 7]) -***** assert (size (evrnd (ones (3, 5), 2 * ones (3, 5), [3, 5])), [3, 5]) -***** assert (size (evrnd (2, 3)), [1, 1]) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/logninv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logninv.m -***** shared p - p = [-1 0 0.5 1 2]; -***** assert (logninv (p, ones (1,5), ones (1,5)), [NaN 0 e Inf NaN]) -***** assert (logninv (p, 1, ones (1,5)), [NaN 0 e Inf NaN]) -***** assert (logninv (p, ones (1,5), 1), [NaN 0 e Inf NaN]) -***** assert (logninv (p, [1 1 NaN 0 1], 1), [NaN 0 NaN Inf NaN]) -***** assert (logninv (p, 1, [1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (logninv ([p(1:2) NaN p(4:5)], 1, 2), [NaN 0 NaN Inf NaN]) -***** assert (logninv ([p, NaN], 1, 1), [NaN 0 e Inf NaN NaN]) -***** assert (logninv (single ([p, NaN]), 1, 1), single ([NaN 0 e Inf NaN NaN])) -***** assert (logninv ([p, NaN], single (1), 1), single ([NaN 0 e Inf NaN NaN])) -***** assert (logninv ([p, NaN], 1, single (1)), single ([NaN 0 e Inf NaN NaN])) -***** error logninv () -***** 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) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/distributions/nakapdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nakapdf.m + 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, 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/distributions/geoinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/geoinv.m -***** shared p - p = [-1 0 0.75 1 2]; -***** assert (geoinv (p, 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (geoinv (p, 0.5), [NaN 0 1 Inf NaN]) -***** assert (geoinv (p, 0.5*[1 -1 NaN 4 1]), [NaN NaN NaN NaN NaN]) -***** assert (geoinv ([p(1:2) NaN p(4:5)], 0.5), [NaN 0 NaN Inf NaN]) -***** assert (geoinv ([p, NaN], 0.5), [NaN 0 1 Inf NaN NaN]) -***** assert (geoinv (single ([p, NaN]), 0.5), single ([NaN 0 1 Inf NaN NaN])) -***** assert (geoinv ([p, NaN], single (0.5)), single ([NaN 0 1 Inf NaN NaN])) -***** error geoinv () -***** error geoinv (1) -***** error geoinv (1,2,3) -***** error geoinv (ones (3), ones (2)) -***** error geoinv (ones (2), ones (3)) -***** error geoinv (i, 2) -***** error geoinv (2, i) -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/distributions/expinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/expinv.m + 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/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/inst/distributions/trnd.m +***** assert (size (trnd (2)), [1, 1]) +***** assert (size (trnd (ones (2,1))), [2, 1]) +***** assert (size (trnd (ones (2,2))), [2, 2]) +***** assert (size (trnd (1, 3)), [3, 3]) +***** assert (size (trnd (1, [4 1])), [4, 1]) +***** assert (size (trnd (1, 4, 1)), [4, 1]) +***** assert (class (trnd (1)), "double") +***** assert (class (trnd (single (1))), "single") +***** assert (class (trnd (single ([1 1]))), "single") +***** error trnd () +***** error trnd (1, -1) +***** error trnd (1, ones (2)) +***** error trnd (i) +***** error trnd (1, [2 -1 2]) +***** error trnd (1, 2, ones (2)) +***** error trnd (1, 2, -1) +***** error trnd (ones (2,2), 3) +***** 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/nctpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctpdf.m +***** error y = nctpdf (); +***** error y = nctpdf (2); +***** error y = nctpdf (2, 4); +***** error y = nctpdf (5, [4, 3], [3, 4, 5]); +***** shared x1, df, delta + x1 = [-Inf, 2, NaN, 4, Inf]; + df = [2, 0, -1, 1, 4]; + delta = [1, NaN, 3, -1, 2]; +***** assert (nctpdf (x1, df, delta), [0, NaN, NaN, 0.00401787561306999, 0], 1e-14); +***** assert (nctpdf (x1, df, 1), [0, NaN, NaN, 0.0482312135423008, 0], 1e-14); +***** assert (nctpdf (x1, df, 3), [0, NaN, NaN, 0.1048493126401585, 0], 1e-14); +***** assert (nctpdf (x1, df, 2), [0, NaN, NaN, 0.08137377919890307, 0], 1e-14); +***** assert (nctpdf (x1, 3, delta), [0, NaN, NaN, 0.001185305171654381, 0], 1e-14); +***** assert (nctpdf (2, df, delta), [0.1791097459405861, NaN, NaN, ... + 0.0146500727180389, 0.3082302682110299], 1e-14); +***** assert (nctpdf (4, df, delta), [0.04467929612254971, NaN, NaN, ... + 0.00401787561306999, 0.0972086534042828], 1e-14); +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/distributions/chi2inv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/chi2inv.m ***** shared p p = [-1 0 0.3934693402873666 1 2]; -***** assert (expinv (p, 2*ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (expinv (p, 2), [NaN 0 1 Inf NaN], eps) -***** assert (expinv (p, 2*[1 0 NaN 1 1]), [NaN NaN NaN Inf NaN], eps) -***** assert (expinv ([p(1:2) NaN p(4:5)], 2), [NaN 0 NaN Inf NaN], eps) -***** assert (expinv ([p, NaN], 2), [NaN 0 1 Inf NaN NaN], eps) -***** assert (expinv (single ([p, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), eps) -***** assert (expinv ([p, 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) +***** assert (chi2inv (p, 2*ones (1,5)), [NaN 0 1 Inf NaN], 5*eps) +***** assert (chi2inv (p, 2), [NaN 0 1 Inf NaN], 5*eps) +***** assert (chi2inv (p, 2*[0 1 NaN 1 1]), [NaN 0 NaN Inf NaN], 5*eps) +***** assert (chi2inv ([p(1:2) NaN p(4:5)], 2), [NaN 0 NaN Inf NaN], 5*eps) +***** assert (chi2inv ([p, NaN], 2), [NaN 0 1 Inf NaN NaN], 5*eps) +***** assert (chi2inv (single ([p, NaN]), 2), single ([NaN 0 1 Inf NaN NaN]), 5*eps ("single")) +***** assert (chi2inv ([p, 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/trirnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/bbsrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/gpcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gpcdf.m -***** shared x, y1, y1u, y2, y2u, y3, y3u - x = [-Inf, -1, 0, 1/2, 1, Inf]; - y1 = [0, 0, 0, 0.3934693402873666, 0.6321205588285577, 1]; - y1u = [1, 1, 1, 0.6065306597126334, 0.3678794411714423, 0]; - y2 = [0, 0, 0, 1/3, 1/2, 1]; - y2u = [1, 1, 1, 2/3, 1/2, 0]; - y3 = [0, 0, 0, 1/2, 1, 1]; - y3u = [1, 1, 1, 1/2, 0, 0]; -***** 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, zeros (1,6), ones (1,6), zeros (1,6), "upper"), y1u, eps) -***** assert (gpcdf (x, 0, 1, zeros (1,6), "upper"), y1u, eps) -***** assert (gpcdf (x, 0, ones (1,6), 0, "upper"), y1u, eps) -***** assert (gpcdf (x, zeros (1,6), 1, 0, "upper"), y1u, eps) -***** assert (gpcdf (x, 0, 1, 0, "upper"), y1u, 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), "upper"), y2u, eps) -***** assert (gpcdf (x, 1, 1, zeros (1,6), "upper"), y2u, eps) -***** assert (gpcdf (x, 1, ones (1,6), 0, "upper"), y2u, eps) -***** assert (gpcdf (x, ones (1,6), 1, 0, "upper"), y2u, eps) -***** assert (gpcdf (x, 1, 1, 0, "upper"), y2u, eps) -***** assert (gpcdf (x, 1, 1, [0, 0, 0, NaN, 0, 0], "upper"), ... - [y2u(1:3), NaN, y2u(5:6)], eps) -***** assert (gpcdf (x, 1, [1, 1, 1, NaN, 1, 1], 0, "upper"), ... - [y2u(1:3), NaN, y2u(5:6)], eps) -***** assert (gpcdf (x, [1, 1, 1, NaN, 1, 1], 1, 0, "upper"), ... - [y2u(1:3), NaN, y2u(5:6)], eps) -***** assert (gpcdf ([x(1:3), NaN, x(5:6)], 1, 1, 0, "upper"), ... - [y2u(1:3), NaN, y2u(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]), [y3(1:3), NaN, y3(5:6)], eps) -***** assert (gpcdf (x, -1, [1, 1, 1, NaN, 1, 1], 0), [y3(1:3), NaN, y3(5:6)], eps) -***** assert (gpcdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0), [y3(1:3), NaN, y3(5:6)], eps) -***** assert (gpcdf ([x(1:3), NaN, x(5:6)], -1, 1, 0), [y3(1:3), NaN, y3(5:6)], eps) -***** assert (gpcdf (x, -ones (1,6), ones (1,6), zeros (1,6), "upper"), y3u, eps) -***** assert (gpcdf (x, -1, 1, zeros (1,6), "upper"), y3u, eps) -***** assert (gpcdf (x, -1, ones (1,6), 0, "upper"), y3u, eps) -***** assert (gpcdf (x, -ones (1,6), 1, 0, "upper"), y3u, eps) -***** assert (gpcdf (x, -1, 1, 0, "upper"), y3u, eps) -***** assert (gpcdf (x, -1, 1, [0, 0, 0, NaN, 0, 0], "upper"), ... - [y3u(1:3), NaN, y3u(5:6)], eps) -***** assert (gpcdf (x, -1, [1, 1, 1, NaN, 1, 1], 0, "upper"), ... - [y3u(1:3), NaN, y3u(5:6)], eps) -***** assert (gpcdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0, "upper"), ... - [y3u(1:3), NaN, y3u(5:6)], eps) -***** assert (gpcdf ([x(1:3), NaN, x(5:6)], -1, 1, 0, "upper"), ... - [y3u(1:3), NaN, y3u(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, 2, 3, 4, 5, 6) -***** 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) -72 tests, 72 passed, 0 known failure, 0 skipped -[inst/distributions/ncx2cdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2cdf.m -***** demo - ## Compare the noncentral chi-square cdf with DELTA = 2 to the - ## chi-square cdf with the same number of degrees of freedom (4): - - x = (0:0.1:10)'; - ncx2 = ncx2cdf (x, 4, 2); - chi2 = chi2cdf (x, 4); - plot(x, ncx2, "b-", "LineWidth", 2); - hold on - plot (x, chi2, "g--", "LineWidth", 2); - legend ("ncx2", "chi2", "Location", "NorthWest"); -***** error p = ncx2cdf (2); -***** error p = ncx2cdf (2, 4); -***** error p = ncx2cdf (2, [4, 3], [3, 4, 5]); -***** error ... - p = ncx2cdf (2, 4, 2, "lower"); -***** test - x = (-2:0.1:2)'; - p = ncx2cdf (x, 10, 1); - assert (p([1:21]), zeros (21, 1), 3e-84); - assert (p(22), 1.521400636466575e-09, 1e-14); - assert (p(30), 6.665480510026046e-05, 1e-14); - assert (p(41), 0.002406447308399836, 1e-14); -***** test - p = ncx2cdf (12, 10, 3); - assert (p, 0.4845555602398649, 1e-14); -***** test - p = ncx2cdf (2, 3, 2); - assert (p, 0.2207330870741212, 1e-14); -***** test - p = ncx2cdf (2, 3, 2, "upper"); - assert (p, 0.7792669129258789, 1e-14); -***** test - p = ncx2cdf ([3, 6], 3, 2, "upper"); - assert (p, [0.6423318186400054, 0.3152299878943012], 1e-14); -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/nbincdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nbincdf.m -***** shared x, y - x = [-1 0 1 2 Inf]; - y = [0 1/2 3/4 7/8 1]; -***** assert (nbincdf (x, ones (1,5), 0.5*ones (1,5)), y) -***** assert (nbincdf (x, 1, 0.5*ones (1,5)), y) -***** assert (nbincdf (x, ones (1,5), 0.5), y) -***** assert (nbincdf (x, ones (1,5), 0.5, "upper"), 1 - y, eps) -***** assert (nbincdf ([x(1:3) 0 x(5)], [0 1 NaN 1.5 Inf], 0.5), ... - [NaN 1/2 NaN nbinpdf(0,1.5,0.5) NaN], eps) -***** assert (nbincdf (x, 1, 0.5*[-1 NaN 4 1 1]), [NaN NaN NaN y(4:5)]) -***** assert (nbincdf ([x(1:2) NaN x(4:5)], 1, 0.5), [y(1:2) NaN y(4:5)]) -***** assert (nbincdf ([x, NaN], 1, 0.5), [y, NaN]) -***** assert (nbincdf (single ([x, NaN]), 1, 0.5), single ([y, NaN])) -***** assert (nbincdf ([x, NaN], single (1), 0.5), single ([y, NaN])) -***** assert (nbincdf ([x, NaN], 1, single (0.5)), single ([y, NaN])) -***** error nbincdf () -***** error nbincdf (1) -***** error nbincdf (1, 2) -***** error nbincdf (1, 2, 3, 4, 5) -***** error nbincdf (1, 2, 3, 4) -***** error nbincdf (1, 2, 3, "some") -***** error nbincdf (ones (3), ones (2), ones (2)) -***** error nbincdf (ones (2), ones (3), ones (2)) -***** error nbincdf (ones (2), ones (2), ones (3)) -***** error nbincdf (i, 2, 2) -***** error nbincdf (2, i, 2) -***** error nbincdf (2, 2, i) -23 tests, 23 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_inv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/laplace_inv.m -***** shared p - p = [-1 0 0.5 1 2]; -***** assert (laplace_inv (p), [NaN -Inf 0 Inf NaN]) -***** assert (laplace_inv (p, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), Inf, NaN]) -***** assert (laplace_inv ([p, NaN]), [NaN -Inf 0 Inf NaN NaN]) -***** assert (laplace_inv (single ([p, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) -***** error laplace_inv () -***** error laplace_inv (1, 2, 3, 4) -***** error ... - laplace_inv (1, ones (2), ones (3)) -***** error ... - laplace_inv (ones (2), 1, ones (3)) -***** error ... - laplace_inv (ones (2), ones (3), 1) -***** error laplace_inv (i, 2, 3) -***** error laplace_inv (1, i, 3) -***** error laplace_inv (1, 2, i) -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/distributions/mvnrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvnrnd.m -***** error mvnrnd () -***** error mvnrnd ([2, 3, 4]) -***** error mvnrnd (ones (2, 2, 2), ones (1, 2, 3, 4)) -***** error mvnrnd (ones (1, 3), ones (1, 2, 3, 4)) -***** assert (size (mvnrnd ([2, 3, 4], [2, 2, 2])), [1, 3]) -***** assert (size (mvnrnd ([2, 3, 4], [2, 2, 2], 10)), [10, 3]) -6 tests, 6 passed, 0 known failure, 0 skipped [inst/distributions/logncdf.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logncdf.m ***** shared x,y @@ -11080,465 +7054,275 @@ ***** error ... [p, plo, pup] =logncdf (1, 2, 3, [1, 0; 0, -inf], 0.04) 24 tests, 24 passed, 0 known failure, 0 skipped -[inst/distributions/geornd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/nakarnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/nbininv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nbininv.m -***** shared p - p = [-1 0 3/4 1 2]; -***** assert (nbininv (p, ones (1,5), 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (nbininv (p, 1, 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (nbininv (p, ones (1,5), 0.5), [NaN 0 1 Inf NaN]) -***** assert (nbininv (p, [1 0 NaN Inf 1], 0.5), [NaN NaN NaN NaN NaN]) -***** assert (nbininv (p, [1 0 1.5 Inf 1], 0.5), [NaN NaN 2 NaN NaN]) -***** assert (nbininv (p, 1, 0.5*[1 -Inf NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (nbininv ([p(1:2) NaN p(4:5)], 1, 0.5), [NaN 0 NaN Inf NaN]) -***** assert (nbininv ([p, NaN], 1, 0.5), [NaN 0 1 Inf NaN NaN]) -***** assert (nbininv (single ([p, NaN]), 1, 0.5), single ([NaN 0 1 Inf NaN NaN])) -***** assert (nbininv ([p, NaN], single (1), 0.5), single ([NaN 0 1 Inf NaN NaN])) -***** assert (nbininv ([p, 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/cauchy_rnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/binopdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/binopdf.m -***** shared x,y - 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, eps) -***** assert (binopdf (x, 2, 0.5*ones (1,5)), y, eps) -***** assert (binopdf (x, 2*ones (1,5), 0.5), y, eps) -***** 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], eps) -***** assert (binopdf (cat(3,x,x), 2, 0.5), cat(3,y,y), eps) -***** assert (binopdf (1, 1, 1), 1) -***** assert (binopdf (0, 3, 0), 1) -***** assert (binopdf (2, 2, 1), 1) -***** assert (binopdf (1, 2, 1), 0) -***** assert (binopdf (0, 1.1, 0), NaN) -***** assert (binopdf (1, 2, -1), NaN) -***** assert (binopdf (1, 2, 1.5), NaN) -***** assert (binopdf (i, 2, 0.5), NaN) ##matlab incompatibility -***** assert (binopdf (1, i, 0.5), NaN) ##matlab incompatibility -***** assert (binopdf (1, 2, i), NaN) ##matlab incompatibility -***** assert (binopdf ([], 1, 1), []) -***** assert (binopdf (1, [], 1), []) -***** assert (binopdf (1, 1, []), []) -***** assert (binopdf (ones (1, 0), 2, .5), ones(1, 0)) -***** assert (binopdf (ones (0, 1), 2, .5), ones(0, 1)) -***** assert (binopdf (ones (0, 1, 2), 2, .5), ones(0, 1, 2)) -***** assert (binopdf (1, ones (0, 1, 2), .5), ones(0, 1, 2)) -***** assert (binopdf (1, 2, ones (0, 1, 2)), ones(0, 1, 2)) -***** assert (binopdf (ones (1, 0, 2), 2, .5), ones(1, 0, 2)) -***** assert (binopdf (ones (1, 2, 0), 2, .5), ones(1, 2, 0)) -***** assert (binopdf (ones (0, 1, 2), NaN, .5), ones(0, 1, 2)) -***** assert (binopdf (ones (0, 1, 2), 2, NaN), ones(0, 1, 2)) -***** 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 (1, ones (2), ones (3)) -***** error binopdf (ones (3), 1, ones (2)) -***** error binopdf (ones (3), ones (2), 1) -***** error binopdf (ones (3), ones (2), ones (2)) -***** error binopdf (ones (2), ones (3), ones (2)) -***** error binopdf (ones (2), ones (2), ones (3)) -42 tests, 42 passed, 0 known failure, 0 skipped -[inst/distributions/betainv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/betainv.m -***** shared p - p = [-1 0 0.75 1 2]; -***** assert (betainv (p, ones (1,5), 2*ones (1,5)), [NaN 0 0.5 1 NaN], eps) -***** assert (betainv (p, 1, 2*ones (1,5)), [NaN 0 0.5 1 NaN], eps) -***** assert (betainv (p, ones (1,5), 2), [NaN 0 0.5 1 NaN], eps) -***** assert (betainv (p, [1 0 NaN 1 1], 2), [NaN NaN NaN 1 NaN]) -***** assert (betainv (p, 1, 2*[1 0 NaN 1 1]), [NaN NaN NaN 1 NaN]) -***** assert (betainv ([p(1:2) NaN p(4:5)], 1, 2), [NaN 0 NaN 1 NaN]) -***** assert (betainv ([p, NaN], 1, 2), [NaN 0 0.5 1 NaN NaN], eps) -***** assert (betainv (single ([p, NaN]), 1, 2), single ([NaN 0 0.5 1 NaN NaN])) -***** assert (betainv ([p, NaN], single (1), 2), single ([NaN 0 0.5 1 NaN NaN]), eps("single")) -***** assert (betainv ([p, NaN], 1, single (2)), single ([NaN 0 0.5 1 NaN NaN]), eps("single")) -***** error betainv () -***** error betainv (1) -***** error betainv (1,2) -***** error betainv (1,2,3,4) -***** error betainv (ones (3), ones (2), ones (2)) -***** error betainv (ones (2), ones (3), ones (2)) -***** error betainv (ones (2), ones (2), ones (3)) -***** error betainv (i, 2, 2) -***** error betainv (2, i, 2) -***** error betainv (2, 2, i) -20 tests, 20 passed, 0 known failure, 0 skipped -[inst/distributions/tripdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/ncx2rnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2rnd.m -***** error ncx2rnd () -***** error ... - ncx2rnd (ones (3), ones (2), []) -***** error ... - ncx2rnd (ones (3), ones (2)) -***** error ... - ncx2rnd (ones (2), ones (2), 3, 2) -***** error ... - ncx2rnd (ones (2), ones (2), 1, 2) -***** assert (size (ncx2rnd (2, 3, 3, 5, 7)), [3, 5, 7]) -***** assert (size (ncx2rnd (2, 3, [3, 5, 7])), [3, 5, 7]) -***** assert (size (ncx2rnd (ones (3, 5), 2 * ones (3, 5), [3, 5])), [3, 5]) -***** assert (size (ncx2rnd (2, 3)), [1, 1]) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/cauchy_pdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/cauchy_pdf.m +[inst/distributions/gprnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/poisscdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/poisscdf.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")) + 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) 1 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/ncx2inv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2inv.m +***** error p = ncx2inv (); +***** error p = ncx2inv (1); +***** error p = ncx2inv (1, 2); +***** error p = ncx2inv (1, [4, 3], [3, 4, 5]); ***** 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/unidcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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*ones (1,5), "upper"), 1 - y) -***** assert (unidcdf (x, 10), y) -***** assert (unidcdf (x, 10, "upper"), 1 - 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 (1, 2, "upper", 4) -***** error unidcdf (ones (3), ones (2)) -***** error unidcdf (ones (2), ones (3)) -***** error unidcdf (i, 2) -***** error unidcdf (2, i) -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/distributions/nakainv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nakainv.m -***** shared p,y - p = [-Inf, -1, 0, 1/2, 1, 2, Inf]; - y = [NaN, NaN, 0, 0.83255461115769769, Inf, NaN, NaN]; -***** assert (nakainv (p, ones (1,7), ones (1,7)), y, eps) -***** assert (nakainv (p, 1, 1), y, eps) -***** assert (nakainv (p, [1, 1, 1, NaN, 1, 1, 1], 1), [y(1:3), NaN, y(5:7)], eps) -***** assert (nakainv (p, 1, [1, 1, 1, NaN, 1, 1, 1]), [y(1:3), NaN, y(5:7)], eps) -***** assert (nakainv ([p, NaN], 1, 1), [y, NaN], eps) -***** assert (nakainv (single ([p, NaN]), 1, 1), single ([y, NaN])) -***** assert (nakainv ([p, NaN], single (1), 1), single ([y, NaN])) -***** assert (nakainv ([p, 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/distributions/wishpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/geocdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/geocdf.m + x = [0,0.3443,0.7226,1.1440,1.6220,2.1770,2.8436,3.6854,4.8447,6.7701,Inf]; + assert (ncx2inv ([0:0.1:1], 2, 1), x, 1e-4); ***** test - p = geocdf ([1, 2, 3, 4], 0.25); - assert (p(1), 0.4375000000, 1e-14); - assert (p(2), 0.5781250000, 1e-14); - assert (p(3), 0.6835937500, 1e-14); - assert (p(4), 0.7626953125, 1e-14); + x = [0,0.8295,1.6001,2.3708,3.1785,4.0598,5.0644,6.2765,7.8763,10.4199,Inf]; + assert (ncx2inv ([0:0.1:1], 2, 3), x, 1e-4); ***** test - p = geocdf ([1, 2, 3, 4], 0.25, "upper"); - assert (p(1), 0.5625000000, 1e-14); - assert (p(2), 0.4218750000, 1e-14); - assert (p(3), 0.3164062500, 1e-14); - assert (p(4), 0.2373046875, 1e-14); -***** shared x, p - x = [-1 0 1 Inf]; - p = [0 0.5 0.75 1]; -***** assert (geocdf (x, 0.5*ones (1,4)), p) -***** assert (geocdf (x, 0.5), p) -***** assert (geocdf (x, 0.5*[-1 NaN 4 1]), [NaN NaN NaN p(4)]) -***** assert (geocdf ([x(1:2) NaN x(4)], 0.5), [p(1:2) NaN p(4)]) -***** assert (geocdf ([x, NaN], 0.5), [p, NaN]) -***** assert (geocdf (single ([x, NaN]), 0.5), single ([p, NaN])) -***** assert (geocdf ([x, NaN], single (0.5)), single ([p, NaN])) -***** error geocdf () -***** error geocdf (1) -***** error ... - geocdf (ones (3), ones (2)) -***** error ... - geocdf (ones (2), ones (3)) -***** error geocdf (i, 2) -***** error geocdf (2, i) -***** error geocdf (2, 3, "tail") -***** error geocdf (2, 3, 5) -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/distributions/bbsinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/bbsinv.m -***** shared p,y,f - f = @(p,a,b,c) (a + b * (c * norminv (p) + sqrt (4 + (c * norminv(p))^2))^2) / 4; - p = [-1, 0, 1/4, 1/2, 1, 2]; - y = [0, 0, f(1/4, 0, 1, 1), 1, Inf, NaN]; -***** assert (bbsinv (p, ones (1,6), ones (1,6), zeros (1,6)), y) -***** assert (bbsinv (p, 1, 1, zeros (1,6)), y) -***** assert (bbsinv (p, 1, ones (1,6), 0), y) -***** assert (bbsinv (p, ones (1,6), 1, 0), y) -***** assert (bbsinv (p, 1, 1, 0), y) -***** assert (bbsinv (p, 1, 1, [0, 0, 0, NaN, 0, 0]), [y(1:3), NaN, y(5:6)]) -***** assert (bbsinv (p, 1, [1, 1, 1, NaN, 1, 1], 0), [y(1:3), NaN, y(5:6)]) -***** assert (bbsinv (p, [1, 1, 1, NaN, 1, 1], 1, 0), [y(1:3), NaN, y(5:6)]) -***** assert (bbsinv ([p, NaN], 1, 1, 0), [y, NaN]) -***** assert (bbsinv (single ([p, NaN]), 1, 1, 0), single ([y, NaN])) -***** assert (bbsinv ([p, NaN], 1, 1, single (0)), single ([y, NaN])) -***** assert (bbsinv ([p, NaN], 1, single (1), 0), single ([y, NaN])) -***** assert (bbsinv ([p, 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/distributions/hygecdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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, 5*eps) -***** assert (hygecdf (x, 4, 2*ones (1,5), 2), y, 5*eps) -***** assert (hygecdf (x, 4, 2, 2*ones (1,5)), y, 5*eps) -***** assert (hygecdf (x, 4*[1 -1 NaN 1.1 1], 2, 2), [y(1) NaN NaN NaN y(5)], 5*eps) -***** assert (hygecdf (x, 4*[1 -1 NaN 1.1 1], 2, 2, "upper"), ... - [y(5) NaN NaN NaN y(1)], 5*eps) -***** assert (hygecdf (x, 4, 2*[1 -1 NaN 1.1 1], 2), [y(1) NaN NaN NaN y(5)], 5*eps) -***** assert (hygecdf (x, 4, 2*[1 -1 NaN 1.1 1], 2, "upper"), ... - [y(5) NaN NaN NaN y(1)], 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)], 5*eps) -***** assert (hygecdf (x, 4, 2, 2*[1 -1 NaN 1.1 1], "upper"), ... - [y(5) NaN NaN NaN y(1)], 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)], 5*eps) + x = [0,0.5417,1.3483,2.1796,3.0516,4.0003,5.0777,6.3726,8.0748,10.7686,Inf]; + assert (ncx2inv ([0:0.1:1], 1, 4), x, 1e-4); ***** test - p = hygecdf (x, 10, [1 2 3 4 5], 2, "upper"); - assert (p, [1, 34/90, 2/30, 0, 0], 10*eps); + x = [0.1808, 0.6456, 1.1842, 1.7650, 2.3760, 3.0105]; + assert (ncx2inv (0.05, [1, 2, 3, 4, 5, 6], 4), x, 1e-4); ***** test - p = hygecdf (2*x, 10, [1 2 3 4 5], 2, "upper"); - assert (p, [1, 34/90, 0, 0, 0], 10*eps); -***** assert (hygecdf ([x, NaN], 4, 2, 2), [y, NaN], 5*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 (1,2,3,4,"uper") -***** 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) -32 tests, 32 passed, 0 known failure, 0 skipped -[inst/distributions/raylpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/raylpdf.m + x = [0.4887, 0.6699, 0.9012, 1.1842, 1.5164, 1.8927]; + assert (ncx2inv (0.05, 3, [1, 2, 3, 4, 5, 6]), x, 1e-4); ***** test - x = 0:0.5:2.5; + x = [1.3941, 1.6824, 2.0103, 2.3760, NaN, 3.2087]; + assert (ncx2inv (0.05, 5, [1, 2, 3, 4, -1, 6]), x, 1e-4); +***** test + assert (ncx2inv (0.996, 5, 8), 35.51298862765576, 2e-13); +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/distributions/ncx2pdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2pdf.m +***** error p = ncx2pdf (2); +***** error p = ncx2pdf (2, 4); +***** error p = ncx2pdf (2, [4, 3], [3, 4, 5]); +***** shared x1, df, d1 + x1 = [-Inf, 2, NaN, 4, Inf]; + df = [2, 0, -1, 1, 4]; + d1 = [1, NaN, 3, -1, 2]; +***** assert (ncx2pdf (x1, df, d1), [0, NaN, NaN, NaN, 0]); +***** assert (ncx2pdf (x1, df, 1), [0, 0.07093996461786045, NaN, ... + 0.06160064323277038, 0], 1e-14); +***** assert (ncx2pdf (x1, df, 3), [0, 0.1208364909271113, NaN, ... + 0.09631299762429098, 0], 1e-14); +***** assert (ncx2pdf (x1, df, 2), [0, 0.1076346446244688, NaN, ... + 0.08430464047296625, 0], 1e-14); +***** assert (ncx2pdf (x1, 2, d1), [0, NaN, NaN, NaN, 0]); +***** assert (ncx2pdf (2, df, d1), [0.1747201674611283, NaN, NaN, ... + NaN, 0.1076346446244688], 1e-14); +***** assert (ncx2pdf (4, df, d1), [0.09355987820265799, NaN, NaN, ... + NaN, 0.1192317192431485], 1e-14); +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/distributions/wblrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/raylinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/raylinv.m +***** test + p = 0:0.1:0.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); + 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 - 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); + 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); ***** 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) -8 tests, 8 passed, 0 known failure, 0 skipped +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/distributions/fcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/fcdf.m +***** shared x,y + x = [-1, 0, 0.5, 1, 2, Inf]; + y = [0, 0, 1/3, 1/2, 2/3, 1]; +***** assert (fcdf (x, 2*ones (1,6), 2*ones (1,6)), y, eps) +***** assert (fcdf (x, 2, 2*ones (1,6)), y, eps) +***** assert (fcdf (x, 2*ones (1,6), 2), y, eps) +***** assert (fcdf (x, [0 NaN Inf 2 2 2], 2), [NaN NaN 0.1353352832366127 y(4:6)], eps) +***** assert (fcdf (x, 2, [0 NaN Inf 2 2 2]), [NaN NaN 0.3934693402873666 y(4:6)], eps) +***** assert (fcdf ([x(1:2) NaN x(4:6)], 2, 2), [y(1:2) NaN y(4:6)], eps) +***** assert (fcdf ([x, NaN], 2, 2), [y, NaN], eps) +***** assert (fcdf (single ([x, NaN]), 2, 2), single ([y, NaN]), eps ("single")) +***** assert (fcdf ([x, NaN], single (2), 2), single ([y, NaN]), eps ("single")) +***** assert (fcdf ([x, NaN], 2, single (2)), single ([y, NaN]), eps ("single")) +***** error fcdf () +***** error fcdf (1) +***** error fcdf (1, 2) +***** error fcdf (1, 2, 3, 4) +***** error fcdf (1, 2, 3, "tail") +***** error fcdf (ones (3), ones (2), ones (2)) +***** error fcdf (ones (2), ones (3), ones (2)) +***** error fcdf (ones (2), ones (2), ones (3)) +***** error fcdf (i, 2, 2) +***** error fcdf (2, i, 2) +***** error fcdf (2, 2, i) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/distributions/ncfpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncfpdf.m +***** error p = ncfpdf (); +***** error p = ncfpdf (2); +***** error p = ncfpdf (2, 4); +***** error p = ncfpdf (2, 4, 3); +***** error p = ncfpdf (5, 2, [4, 3], [3, 4, 5]); +***** shared x1, df1, df2, delta + x1 = [-Inf, 2, NaN, 4, Inf]; + df1 = [2, 0, -1, 1, 4]; + df2 = [2, 4, 5, 6, 8]; + delta = [1, NaN, 3, -1, 2]; +***** assert (ncfpdf (x1, df1, df2, delta), [0, NaN, NaN, NaN, NaN]); +***** assert (ncfpdf (x1, df1, df2, 1), [0, NaN, NaN, ... + 0.05607937264237208, NaN], 1e-14); +***** assert (ncfpdf (x1, df1, df2, 3), [0, NaN, NaN, ... + 0.080125760971946518, NaN], 1e-14); +***** assert (ncfpdf (x1, df1, df2, 2), [0, NaN, NaN, ... + 0.0715902008258656, NaN], 1e-14); +***** assert (ncfpdf (x1, 3, 5, delta), [0, NaN, NaN, NaN, NaN]); +***** assert (ncfpdf (2, df1, df2, delta), [0.1254046999837947, NaN, NaN, ... + NaN, 0.2152571783045893], 1e-14); +***** assert (ncfpdf (4, df1, df2, delta), [0.05067089541001374, NaN, NaN, ... + NaN, 0.05560846335398539], 1e-14); +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/distributions/laplace_inv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/laplace_inv.m +***** shared p + p = [-1 0 0.5 1 2]; +***** assert (laplace_inv (p), [NaN -Inf 0 Inf NaN]) +***** assert (laplace_inv (p, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), Inf, NaN]) +***** assert (laplace_inv ([p, NaN]), [NaN -Inf 0 Inf NaN NaN]) +***** assert (laplace_inv (single ([p, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) +***** error laplace_inv () +***** error laplace_inv (1, 2, 3, 4) +***** error ... + laplace_inv (1, ones (2), ones (3)) +***** error ... + laplace_inv (ones (2), 1, ones (3)) +***** error ... + laplace_inv (ones (2), ones (3), 1) +***** error laplace_inv (i, 2, 3) +***** error laplace_inv (1, i, 3) +***** error laplace_inv (1, 2, i) +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/distributions/exprnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/mnrnd.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mnrnd.m ***** test @@ -11566,97 +7350,250 @@ assert (all (round (r) == r)); assert (all (sum (r, 2) == n)); 3 tests, 3 passed, 0 known failure, 0 skipped -[inst/distributions/copulapdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/copulapdf.m -***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - theta = [1; 2]; - y = copulapdf ("Clayton", x, theta); - expected_p = [0.9872; 0.7295]; - assert (y, expected_p, 0.001); +[inst/distributions/gpinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gpinv.m +***** shared p,y1,y2,y3 + p = [-1, 0, 1/2, 1, 2]; + y1 = [NaN, 0, 0.6931471805599453, Inf, NaN]; + y2 = [NaN, 0, 1, Inf, NaN]; + y3 = [NaN, 0, 1/2, 1, NaN]; +***** assert (gpinv (p, zeros (1,5), ones (1,5), zeros (1,5)), y1) +***** assert (gpinv (p, 0, 1, zeros (1,5)), y1) +***** assert (gpinv (p, 0, ones (1,5), 0), y1) +***** assert (gpinv (p, zeros (1,5), 1, 0), y1) +***** assert (gpinv (p, 0, 1, 0), y1) +***** assert (gpinv (p, 0, 1, [0, 0, NaN, 0, 0]), [y1(1:2), NaN, y1(4:5)]) +***** assert (gpinv (p, 0, [1, 1, NaN, 1, 1], 0), [y1(1:2), NaN, y1(4:5)]) +***** assert (gpinv (p, [0, 0, NaN, 0, 0], 1, 0), [y1(1:2), NaN, y1(4:5)]) +***** assert (gpinv ([p(1:2), NaN, p(4:5)], 0, 1, 0), [y1(1:2), NaN, y1(4:5)]) +***** assert (gpinv (p, ones (1,5), ones (1,5), zeros (1,5)), y2) +***** assert (gpinv (p, 1, 1, zeros (1,5)), y2) +***** assert (gpinv (p, 1, ones (1,5), 0), y2) +***** assert (gpinv (p, ones (1,5), 1, 0), y2) +***** assert (gpinv (p, 1, 1, 0), y2) +***** assert (gpinv (p, 1, 1, [0, 0, NaN, 0, 0]), [y2(1:2), NaN, y2(4:5)]) +***** assert (gpinv (p, 1, [1, 1, NaN, 1, 1], 0), [y2(1:2), NaN, y2(4:5)]) +***** assert (gpinv (p, [1, 1, NaN, 1, 1], 1, 0), [y2(1:2), NaN, y2(4:5)]) +***** assert (gpinv ([p(1:2), NaN, p(4:5)], 1, 1, 0), [y2(1:2), NaN, y2(4:5)]) +***** assert (gpinv (p, -ones (1,5), ones (1,5), zeros (1,5)), y3) +***** assert (gpinv (p, -1, 1, zeros (1,5)), y3) +***** assert (gpinv (p, -1, ones (1,5), 0), y3) +***** assert (gpinv (p, -ones (1,5), 1, 0), y3) +***** assert (gpinv (p, -1, 1, 0), y3) +***** assert (gpinv (p, -1, 1, [0, 0, NaN, 0, 0]), [y3(1:2), NaN, y3(4:5)]) +***** assert (gpinv (p, -1, [1, 1, NaN, 1, 1], 0), [y3(1:2), NaN, y3(4:5)]) +***** assert (gpinv (p, -[1, 1, NaN, 1, 1], 1, 0), [y3(1:2), NaN, y3(4:5)]) +***** assert (gpinv ([p(1:2), NaN, p(4:5)], -1, 1, 0), [y3(1:2), NaN, y3(4:5)]) +***** assert (gpinv (single ([p, NaN]), 0, 1, 0), single ([y1, NaN])) +***** assert (gpinv ([p, NaN], 0, 1, single (0)), single ([y1, NaN])) +***** assert (gpinv ([p, NaN], 0, single (1), 0), single ([y1, NaN])) +***** assert (gpinv ([p, NaN], single (0), 1, 0), single ([y1, NaN])) +***** assert (gpinv (single ([p, NaN]), 1, 1, 0), single ([y2, NaN])) +***** assert (gpinv ([p, NaN], 1, 1, single (0)), single ([y2, NaN])) +***** assert (gpinv ([p, NaN], 1, single (1), 0), single ([y2, NaN])) +***** assert (gpinv ([p, NaN], single (1), 1, 0), single ([y2, NaN])) +***** assert (gpinv (single ([p, NaN]), -1, 1, 0), single ([y3, NaN])) +***** assert (gpinv ([p, NaN], -1, 1, single (0)), single ([y3, NaN])) +***** assert (gpinv ([p, NaN], -1, single (1), 0), single ([y3, NaN])) +***** assert (gpinv ([p, NaN], single (-1), 1, 0), single ([y3, NaN])) +***** error gpinv () +***** error gpinv (1) +***** error gpinv (1,2) +***** error gpinv (1,2,3) +***** error gpinv (1,2,3,4,5) +***** error gpinv (ones (3), ones (2), ones (2), ones (2)) +***** error gpinv (ones (2), ones (3), ones (2), ones (2)) +***** error gpinv (ones (2), ones (2), ones (3), ones (2)) +***** error gpinv (ones (2), ones (2), ones (2), ones (3)) +***** error gpinv (i, 2, 2, 2) +***** error gpinv (2, i, 2, 2) +***** error gpinv (2, 2, i, 2) +***** error gpinv (2, 2, 2, i) +52 tests, 52 passed, 0 known failure, 0 skipped +[inst/distributions/iwishrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/vmpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/vmpdf.m +***** shared theta, p0, p1 + theta = [-pi:pi/2:pi]; + p0 = [0.046245, 0.125708, 0.341710, 0.125708, 0.046245]; + p1 = [0.046245, 0.069817, 0.654958, 0.014082, 0.000039]; +***** assert (vmpdf (theta), p0, 1e-5) +***** assert (vmpdf (theta, zeros (1,5), ones (1,5)), p0, 1e-6) +***** assert (vmpdf (theta, 0, [1 2 3 4 5]), p1, 1e-6) +***** assert (isa (vmpdf (single (pi), 0, 1), "single"), true) +***** assert (isa (vmpdf (pi, single (0), 1), "single"), true) +***** assert (isa (vmpdf (pi, 0, single (1)), "single"), true) +***** error vmcdf () +***** error vmcdf (1, 2, 3, 4) +***** error vmcdf (ones (3), ones (2), ones (2)) +***** error vmcdf (ones (2), ones (3), ones (2)) +***** error vmcdf (ones (2), ones (2), ones (3)) +***** error vmcdf (i, 2, 2) +***** error vmcdf (2, i, 2) +***** error vmcdf (2, 2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/hygepdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/hygepdf.m +***** shared x,y + x = [-1 0 1 2 3]; + y = [0 1/6 4/6 1/6 0]; +***** assert (hygepdf (x, 4*ones (1,5), 2, 2), y, eps) +***** assert (hygepdf (x, 4, 2*ones (1,5), 2), y, eps) +***** assert (hygepdf (x, 4, 2, 2*ones (1,5)), y, eps) +***** assert (hygepdf (x, 4*[1 -1 NaN 1.1 1], 2, 2), [0 NaN NaN NaN 0], eps) +***** assert (hygepdf (x, 4, 2*[1 -1 NaN 1.1 1], 2), [0 NaN NaN NaN 0], eps) +***** assert (hygepdf (x, 4, 5, 2), [NaN NaN NaN NaN NaN], eps) +***** assert (hygepdf (x, 4, 2, 2*[1 -1 NaN 1.1 1]), [0 NaN NaN NaN 0], eps) +***** assert (hygepdf (x, 4, 2, 5), [NaN NaN NaN NaN NaN], eps) +***** assert (hygepdf ([x, NaN], 4, 2, 2), [y, NaN], eps) +***** assert (hygepdf (single ([x, NaN]), 4, 2, 2), single ([y, NaN]), eps("single")) +***** assert (hygepdf ([x, NaN], single (4), 2, 2), single ([y, NaN]), eps("single")) +***** assert (hygepdf ([x, NaN], 4, single (2), 2), single ([y, NaN]), eps("single")) +***** assert (hygepdf ([x, NaN], 4, 2, single (2)), single ([y, NaN]), eps("single")) ***** test - x = [0.2:0.2:0.6; 0.2:0.2:0.6]; - y = copulapdf ("Gumbel", x, 2); - expected_p = [0.9468; 0.9468]; - assert (y, expected_p, 0.001); + z = zeros(3,5); + z([4,5,6,8,9,12]) = [1, 0.5, 1/6, 0.5, 2/3, 1/6]; + assert (hygepdf (x, 4, [0 1 2], 2,"vectorexpand"), z, eps); + assert (hygepdf (x, 4, [0 1 2]', 2,"vectorexpand"), z, eps); + assert (hygepdf (x', 4, [0 1 2], 2,"vectorexpand"), z, eps); + assert (hygepdf (2, 4, [0 1 2], 2,"vectorexpand"), z(:,4), eps); + assert (hygepdf (x, 4, 1, 2,"vectorexpand"), z(2,:), eps); + assert (hygepdf ([NaN,x], 4, [0 1 2]', 2,"vectorexpand"),[NaN(3,1), z], eps); +***** error hygepdf () +***** error hygepdf (1) +***** error hygepdf (1,2) +***** error hygepdf (1,2,3) +***** error hygepdf (1,2,3,4,5,6) +***** error hygepdf (1, ones (3), ones (2), ones (2)) +***** error hygepdf (1, ones (2), ones (3), ones (2)) +***** error hygepdf (1, ones (2), ones (2), ones (3)) +***** error hygepdf (i, 2, 2, 2) +***** error hygepdf (2, i, 2, 2) +***** error hygepdf (2, 2, i, 2) +***** error hygepdf (2, 2, 2, i) +26 tests, 26 passed, 0 known failure, 0 skipped +[inst/distributions/unifrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/burrcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/burrcdf.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) +23 tests, 23 passed, 0 known failure, 0 skipped +[inst/distributions/geornd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/gevpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gevpdf.m ***** test - x = [0.2, 0.6; 0.2, 0.6]; - theta = [1; 2]; - y = copulapdf ("Frank", x, theta); - expected_p = [0.9378; 0.8678]; - assert (y, expected_p, 0.001); + x = 0:0.5:2.5; + sigma = 1:6; + k = 1; + mu = 0; + y = gevpdf (x, k, sigma, mu); + expected_y = [0.367879 0.143785 0.088569 0.063898 0.049953 0.040997]; + assert (y, expected_y, 0.001); ***** test - x = [0.2, 0.6; 0.2, 0.6]; - theta = [0.3; 0.7]; - y = copulapdf ("AMH", x, theta); - expected_p = [0.9540; 0.8577]; - assert (y, expected_p, 0.001); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/distributions/frnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/frnd.m -***** assert (size (frnd (1,2)), [1, 1]) -***** assert (size (frnd (ones (2,1), 2)), [2, 1]) -***** assert (size (frnd (ones (2,2), 2)), [2, 2]) -***** assert (size (frnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (frnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (frnd (1, 2, 3)), [3, 3]) -***** assert (size (frnd (1, 2, [4 1])), [4, 1]) -***** assert (size (frnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (frnd (1, 2)), "double") -***** assert (class (frnd (single (1), 2)), "single") -***** assert (class (frnd (single ([1 1]), 2)), "single") -***** assert (class (frnd (1, single (2))), "single") -***** assert (class (frnd (1, single ([2 2]))), "single") -***** error frnd () -***** error frnd (1) -***** error frnd (ones (3), ones (2)) -***** error frnd (ones (2), ones (3)) -***** error frnd (i, 2) -***** error frnd (2, i) -***** error frnd (1,2, -1) -***** error frnd (1,2, ones (2)) -***** error frnd (1, 2, [2 -1 2]) -***** error frnd (1,2, 1, ones (2)) -***** error frnd (1,2, 1, -1) -***** error frnd (ones (2,2), 2, 3) -***** 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/evpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evpdf.m -***** error evpdf () -***** error ... - evpdf (ones (3), ones (2), ones (2)) -***** error evpdf (i, 2, 2) -***** error evpdf (2, i, 2) -***** error evpdf (2, 2, i) -***** shared x, y0, y1 - x = [-5, 0, 1, 2, 3]; - y0 = [0.0067, 0.3679, 0.1794, 0.0046, 0]; - y1 = [0.0025, 0.2546, 0.3679, 0.1794, 0.0046]; -***** assert (evpdf (x), y0, 1e-4) -***** assert (evpdf (x, zeros (1,5), ones (1,5)), y0, 1e-4) -***** assert (evpdf (x, ones (1,5), ones (1,5)), y1, 1e-4) -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/distributions/poissinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/poissinv.m -***** shared p - p = [-1 0 0.5 1 2]; -***** assert (poissinv (p, ones (1,5)), [NaN 0 1 Inf NaN]) -***** assert (poissinv (p, 1), [NaN 0 1 Inf NaN]) -***** assert (poissinv (p, [1 0 NaN 1 1]), [NaN NaN NaN Inf NaN]) -***** assert (poissinv ([p(1:2) NaN p(4:5)], 1), [NaN 0 NaN Inf NaN]) -***** assert (poissinv ([p, NaN], 1), [NaN 0 1 Inf NaN NaN]) -***** assert (poissinv (single ([p, NaN]), 1), single ([NaN 0 1 Inf NaN NaN])) -***** assert (poissinv ([p, 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 + x = -0.5:0.5:2.5; + sigma = 0.5; + k = 1; + mu = 0; + y = gevpdf (x, k, sigma, mu); + expected_y = [0 0.735759 0.303265 0.159229 0.097350 0.065498 0.047027]; + assert (y, expected_y, 0.001); +***** test #check for continuity for k near 0 + x = 1; + sigma = 0.5; + k = -0.03:0.01:0.03; + mu = 0; + y = gevpdf (x, k, sigma, mu); + 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/distributions/nbinrnd.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nbinrnd.m ***** assert (size (nbinrnd (2, 1/2)), [1, 1]) @@ -11687,267 +7624,296 @@ ***** 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/normpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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,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) +[inst/distributions/copularnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/copularnd.m +***** test + theta = 0.5; + r = copularnd ("Gaussian", theta); + assert (size (r), [1, 2]); + assert (all ((r >= 0) & (r <= 1))); +***** test + theta = 0.5; + df = 2; + r = copularnd ("t", theta, df); + assert (size (r), [1, 2]); + assert (all ((r >= 0) & (r <= 1))); +***** test + theta = 0.5; + r = copularnd ("Clayton", theta); + assert (size (r), [1, 2]); + assert (all ((r >= 0) & (r <= 1))); +***** test + theta = 0.5; + n = 2; + r = copularnd ("Clayton", theta, n); + assert (size (r), [n, 2]); + assert (all ((r >= 0) & (r <= 1))); +***** test + theta = [1; 2]; + n = 2; + d = 3; + r = copularnd ("Clayton", theta, n, d); + assert (size (r), [n, d]); + assert (all ((r >= 0) & (r <= 1))); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/distributions/geocdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/geocdf.m +***** test + p = geocdf ([1, 2, 3, 4], 0.25); + assert (p(1), 0.4375000000, 1e-14); + assert (p(2), 0.5781250000, 1e-14); + assert (p(3), 0.6835937500, 1e-14); + assert (p(4), 0.7626953125, 1e-14); +***** test + p = geocdf ([1, 2, 3, 4], 0.25, "upper"); + assert (p(1), 0.5625000000, 1e-14); + assert (p(2), 0.4218750000, 1e-14); + assert (p(3), 0.3164062500, 1e-14); + assert (p(4), 0.2373046875, 1e-14); +***** shared x, p + x = [-1 0 1 Inf]; + p = [0 0.5 0.75 1]; +***** assert (geocdf (x, 0.5*ones (1,4)), p) +***** assert (geocdf (x, 0.5), p) +***** assert (geocdf (x, 0.5*[-1 NaN 4 1]), [NaN NaN NaN p(4)]) +***** assert (geocdf ([x(1:2) NaN x(4)], 0.5), [p(1:2) NaN p(4)]) +***** assert (geocdf ([x, NaN], 0.5), [p, NaN]) +***** assert (geocdf (single ([x, NaN]), 0.5), single ([p, NaN])) +***** assert (geocdf ([x, NaN], single (0.5)), single ([p, NaN])) +***** error geocdf () +***** error geocdf (1) +***** error ... + geocdf (ones (3), ones (2)) +***** error ... + geocdf (ones (2), ones (3)) +***** error geocdf (i, 2) +***** error geocdf (2, i) +***** error geocdf (2, 3, "tail") +***** error geocdf (2, 3, 5) 17 tests, 17 passed, 0 known failure, 0 skipped -[inst/distributions/evinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evinv.m -***** error evinv () -***** error evinv (1,2,3,4,5,6) -***** error ... - evinv (ones (3), ones (2), ones (2)) -***** error ... - [p, plo, pup] = evinv (2, 3, 4, [1, 2]) -***** error ... - [p, plo, pup] = evinv (1, 2, 3) -***** error [p, plo, pup] = ... - evinv (1, 2, 3, [1, 0; 0, 1], 0) -***** error [p, plo, pup] = ... - evinv (1, 2, 3, [1, 0; 0, 1], 1.22) -***** error evinv (i, 2, 2) -***** error evinv (2, i, 2) -***** error evinv (2, 2, i) -***** error ... - [p, plo, pup] = evinv (1, 2, 3, [-1, -10; -Inf, -Inf], 0.04) -***** shared p, x - p = [0, 0.05, 0.5 0.95]; - x = [-Inf, -2.9702, -0.3665, 1.0972]; -***** assert (evinv (p), x, 1e-4) -***** assert (evinv (p, zeros (1,4), ones (1,4)), x, 1e-4) -***** assert (evinv (p, 0, ones (1,4)), x, 1e-4) -***** assert (evinv (p, zeros (1,4), 1), x, 1e-4) -***** assert (evinv (p, [0, -Inf, NaN, Inf], 1), [-Inf, -Inf, NaN, Inf], 1e-4) -***** assert (evinv (p, 0, [Inf, NaN, -1, 0]), [-Inf, NaN, NaN, NaN], 1e-4) -***** assert (evinv ([p(1:2), NaN, p(4)], 0, 1), [x(1:2), NaN, x(4)], 1e-4) -***** assert (evinv ([p, NaN], 0, 1), [x, NaN], 1e-4) -***** assert (evinv (single ([p, NaN]), 0, 1), single ([x, NaN]), 1e-4) -***** assert (evinv ([p, NaN], single (0), 1), single ([x, NaN]), 1e-4) -***** assert (evinv ([p, NaN], 0, single (1)), single ([x, NaN]), 1e-4) -22 tests, 22 passed, 0 known failure, 0 skipped -[inst/distributions/norminv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/norminv.m +[inst/distributions/tinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/tinv.m ***** shared p p = [-1 0 0.5 1 2]; -***** assert (norminv (p, ones (1,5), ones (1,5)), [NaN -Inf 1 Inf NaN]) -***** assert (norminv (p, 1, ones (1,5)), [NaN -Inf 1 Inf NaN]) -***** assert (norminv (p, ones (1,5), 1), [NaN -Inf 1 Inf NaN]) -***** assert (norminv (p, [1 -Inf NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) -***** assert (norminv (p, 1, [1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (norminv ([p(1:2) NaN p(4:5)], 1, 1), [NaN -Inf NaN Inf NaN]) -***** assert (norminv ([p, NaN], 1, 1), [NaN -Inf 1 Inf NaN NaN]) -***** assert (norminv (single ([p, NaN]), 1, 1), single ([NaN -Inf 1 Inf NaN NaN])) -***** assert (norminv ([p, NaN], single (1), 1), single ([NaN -Inf 1 Inf NaN NaN])) -***** assert (norminv ([p, NaN], 1, single (1)), single ([NaN -Inf 1 Inf NaN NaN])) -***** error norminv () -***** error norminv (1,2,3,4) -***** error norminv (ones (3), ones (2), ones (2)) -***** error norminv (ones (2), ones (3), ones (2)) -***** error norminv (ones (2), ones (2), ones (3)) -***** error norminv (i, 2, 2) -***** error norminv (2, i, 2) -***** error norminv (2, 2, i) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/distributions/ncfpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncfpdf.m -***** error p = ncfpdf (); -***** error p = ncfpdf (2); -***** error p = ncfpdf (2, 4); -***** error p = ncfpdf (2, 4, 3); -***** error p = ncfpdf (5, 2, [4, 3], [3, 4, 5]); -***** shared x1, df1, df2, delta - x1 = [-Inf, 2, NaN, 4, Inf]; - df1 = [2, 0, -1, 1, 4]; - df2 = [2, 4, 5, 6, 8]; - delta = [1, NaN, 3, -1, 2]; -***** assert (ncfpdf (x1, df1, df2, delta), [0, NaN, NaN, NaN, NaN]); -***** assert (ncfpdf (x1, df1, df2, 1), [0, NaN, NaN, ... - 0.05607937264237208, NaN], 1e-14); -***** assert (ncfpdf (x1, df1, df2, 3), [0, NaN, NaN, ... - 0.080125760971946518, NaN], 1e-14); -***** assert (ncfpdf (x1, df1, df2, 2), [0, NaN, NaN, ... - 0.0715902008258656, NaN], 1e-14); -***** assert (ncfpdf (x1, 3, 5, delta), [0, NaN, NaN, NaN, NaN]); -***** assert (ncfpdf (2, df1, df2, delta), [0.1254046999837947, NaN, NaN, ... - NaN, 0.2152571783045893], 1e-14); -***** assert (ncfpdf (4, df1, df2, delta), [0.05067089541001374, NaN, NaN, ... - NaN, 0.05560846335398539], 1e-14); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/distributions/bvncdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/bvncdf.m -***** demo - mu = [1, -1]; - sigma = [0.9, 0.4; 0.4, 0.3]; - [X1, X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); - x = [X1(:), X2(:)]; - p = bvncdf (x, mu, sigma); - Z = reshape (p, 25, 25); - surf (X1, X2, Z); - title ("Bivariate Normal Distribution"); - ylabel "X1" - xlabel "X2" -***** test - mu = [1, -1]; - sigma = [0.9, 0.4; 0.4, 0.3]; - [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); - x = [X1(:), X2(:)]; - p = bvncdf (x, mu, sigma); - p_out = [0.00011878988774500, 0.00034404112322371, ... - 0.00087682502191813, 0.00195221905058185, ... - 0.00378235566873474, 0.00638175749734415, ... - 0.00943764224329656, 0.01239164888125426, ... - 0.01472750274376648, 0.01623228313374828]'; - assert (p([1:10]), p_out, 1e-16); -***** test - mu = [1, -1]; - sigma = [0.9, 0.4; 0.4, 0.3]; - [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); - x = [X1(:), X2(:)]; - p = bvncdf (x, mu, sigma); - p_out = [0.8180695783608276, 0.8854485749482751, ... - 0.9308108777385832, 0.9579855743025508, ... - 0.9722897881414742, 0.9788150170059926, ... - 0.9813597788804785, 0.9821977956568989, ... - 0.9824283794464095, 0.9824809345614861]'; - assert (p([616:625]), p_out, 2e-16); -***** error bvncdf (randn (25,3), [], [1, 1; 1, 1]); -***** error bvncdf (randn (25,2), [], [1, 1; 1, 1]); -***** error bvncdf (randn (25,2), [], ones (3, 2)); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/distributions/tricdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/burrpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/burrpdf.m +***** assert (tinv (p, ones (1,5)), [NaN -Inf 0 Inf NaN]) +***** assert (tinv (p, 1), [NaN -Inf 0 Inf NaN], eps) +***** assert (tinv (p, [1 0 NaN 1 1]), [NaN NaN NaN Inf NaN], eps) +***** assert (tinv ([p(1:2) NaN p(4:5)], 1), [NaN -Inf NaN Inf NaN]) +***** assert (tinv ([p, NaN], 1), [NaN -Inf 0 Inf NaN NaN], eps) +***** assert (tinv (single ([p, NaN]), 1), single ([NaN -Inf 0 Inf NaN NaN]), eps ("single")) +***** assert (tinv ([p, NaN], single (1)), single ([NaN -Inf 0 Inf NaN NaN]), eps ("single")) +***** error tinv () +***** error tinv (1) +***** error tinv (1,2,3) +***** error tinv (ones (3), ones (2)) +***** error tinv (ones (2), ones (3)) +***** error tinv (i, 2) +***** error tinv (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/logistic_rnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logistic_rnd.m +***** assert (size (logistic_rnd (1, 1, 1)), [1, 1]) +***** assert (size (logistic_rnd (1, 1, 2)), [2, 2]) +***** assert (size (logistic_rnd (1, 1, [2, 1])), [2, 1]) +***** assert (size (logistic_rnd (1, zeros (2, 2))), [2, 2]) +***** assert (size (logistic_rnd (1, ones (2, 1))), [2, 1]) +***** assert (size (logistic_rnd (1, ones (2, 2))), [2, 2]) +***** assert (size (logistic_rnd (ones (2, 1), 1)), [2, 1]) +***** assert (size (logistic_rnd (ones (2, 2), 1)), [2, 2]) +***** assert (size (logistic_rnd (1, 1, 3)), [3, 3]) +***** assert (size (logistic_rnd (1, 1, [4 1])), [4, 1]) +***** assert (size (logistic_rnd (1, 1, 4, 1)), [4, 1]) +***** test + r = logistic_rnd (1, [1, 0, -1]); + assert (r([2:3]), [NaN, NaN]) +***** assert (class (logistic_rnd (1, 0)), "double") +***** assert (class (logistic_rnd (1, single (0))), "single") +***** assert (class (logistic_rnd (1, single ([0 0]))), "single") +***** assert (class (logistic_rnd (1, single (1))), "single") +***** assert (class (logistic_rnd (1, single ([1 1]))), "single") +***** assert (class (logistic_rnd (single (1), 1)), "single") +***** assert (class (logistic_rnd (single ([1 1]), 1)), "single") +***** error logistic_rnd () +***** error logistic_rnd (1) +***** error ... + logistic_rnd (ones (3), ones (2)) +***** error ... + logistic_rnd (ones (2), ones (3)) +***** error logistic_rnd (i, 2) +***** error logistic_rnd (1, i) +***** error ... + logistic_rnd (0, 1, [3, -1]) +***** error ... + logistic_rnd (0, 1, -1) +***** error ... + logistic_rnd (0, 1, 3, -1) +***** error ... + logistic_rnd (2, ones (2), 3) +***** error ... + logistic_rnd (2, ones (2), [3, 2]) +***** error ... + logistic_rnd (2, ones (2), 3, 2) +31 tests, 31 passed, 0 known failure, 0 skipped +[inst/distributions/geoinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/geoinv.m +***** shared p + p = [-1 0 0.75 1 2]; +***** assert (geoinv (p, 0.5*ones (1,5)), [NaN 0 1 Inf NaN]) +***** assert (geoinv (p, 0.5), [NaN 0 1 Inf NaN]) +***** assert (geoinv (p, 0.5*[1 -1 NaN 4 1]), [NaN NaN NaN NaN NaN]) +***** assert (geoinv ([p(1:2) NaN p(4:5)], 0.5), [NaN 0 NaN Inf NaN]) +***** assert (geoinv ([p, NaN], 0.5), [NaN 0 1 Inf NaN NaN]) +***** assert (geoinv (single ([p, NaN]), 0.5), single ([NaN 0 1 Inf NaN NaN])) +***** assert (geoinv ([p, NaN], single (0.5)), single ([NaN 0 1 Inf NaN NaN])) +***** error geoinv () +***** error geoinv (1) +***** error geoinv (1,2,3) +***** error geoinv (ones (3), ones (2)) +***** error geoinv (ones (2), ones (3)) +***** error geoinv (i, 2) +***** error geoinv (2, i) +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/distributions/burrrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/burrrnd.m +***** assert (size (burrrnd (1, 1, 1)), [1 1]) +***** assert (size (burrrnd (ones (2,1), 1, 1)), [2, 1]) +***** assert (size (burrrnd (ones (2,2), 1, 1)), [2, 2]) +***** assert (size (burrrnd (1, ones (2,1), 1)), [2, 1]) +***** assert (size (burrrnd (1, ones (2,2), 1)), [2, 2]) +***** assert (size (burrrnd (1, 1, ones (2,1))), [2, 1]) +***** assert (size (burrrnd (1, 1, ones (2,2))), [2, 2]) +***** assert (size (burrrnd (1, 1, 1, 3)), [3, 3]) +***** assert (size (burrrnd (1, 1, 1, [4 1])), [4, 1]) +***** assert (size (burrrnd (1, 1, 1, 4, 1)), [4, 1]) +***** assert (class (burrrnd (1,1,1)), "double") +***** assert (class (burrrnd (single (1),1,1)), "single") +***** assert (class (burrrnd (single ([1 1]),1,1)), "single") +***** assert (class (burrrnd (1,single (1),1)), "single") +***** assert (class (burrrnd (1,single ([1 1]),1)), "single") +***** assert (class (burrrnd (1,1,single (1))), "single") +***** assert (class (burrrnd (1,1,single ([1 1]))), "single") +***** error burrrnd () +***** error burrrnd (1) +***** error burrrnd (1,2) +***** error burrrnd (ones (3), ones (2), ones (2), 2) +***** error burrrnd (ones (2), ones (3), ones (2), 2) +***** error burrrnd (ones (2), ones (2), ones (3), 2) +***** error burrrnd (i, 2, 2) +***** error burrrnd (2, i, 2) +***** error burrrnd (2, 2, i) +***** error burrrnd (4,2,2, -1) +***** error burrrnd (4,2,2, ones (2)) +***** error burrrnd (4,2,2, [2 -1 2]) +***** error burrrnd (4*ones (2),2,2, 3) +***** 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/distributions/nakapdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nakapdf.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/distributions/bbspdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/bbspdf.m + 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/distributions/chi2rnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/gamrnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gamrnd.m +***** assert (size (gamrnd (1,2)), [1, 1]) +***** assert (size (gamrnd (ones (2,1), 2)), [2, 1]) +***** assert (size (gamrnd (ones (2,2), 2)), [2, 2]) +***** assert (size (gamrnd (1, 2*ones (2,1))), [2, 1]) +***** assert (size (gamrnd (1, 2*ones (2,2))), [2, 2]) +***** assert (size (gamrnd (1, 2, 3)), [3, 3]) +***** assert (size (gamrnd (1, 2, [4 1])), [4, 1]) +***** assert (size (gamrnd (1, 2, 4, 1)), [4, 1]) +***** assert (class (gamrnd (1, 2)), "double") +***** assert (class (gamrnd (single (1), 2)), "single") +***** assert (class (gamrnd (single ([1 1]), 2)), "single") +***** assert (class (gamrnd (1, single (2))), "single") +***** assert (class (gamrnd (1, single ([2 2]))), "single") +***** error gamrnd () +***** error gamrnd (1) +***** error gamrnd (ones (3), ones (2)) +***** error gamrnd (ones (2), ones (3)) +***** error gamrnd (i, 2) +***** error gamrnd (2, i) +***** error gamrnd (1,2, -1) +***** error gamrnd (1,2, ones (2)) +***** error gamrnd (1, 2, [2 -1 2]) +***** error gamrnd (1,2, 1, ones (2)) +***** error gamrnd (1,2, 1, -1) +***** error gamrnd (ones (2,2), 2, 3) +***** 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/betapdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/betapdf.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/nctrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctrnd.m -***** error nctrnd () -***** error nctrnd (1) -***** error ... - nctrnd (ones (3), ones (2), []) -***** error ... - nctrnd (ones (2), ones (3)) -***** error ... - nctrnd (ones (2), ones (2), 3, 2) -***** error ... - nctrnd (ones (2), ones (2), 1, 2) -***** assert (size (nctrnd (5, 2, 3, 5, 7)), [3, 5, 7]) -***** assert (size (nctrnd (5, 2, [3, 5, 7])), [3, 5, 7]) -***** assert (size (nctrnd (5, 2 * ones (3, 5), [3, 5])), [3, 5]) -***** assert (size (nctrnd (2, 5)), [1, 1]) -10 tests, 10 passed, 0 known failure, 0 skipped + 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 [inst/distributions/stdnormal_rnd.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/stdnormal_rnd.m ***** assert (size (stdnormal_rnd (3)), [3, 3]) @@ -11960,42 +7926,296 @@ ***** error stdnormal_rnd (1, ones (2)) ***** error stdnormal_rnd (1, -1) 9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/tpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/tpdf.m +[inst/distributions/ncfinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncfinv.m +***** error p = ncfinv (); +***** error p = ncfinv (1); +***** error p = ncfinv (1, 2); +***** error p = ncfinv (1, 2, 3); +***** error p = ncfinv (1, [4, 3], [3, 4, 5], 3); ***** test - x = rand (10,1); - y = 1./(pi * (1 + x.^2)); - assert (tpdf (x, 1), y, 5*eps); + x = [0,0.1775,0.3864,0.6395,0.9564,1.3712,1.9471,2.8215,4.3679,8.1865,Inf]; + assert (ncfinv ([0:0.1:1], 2, 3, 1), x, 1e-4); +***** test + x = [0,0.7492,1.3539,2.0025,2.7658,3.7278,5.0324,6.9826,10.3955,18.7665,Inf]; + assert (ncfinv ([0:0.1:1], 2, 3, 5), x, 1e-4); +***** test + x = [0,0.2890,0.8632,1.5653,2.4088,3.4594,4.8442,6.8286,10.0983,17.3736,Inf]; + assert (ncfinv ([0:0.1:1], 1, 4, 3), x, 1e-4); +***** test + x = [0.078410, 0.212716, 0.288618, 0.335752, 0.367963, 0.391460]; + assert (ncfinv (0.05, [1, 2, 3, 4, 5, 6], 10, 3), x, 1e-6); +***** test + x = [0.2574, 0.2966, 0.3188, 0.3331, 0.3432, 0.3507]; + assert (ncfinv (0.05, 5, [1, 2, 3, 4, 5, 6], 3), x, 1e-4); +***** test + x = [1.6090, 1.8113, 1.9215, 1.9911, NaN, 2.0742]; + assert (ncfinv (0.05, 1, [1, 2, 3, 4, -1, 6], 10), x, 1e-4); +***** test + assert (ncfinv (0.996, 3, 5, 8), 58.0912074080671, 2e-13); +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/distributions/normcdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/normcdf.m +***** error normcdf () +***** error normcdf (1,2,3,4,5,6,7) +***** error normcdf (1, 2, 3, 4, "uper") +***** error ... + normcdf (ones (3), ones (2), ones (2)) +***** error normcdf (2, 3, 4, [1, 2]) +***** error ... + [p, plo, pup] = normcdf (1, 2, 3) +***** error [p, plo, pup] = ... + normcdf (1, 2, 3, [1, 0; 0, 1], 0) +***** error [p, plo, pup] = ... + normcdf (1, 2, 3, [1, 0; 0, 1], 1.22) +***** error [p, plo, pup] = ... + normcdf (1, 2, 3, [1, 0; 0, 1], "alpha", "upper") +***** error normcdf (i, 2, 2) +***** error normcdf (2, i, 2) +***** error normcdf (2, 2, i) +***** error ... + [p, plo, pup] =normcdf (1, 2, 3, [1, 0; 0, -inf], 0.04) ***** 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/mnpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mnpdf.m + 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), [0, 1, NaN, NaN]) +***** assert (normcdf (x, 1, [Inf, NaN, -1, 0]), [NaN, NaN, NaN, 1]) +***** assert (normcdf ([x(1:2), NaN, x(4)], 1, 1), [y(1:2), NaN, y(4)]) +***** assert (normcdf (x, "upper"), [1, 0.1587, 0.0228, 0], 1e-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")) +24 tests, 24 passed, 0 known failure, 0 skipped +[inst/distributions/lognpdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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,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) +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/distributions/nakarnd.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/mvncdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/mvncdf.m +***** demo + mu = [1, -1]; + Sigma = [0.9, 0.4; 0.4, 0.3]; + [X1, X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); + X = [X1(:), X2(:)]; + p = mvncdf (X, mu, Sigma); + Z = reshape (p, 25, 25); + surf (X1, X2, Z); + title ("Bivariate Normal Distribution"); + ylabel "X1" + xlabel "X2" +***** demo + mu = [0, 0]; + Sigma = [0.25, 0.3; 0.3, 1]; + p = mvncdf ([0 0], [1 1], mu, Sigma); + x1 = -3:.2:3; + x2 = -3:.2:3; + [X1, X2] = meshgrid (x1, x2); + X = [X1(:), X2(:)]; + y = mvnpdf (X, mu, Sigma); + y = reshape (y, length (x2), length (x1)); + contour (x1, x2, y, [0.0001, 0.001, 0.01, 0.05, 0.15, 0.25, 0.35]); + xlabel ("x"); + ylabel ("y"); + title ("Probability over Rectangular Region"); + line ([0, 0, 1, 1, 0], [1, 0, 0, 1, 1], "Linestyle", "--", "Color", "k"); ***** test - x = [1, 4, 2]; - pk = [0.2, 0.5, 0.3]; - y = mnpdf (x, pk); - assert (y, 0.11812, 0.001); + fD = (-2:2)'; + X = repmat (fD, 1, 4); + p = mvncdf (X); + assert (p, [0; 0.0006; 0.0625; 0.5011; 0.9121], ones (5, 1) * 1e-4); ***** test - x = [1, 4, 2; 1, 0, 9]; - pk = [0.2, 0.5, 0.3; 0.1, 0.1, 0.8]; - y = mnpdf (x, pk); - assert (y, [0.11812; 0.13422], 0.001); -2 tests, 2 passed, 0 known failure, 0 skipped + mu = [1, -1]; + Sigma = [0.9, 0.4; 0.4, 0.3]; + [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); + X = [X1(:), X2(:)]; + p = mvncdf (X, mu, Sigma); + p_out = [0.00011878988774500, 0.00034404112322371, ... + 0.00087682502191813, 0.00195221905058185, ... + 0.00378235566873474, 0.00638175749734415, ... + 0.00943764224329656, 0.01239164888125426, ... + 0.01472750274376648, 0.01623228313374828]'; + assert (p([1:10]), p_out, 1e-16); +***** test + mu = [1, -1]; + Sigma = [0.9, 0.4; 0.4, 0.3]; + [X1,X2] = meshgrid (linspace (-1, 3, 25)', linspace (-3, 1, 25)'); + X = [X1(:), X2(:)]; + p = mvncdf (X, mu, Sigma); + p_out = [0.8180695783608276, 0.8854485749482751, ... + 0.9308108777385832, 0.9579855743025508, ... + 0.9722897881414742, 0.9788150170059926, ... + 0.9813597788804785, 0.9821977956568989, ... + 0.9824283794464095, 0.9824809345614861]'; + assert (p([616:625]), p_out, 2e-16); +***** test + mu = [0, 0]; + Sigma = [0.25, 0.3; 0.3, 1]; + [p, err] = mvncdf ([0 0], [1 1], mu, Sigma); + assert (p, 0.2097424404755626, 1e-16); + assert (err, 1e-08); +***** test + x = [1 2]; + mu = [0.5 1.5]; + sigma = [1.0 0.5; 0.5 1.0]; + p = mvncdf (x, mu, sigma); + assert (p, 0.546244443857090, 1e-15); +***** test + x = [1 2]; + mu = [0.5 1.5]; + sigma = [1.0 0.5; 0.5 1.0]; + a = [-inf 0]; + p = mvncdf (a, x, mu, sigma); + assert (p, 0.482672935215631, 1e-15); +***** error p = mvncdf (randn (25,26), [], eye (26)); +***** error p = mvncdf (randn (25,8), [], eye (9)); +***** error p = mvncdf (randn (25,4), randn (25,5), [], eye (4)); +***** error p = mvncdf (randn (25,4), randn (25,4), [2, 3; 2, 3], eye (4)); +***** error p = mvncdf (randn (25,4), randn (25,4), ones (1, 5), eye (4)); +***** error p = mvncdf ([-inf 0], [1, 2], [0.5 1.5], [1.0 0.5; 0.5 1.0], option); +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/distributions/gppdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gppdf.m +***** shared x,y1,y2,y3 + x = [-Inf, -1, 0, 1/2, 1, Inf]; + y1 = [0, 0, 1, 0.6065306597126334, 0.36787944117144233, 0]; + y2 = [0, 0, 1, 4/9, 1/4, 0]; + y3 = [0, 0, 1, 1, 1, 0]; +***** assert (gppdf (x, zeros (1,6), ones (1,6), zeros (1,6)), y1, eps) +***** assert (gppdf (x, 0, 1, zeros (1,6)), y1, eps) +***** assert (gppdf (x, 0, ones (1,6), 0), y1, eps) +***** assert (gppdf (x, zeros (1,6), 1, 0), y1, eps) +***** assert (gppdf (x, 0, 1, 0), y1, eps) +***** assert (gppdf (x, 0, 1, [0, 0, 0, NaN, 0, 0]), [y1(1:3), NaN, y1(5:6)]) +***** assert (gppdf (x, 0, [1, 1, 1, NaN, 1, 1], 0), [y1(1:3), NaN, y1(5:6)]) +***** assert (gppdf (x, [0, 0, 0, NaN, 0, 0], 1, 0), [y1(1:3), NaN, y1(5:6)]) +***** assert (gppdf ([x(1:3), NaN, x(5:6)], 0, 1, 0), [y1(1:3), NaN, y1(5:6)]) +***** assert (gppdf (x, ones (1,6), ones (1,6), zeros (1,6)), y2, eps) +***** assert (gppdf (x, 1, 1, zeros (1,6)), y2, eps) +***** assert (gppdf (x, 1, ones (1,6), 0), y2, eps) +***** assert (gppdf (x, ones (1,6), 1, 0), y2, eps) +***** assert (gppdf (x, 1, 1, 0), y2, eps) +***** assert (gppdf (x, 1, 1, [0, 0, 0, NaN, 0, 0]), [y2(1:3), NaN, y2(5:6)]) +***** assert (gppdf (x, 1, [1, 1, 1, NaN, 1, 1], 0), [y2(1:3), NaN, y2(5:6)]) +***** assert (gppdf (x, [1, 1, 1, NaN, 1, 1], 1, 0), [y2(1:3), NaN, y2(5:6)]) +***** assert (gppdf ([x(1:3), NaN, x(5:6)], 1, 1, 0), [y2(1:3), NaN, y2(5:6)]) +***** assert (gppdf (x, -ones (1,6), ones (1,6), zeros (1,6)), y3, eps) +***** assert (gppdf (x, -1, 1, zeros (1,6)), y3, eps) +***** assert (gppdf (x, -1, ones (1,6), 0), y3, eps) +***** assert (gppdf (x, -ones (1,6), 1, 0), y3, eps) +***** assert (gppdf (x, -1, 1, 0), y3, eps) +***** assert (gppdf (x, -1, 1, [0, 0, 0, NaN, 0, 0]), [y3(1:3), NaN, y3(5:6)]) +***** assert (gppdf (x, -1, [1, 1, 1, NaN, 1, 1], 0), [y3(1:3), NaN, y3(5:6)]) +***** assert (gppdf (x, [-1, -1, -1, NaN, -1, -1], 1, 0), [y3(1:3), NaN, y3(5:6)]) +***** assert (gppdf ([x(1:3), NaN, x(5:6)], -1, 1, 0), [y3(1:3), NaN, y3(5:6)]) +***** assert (gppdf (single ([x, NaN]), 0, 1, 0), single ([y1, NaN])) +***** assert (gppdf ([x, NaN], 0, 1, single (0)), single ([y1, NaN])) +***** assert (gppdf ([x, NaN], 0, single (1), 0), single ([y1, NaN])) +***** assert (gppdf ([x, NaN], single (0), 1, 0), single ([y1, NaN])) +***** assert (gppdf (single ([x, NaN]), 1, 1, 0), single ([y2, NaN])) +***** assert (gppdf ([x, NaN], 1, 1, single (0)), single ([y2, NaN])) +***** assert (gppdf ([x, NaN], 1, single (1), 0), single ([y2, NaN])) +***** assert (gppdf ([x, NaN], single (1), 1, 0), single ([y2, NaN])) +***** assert (gppdf (single ([x, NaN]), -1, 1, 0), single ([y3, NaN])) +***** assert (gppdf ([x, NaN], -1, 1, single (0)), single ([y3, NaN])) +***** assert (gppdf ([x, NaN], -1, single (1), 0), single ([y3, NaN])) +***** assert (gppdf ([x, NaN], single (-1), 1, 0), single ([y3, NaN])) +***** error gppdf () +***** error gppdf (1) +***** error gppdf (1,2) +***** error gppdf (1,2,3) +***** error gppdf (1,2,3,4,5) +***** error gppdf (1, ones (2), ones (2), ones (3)) +***** error gppdf (1, ones (2), ones (3), ones (2)) +***** error gppdf (1, ones (3), ones (2), ones (2)) +***** error gppdf (i, 2, 2, 2) +***** error gppdf (2, i, 2, 2) +***** error gppdf (2, 2, i, 2) +***** error gppdf (2, 2, 2, i) +51 tests, 51 passed, 0 known failure, 0 skipped +[inst/distributions/triinv.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/triinv.m +***** shared p,y + p = [-1, 0, 0.02, 0.5, 0.98, 1, 2]; + y = [NaN, 0, 0.1, 0.5, 0.9, 1, NaN] + 1; +***** assert (triinv (p, ones (1,7), 2*ones (1,7), 1.5*ones (1,7)), y, eps) +***** assert (triinv (p, 1*ones (1,7), 2, 1.5), y, eps) +***** assert (triinv (p, 1, 2*ones (1,7), 1.5), y, eps) +***** assert (triinv (p, 1, 2, 1.5*ones (1,7)), y, eps) +***** assert (triinv (p, 1, 2, 1.5), y, eps) +***** assert (triinv (p, [1, 1, NaN, 1, 1, 1, 1], 2, 1.5), [y(1:2), NaN, y(4:7)], eps) +***** assert (triinv (p, 1, 2*[1, 1, NaN, 1, 1, 1, 1], 1.5), [y(1:2), NaN, y(4:7)], eps) +***** assert (triinv (p, 1, 2, 1.5*[1, 1, NaN, 1, 1, 1, 1]), [y(1:2), NaN, y(4:7)], eps) +***** assert (triinv ([p, NaN], 1, 2, 1.5), [y, NaN], eps) +***** assert (triinv (single ([p, NaN]), 1, 2, 1.5), single ([y, NaN]), eps('single')) +***** assert (triinv ([p, NaN], single (1), 2, 1.5), single ([y, NaN]), eps('single')) +***** assert (triinv ([p, NaN], 1, single (2), 1.5), single ([y, NaN]), eps('single')) +***** assert (triinv ([p, NaN], 1, 2, single (1.5)), single ([y, NaN]), eps('single')) +***** error triinv () +***** error triinv (1) +***** error triinv (1,2) +***** error triinv (1,2,3) +***** error triinv (1,2,3,4,5) +***** error triinv (1, ones (3), ones (2), ones (2)) +***** error triinv (1, ones (2), ones (3), ones (2)) +***** error triinv (1, ones (2), ones (2), ones (3)) +***** error triinv (i, 2, 2, 2) +***** error triinv (2, i, 2, 2) +***** error triinv (2, 2, i, 2) +***** error triinv (2, 2, 2, i) +25 tests, 25 passed, 0 known failure, 0 skipped [inst/distributions/vmrnd.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/vmrnd.m ***** assert (size (vmrnd (1, 2)), [1, 1]) @@ -12024,504 +8244,1638 @@ ***** error vmrnd (1 * ones (2),2, [3, 2]) ***** error vmrnd (1 * ones (2),2, 3, 2) 25 tests, 25 passed, 0 known failure, 0 skipped -[inst/distributions/cauchy_inv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/cauchy_inv.m -***** shared p - p = [-1 0 0.5 1 2]; -***** assert (cauchy_inv (p, ones (1,5), 2*ones (1,5)), [NaN -Inf 1 Inf NaN], eps) -***** assert (cauchy_inv (p, 1, 2*ones (1,5)), [NaN -Inf 1 Inf NaN], eps) -***** assert (cauchy_inv (p, ones (1,5), 2), [NaN -Inf 1 Inf NaN], eps) -***** assert (cauchy_inv (p, [1 -Inf NaN Inf 1], 2), [NaN NaN NaN NaN NaN]) -***** assert (cauchy_inv (p, 1, 2*[1 0 NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (cauchy_inv ([p(1:2) NaN p(4:5)], 1, 2), [NaN -Inf NaN Inf NaN]) -***** assert (cauchy_inv ([p, NaN], 1, 2), [NaN -Inf 1 Inf NaN NaN], eps) -***** assert (cauchy_inv (single ([p, NaN]), 1, 2), ... - single ([NaN -Inf 1 Inf NaN NaN]), eps ("single")) -***** assert (cauchy_inv ([p, NaN], single (1), 2), ... - single ([NaN -Inf 1 Inf NaN NaN]), eps ("single")) -***** assert (cauchy_inv ([p, NaN], 1, single (2)), ... - single ([NaN -Inf 1 Inf NaN NaN]), eps ("single")) -***** error cauchy_inv () -***** error cauchy_inv (1,2) -***** error cauchy_inv (1,2,3,4) -***** error cauchy_inv (ones (3), ones (2), ones (2)) -***** error cauchy_inv (ones (2), ones (3), ones (2)) -***** error cauchy_inv (ones (2), ones (2), ones (3)) -***** error cauchy_inv (i, 2, 2) -***** error cauchy_inv (2, i, 2) -***** error cauchy_inv (2, 2, i) -19 tests, 19 passed, 0 known failure, 0 skipped -[inst/distributions/logistic_cdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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 (x, 0, [-2, -1, 0, 1, 2]), [nan(1, 3), 0.75, 1]) -***** assert (logistic_cdf (single ([x, NaN])), single ([y, NaN]), eps ("single")) -***** error logistic_cdf () -***** error logistic_cdf (1, 2, 3, 4) -***** error ... - logistic_cdf (1, ones (2), ones (3)) -***** error ... - logistic_cdf (ones (2), 1, ones (3)) -***** error ... - logistic_cdf (ones (2), ones (3), 1) -***** error ... - logistic_cdf (i, 2, 3) -***** error ... - logistic_cdf (1, i, 3) -***** error ... - logistic_cdf (1, 2, i) -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/distributions/laplace_rnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/laplace_rnd.m -***** assert (size (laplace_rnd (1, 1, 1)), [1, 1]) -***** assert (size (laplace_rnd (1, 1, 2)), [2, 2]) -***** assert (size (laplace_rnd (1, 1, [2, 1])), [2, 1]) -***** assert (size (laplace_rnd (1, zeros (2, 2))), [2, 2]) -***** assert (size (laplace_rnd (1, ones (2, 1))), [2, 1]) -***** assert (size (laplace_rnd (1, ones (2, 2))), [2, 2]) -***** assert (size (laplace_rnd (ones (2, 1), 1)), [2, 1]) -***** assert (size (laplace_rnd (ones (2, 2), 1)), [2, 2]) -***** assert (size (laplace_rnd (1, 1, 3)), [3, 3]) -***** assert (size (laplace_rnd (1, 1, [4 1])), [4, 1]) -***** assert (size (laplace_rnd (1, 1, 4, 1)), [4, 1]) +[inst/histfit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/histfit.m +***** demo + histfit (randn (100, 1)) +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); ***** test - r = laplace_rnd (1, [1, 0, -1]); - assert (r([2:3]), [NaN, NaN]) -***** assert (class (laplace_rnd (1, 0)), "double") -***** assert (class (laplace_rnd (1, single (0))), "single") -***** assert (class (laplace_rnd (1, single ([0 0]))), "single") -***** assert (class (laplace_rnd (1, single (1))), "single") -***** assert (class (laplace_rnd (1, single ([1 1]))), "single") -***** assert (class (laplace_rnd (single (1), 1)), "single") -***** assert (class (laplace_rnd (single ([1 1]), 1)), "single") -***** error laplace_rnd () -***** error laplace_rnd (1) -***** error ... - laplace_rnd (ones (3), ones (2)) -***** error ... - laplace_rnd (ones (2), ones (3)) -***** error laplace_rnd (i, 2) -***** error laplace_rnd (1, i) -***** error ... - laplace_rnd (0, 1, [3, -1]) -***** error ... - laplace_rnd (0, 1, -1) -***** error ... - laplace_rnd (0, 1, 3, -1) -***** error ... - laplace_rnd (2, ones (2), 3) -***** error ... - laplace_rnd (2, ones (2), [3, 2]) -***** error ... - laplace_rnd (2, ones (2), 3, 2) -31 tests, 31 passed, 0 known failure, 0 skipped -[inst/distributions/ncx2inv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/ncx2inv.m -***** error p = ncx2inv (); -***** error p = ncx2inv (1); -***** error p = ncx2inv (1, 2); -***** error p = ncx2inv (1, [4, 3], [3, 4, 5]); + set (0, "DefaultFigureVisible", "off"); + x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4, 7, 5, 9, 8, 10, 4, 11]; + histfit (x); + x = [2, 4, 3, 2, NaN, 3, 2, 5, 6, 4, 7, 5, 9, 8, 10, 4, 11]; + histfit (x); + histfit (x, 3); + set (0, "DefaultFigureVisible", visibility_setting); +***** error histfit (); +***** error histfit ([x',x']); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/binotest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/gevfit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gevfit.m +***** demo + data = 1:50; + [pfit, pci] = gevfit (data); + p1 = gevcdf (data, pfit(1), pfit(2), pfit(3)); + plot (data, p1); ***** test - x = [0,0.3443,0.7226,1.1440,1.6220,2.1770,2.8436,3.6854,4.8447,6.7701,Inf]; - assert (ncx2inv ([0:0.1:1], 2, 1), x, 1e-4); + data = 1:50; + [pfit, pci] = gevfit (data); + pfit_out = [-0.4407, 15.1923, 21.5309]; + pci_out = [-0.7532, 11.5878, 16.5686; -0.1282, 19.9183, 26.4926]; + assert (pfit, pfit_out, 1e-3); + assert (pci, pci_out, 1e-3); +***** error [pfit, pci] = gevfit (ones (2,5)); ***** test - x = [0,0.8295,1.6001,2.3708,3.1785,4.0598,5.0644,6.2765,7.8763,10.4199,Inf]; - assert (ncx2inv ([0:0.1:1], 2, 3), x, 1e-4); + data = 1:2:50; + [pfit, pci] = gevfit (data); + pfit_out = [-0.4434, 15.2024, 21.0532]; + pci_out = [-0.8904, 10.3439, 14.0168; 0.0035, 22.3429, 28.0896]; + assert (pfit, pfit_out, 1e-3); + assert (pci, pci_out, 1e-3); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/slicesample.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/slicesample.m +***** demo + ## Define function to sample + d = 2; + mu = [-1; 2]; + Sigma = rand (d); + Sigma = (Sigma + Sigma'); + Sigma += eye (d)*abs (eigs (Sigma, 1, "sa")) * 1.1; + pdf = @(x)(2*pi)^(-d/2)*det(Sigma)^-.5*exp(-.5*sum((x.'-mu).*(Sigma\(x.'-mu)),1)); + ##Inputs + start = ones (1,2); + nsamples = 500; + K = 500; + m = 10; + [smpl, accept]=slicesample (start, nsamples, "pdf", pdf, "burnin", K, "thin", m, "width", [20, 30]); + figure; + hold on; + plot (smpl(:,1), smpl(:,2), 'x'); + [x, y] = meshgrid (linspace (-6,4), linspace(-3,7)); + z = reshape (pdf ([x(:), y(:)]), size(x)); + mesh (x, y, z, "facecolor", "None"); + ## Using sample points to find the volume of half a sphere with radius of .5 + f = @(x) ((.25-(x(:,1)+1).^2-(x(:,2)-2).^2).^.5.*(((x(:,1)+1).^2+(x(:,2)-2).^2)<.25)).'; + int = mean (f (smpl) ./ pdf (smpl)); + errest = std (f (smpl) ./ pdf (smpl)) / nsamples^.5; + trueerr = abs (2/3*pi*.25^(3/2)-int); + fprintf("Monte Carlo integral estimate int f(x) dx = %f\n", int); + fprintf("Monte Carlo integral error estimate %f\n", errest); + fprintf("The actual error %f\n", trueerr); + mesh (x,y,reshape (f([x(:), y(:)]), size(x)), "facecolor", "None"); +***** demo + ##Integrate truncated normal distribution to find normilization constant + pdf = @(x) exp (-.5*x.^2)/(pi^.5*2^.5); + nsamples = 1e3; + [smpl,accept] = slicesample (1, nsamples, "pdf", pdf, "thin", 4); + f = @(x) exp (-.5 * x .^ 2) .* (x >= -2 & x <= 2); + x=linspace(-3,3,1000); + area(x,f(x)); + xlabel ('x'); + ylabel ('f(x)'); + int = mean (f (smpl)./pdf(smpl)); + errest = std (f (smpl)./pdf(smpl))/nsamples^.5; + trueerr = abs (erf (2^.5)*2^.5*pi^.5-int); + fprintf("Monte Carlo integral estimate int f(x) dx = %f\n", int); + fprintf("Monte Carlo integral error estimate %f\n", errest); + fprintf("The actual error %f\n", trueerr); ***** test - x = [0,0.5417,1.3483,2.1796,3.0516,4.0003,5.0777,6.3726,8.0748,10.7686,Inf]; - assert (ncx2inv ([0:0.1:1], 1, 4), x, 1e-4); + start = 0.5; + nsamples = 1e3; + pdf = @(x) exp (-.5*(x-1).^2)/(2*pi)^.5; + [smpl, accept] = slicesample (start, nsamples, "pdf", pdf, "thin", 2, "burnin", 0, "width", 5); + assert (mean (smpl, 1), 1, .1); + assert (var (smpl, 1), 1, .2); +***** error slicesample (); +***** error slicesample (1); +***** error slicesample (1, 1); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/shadow9/std.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/std.m ***** test - x = [0.1808, 0.6456, 1.1842, 1.7650, 2.3760, 3.0105]; - assert (ncx2inv (0.05, [1, 2, 3, 4, 5, 6], 4), x, 1e-4); + x = [-10:10]; + y = [x;x+5;x-5]; + assert (std (x), sqrt (38.5), 1e-14); + assert (std (y, [], 2), sqrt ([38.5; 38.5; 38.5]), 1e-14); + assert (std (y, 0, 2), sqrt ([38.5; 38.5; 38.5]), 1e-14); + assert (std (y, 1, 2), ones (3,1) * sqrt (36.66666666666666), 1e-14); + assert (std (y, "all"), sqrt (54.19354838709678), 1e-14); + y(2,4) = NaN; + assert (std (y, "all"), NaN); + assert (std (y, "all", "includenan"), NaN); + assert (std (y, "all", "omitnan"), sqrt (55.01533580116342), 1e-14); + assert (std (y, 0, 2, "includenan"), sqrt ([38.5; NaN; 38.5]), 1e-14); + assert (std (y, [], 2), sqrt ([38.5; NaN; 38.5]), 1e-14); + assert (std (y, [], 2, "omitnan"), ... + sqrt ([38.5; 37.81842105263158; 38.5]), 1e-14); +***** assert (std ([4 NaN 6], [1 2 1], "omitnan"), 1, eps) +***** assert (std ([4 5 6], [1 NaN 1], "omitnan"), 1, eps) +***** assert (std (magic(3), [1 NaN 3], "omitnan"), sqrt(3)*[1 2 1], eps) +***** assert (std ([4 NaN 6], [1 2 1], "omitnan", "all"), 1, eps) +***** assert (std ([4 NaN 6], [1 2 1], "all", "omitnan"), 1, eps) +***** assert (std ([4 5 6], [1 NaN 1], "omitnan", "all"), 1, eps) +***** assert (std ([4 NaN 6], [1 2 1], 2, "omitnan"), 1, eps) +***** assert (std ([4 5 6], [1 NaN 1], 2, "omitnan"), 1, eps) +***** assert (std (magic(3), [1 NaN 3], 1, "omitnan"), sqrt(3)*[1 2 1], eps) +***** assert (std (magic(3), [1 NaN 3], 2, "omitnan"), sqrt(3)*[0.5;1;0.5], eps) +***** assert (std (4*[4 5; 6 7; 8 9], [1 3], 2, 'omitnan'), sqrt(3)*[1;1;1], eps) +***** assert (std ([4 NaN; 6 7; 8 9], [1 1 3], 1, 'omitnan'), [1.6 sqrt(3)/2], eps) +***** assert (std (4*[4 NaN; 6 7; 8 9], [1 3], 2, 'omitnan'), sqrt(3)*[0;1;1], eps) +***** assert (std (3*reshape(1:18, [3 3 2]), [1 2 3], 1, 'omitnan'), sqrt(5)*ones(1,3,2), eps) +***** assert (std (reshape(1:18, [3 3 2]), [1 2 3], 2, 'omitnan'), sqrt(5)*ones(3,1,2), eps) +***** assert (std (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 2], 'omitnan'), sqrt(60)*ones(1,1,2),eps) +***** assert (std (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 4], 'omitnan'), sqrt(6)*ones(1,3,2),eps) +***** assert (std (6*reshape(1:18, [3 3 2]), ones (3,3,2), [1:3], 'omitnan'), sqrt(969),eps) ***** test - x = [0.4887, 0.6699, 0.9012, 1.1842, 1.5164, 1.8927]; - assert (ncx2inv (0.05, 3, [1, 2, 3, 4, 5, 6]), x, 1e-4); + x = reshape(1:18, [3 3 2]); + x([2, 14]) = NaN; + w = ones (3,3,2); + assert (std (16*x, w, [1:3], 'omitnan'), sqrt(6519), eps); ***** test - x = [1.3941, 1.6824, 2.0103, 2.3760, NaN, 3.2087]; - assert (ncx2inv (0.05, 5, [1, 2, 3, 4, -1, 6]), x, 1e-4); + x = reshape(1:18, [3 3 2]); + w = ones (3,3,2); + w([2, 14]) = NaN; + assert (std (16*x, w, [1:3], 'omitnan'), sqrt(6519), eps); +***** assert (std ([1 2 3], "aLl"), 1); +***** assert (std ([1 2 3], "OmitNan"), 1); +***** assert (std ([1 2 3], "IncludeNan"), 1); ***** test - assert (ncx2inv (0.996, 5, 8), 35.51298862765576, 2e-13); -11 tests, 11 passed, 0 known failure, 0 skipped -[inst/distributions/lognrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/cauchy_cdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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,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) -18 tests, 18 passed, 0 known failure, 0 skipped -[inst/distributions/raylinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/raylinv.m + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + assert (size (std (x, 0, [3 2])), [10, 1, 1, 3]); + assert (size (std (x, 1, [1 2])), [1, 1, 6, 3]); + assert (size (std (x, [], [1 2 4])), [1, 1, 6]); + assert (size (std (x, 0, [1 4 3])), [1, 40]); + assert (size (std (x, [], [1 2 3 4])), [1, 1]); +***** assert (std (3*magic(3)), sqrt([63 144 63]), eps) +***** assert (std (3*magic(3), 'omitnan'), sqrt([63 144 63]), eps) +***** assert (std (3*magic(3), 1), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), 1, 'omitnan'), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), ones(1,3), 1), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), ones(1,3), 1, 'omitnan'), sqrt([42 96 42]), eps) +***** assert (std (2*magic(3), [1 1 NaN], 1, 'omitnan'), [5 4 1], eps) +***** assert (std (3*magic(3), ones(3,3)), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), ones(3,3), 'omitnan'), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 'omitnan'), sqrt([42 36 42]), eps) +***** assert (std (3*magic(3), ones(3,3), 1), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), ones(3,3), 1, 'omitnan'), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 1, 'omitnan'), sqrt([42 36 42]), eps) +***** assert (std (3*magic(3), ones(3,3), [1 4]), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), ones(3,3), [1 4], 'omitnan'), sqrt([42 96 42]), eps) +***** assert (std (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1],[1 4],'omitnan'), sqrt([42 36 42]), eps) ***** 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); + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + v = repmat (sqrt (33.38912133891213), [10, 1, 1, 3]); + assert (std (x, 0, [3, 2]), v, 1e-14); + v = repmat (sqrt (33.250), [10, 1, 1, 3]); + assert (std (x, 1, [3, 2]), v, 1e-14); + x(2,5,6,3) = NaN; + v(2,1,1,3) = NaN; + assert (std (x, 1, [3, 2]), v, 1e-14); + v = repmat (sqrt (33.38912133891213), [10 1 1 3]); + v(2,1,1,3) = NaN; + assert (std (x, [], [3, 2]), v, 1e-14); + v(2,1,1,3) = sqrt (33.40177912169048); + assert (std (x, [], [3, 2], "omitnan"), v, 1e-14); ***** 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); -***** 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) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/distributions/logistic_inv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/logistic_inv.m + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + [v, m] = std (x, 0, [3 2]); + assert (m, mean (x, [3 2])); + [v, m] = std (x, 0, [1 2]); + assert (m, mean (x, [1 2])); + [v, m] = std (x, 0, [1 3 4]); + assert (m, mean (x, [1 3 4])); ***** test - p = [0.01:0.01:0.99]; - assert (logistic_inv (p), log (p ./ (1-p)), 25*eps); -***** shared p - p = [-1 0 0.5 1 2]; -***** assert (logistic_inv (p), [NaN -Inf 0 Inf NaN]) -***** assert (logistic_inv (p, 0, [-1, 0, 1, 2, 3]), [NaN NaN 0 Inf NaN]) -***** assert (logistic_inv ([p, NaN]), [NaN -Inf 0 Inf NaN NaN]) -***** assert (logistic_inv (single ([p, NaN])), single ([NaN -Inf 0 Inf NaN NaN])) -***** error logistic_inv () -***** error logistic_inv (1, 2, 3, 4) -***** error ... - logistic_inv (1, ones (2), ones (3)) -***** error ... - logistic_inv (ones (2), 1, ones (3)) -***** error ... - logistic_inv (ones (2), ones (3), 1) -***** error ... - logistic_inv (i, 2, 3) -***** error ... - logistic_inv (1, i, 3) -***** error ... - logistic_inv (1, 2, i) -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/distributions/nakacdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/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/distributions/betarnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/lognpdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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,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) -17 tests, 17 passed, 0 known failure, 0 skipped -[inst/distributions/gamrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gamrnd.m -***** assert (size (gamrnd (1,2)), [1, 1]) -***** assert (size (gamrnd (ones (2,1), 2)), [2, 1]) -***** assert (size (gamrnd (ones (2,2), 2)), [2, 2]) -***** assert (size (gamrnd (1, 2*ones (2,1))), [2, 1]) -***** assert (size (gamrnd (1, 2*ones (2,2))), [2, 2]) -***** assert (size (gamrnd (1, 2, 3)), [3, 3]) -***** assert (size (gamrnd (1, 2, [4 1])), [4, 1]) -***** assert (size (gamrnd (1, 2, 4, 1)), [4, 1]) -***** assert (class (gamrnd (1, 2)), "double") -***** assert (class (gamrnd (single (1), 2)), "single") -***** assert (class (gamrnd (single ([1 1]), 2)), "single") -***** assert (class (gamrnd (1, single (2))), "single") -***** assert (class (gamrnd (1, single ([2 2]))), "single") -***** error gamrnd () -***** error gamrnd (1) -***** error gamrnd (ones (3), ones (2)) -***** error gamrnd (ones (2), ones (3)) -***** error gamrnd (i, 2) -***** error gamrnd (2, i) -***** error gamrnd (1,2, -1) -***** error gamrnd (1,2, ones (2)) -***** error gamrnd (1, 2, [2 -1 2]) -***** error gamrnd (1,2, 1, ones (2)) -***** error gamrnd (1,2, 1, -1) -***** error gamrnd (ones (2,2), 2, 3) -***** error gamrnd (ones (2,2), 2, [3, 2]) -***** error gamrnd (ones (2,2), 2, 2, 3) + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + x(2,5,6,3) = NaN; + [v, m] = std (x, 0, [3 2], "omitnan"); + assert (m, mean (x, [3 2], "omitnan")); +***** test + [v, m] = std (4 * eye (2), [1, 3]); + assert (v, sqrt ([3, 3]), 1e-14); + assert (m, [1, 3]); +***** assert (std (ones (2,2,2), [1:2], 3), [(zeros (2, 2))]); +***** assert (std (magic (3), [1:9], "all"), 2.581988897471611, 1e-14); +***** assert (std (ones (2,2), [], 3), zeros (2,2)); +***** assert (std (ones (2,2,2), [], 99), zeros (2,2,2)); +***** assert (std (magic (3), [], 3), zeros (3,3)); +***** assert (std (magic (3), [], 1), sqrt ([7, 16, 7])); +***** assert (std (magic (3), [], [1 3]), sqrt ([7, 16, 7])); +***** assert (std (magic (3), [], [1 99]), sqrt ([7, 16, 7])); +***** test + [v, m] = std ([]); + assert (v, NaN); + assert (m, NaN); + [v, m] = std (3); + assert (v, 0); + assert (m, 3); +***** assert (std (13), 0) +***** assert (std (single (13)), single (0)) +***** assert (std ([1,2,3]), 1) +***** assert (std ([1,2,3], 1), sqrt (2/3), eps) +***** assert (std ([1,2,3], [], 1), [0,0,0]) +***** assert (std ([1,2,3], [], 3), [0,0,0]) +***** assert (std (5, 99), 0) +***** assert (std (5, 99, 1), 0) +***** assert (std (5, 99, 2), 0) +***** assert (std ([5 3], [99 99], 2), 1) +***** assert (std ([1:7], [1:7]), sqrt (3)) +***** assert (std ([eye(3)], [1:3]), sqrt ([5/36, 2/9, 1/4]), eps) +***** assert (std (ones (2,2,2), [1:2], 3), [(zeros (2,2))]) +***** assert (std ([1 2; 3 4], 0, 'all'), std ([1:4])) +***** assert (std (reshape ([1:8], 2, 2, 2), 0, [1 3]), sqrt ([17/3 17/3]), eps) +***** assert (std ([1 2 3;1 2 3], [], [1 2]), sqrt (0.8), eps) +***** assert (std ([]), NaN) +***** assert (std ([],[],1), NaN(1,0)) +***** assert (std ([],[],2), NaN(0,1)) +***** assert (std ([],[],3), []) +***** assert (std (ones (1,0)), NaN) +***** assert (std (ones (1,0), [], 1), NaN(1,0)) +***** assert (std (ones (1,0), [], 2), NaN) +***** assert (std (ones (1,0), [], 3), NaN(1,0)) +***** assert (std (ones (0,1)), NaN) +***** assert (std (ones (0,1), [], 1), NaN) +***** assert (std (ones (0,1), [], 2), NaN(0,1)) +***** assert (std (ones (0,1), [], 3), NaN(0,1)) +***** assert (std (ones (1,3,0,2)), NaN(1,1,0,2)) +***** assert (std (ones (1,3,0,2), [], 1), NaN(1,3,0,2)) +***** assert (std (ones (1,3,0,2), [], 2), NaN(1,1,0,2)) +***** assert (std (ones (1,3,0,2), [], 3), NaN(1,3,1,2)) +***** assert (std (ones (1,3,0,2), [], 4), NaN(1,3,0)) +***** test <*62395> + [~, m] = std (13); + assert (m, 13); + [~, m] = std (single(13)); + assert (m, single(13)); + [~, m] = std ([1, 2, 3; 3 2 1], []); + assert (m, [2 2 2]); + [~, m] = std ([1, 2, 3; 3 2 1], [], 1); + assert (m, [2 2 2]); + [~, m] = std ([1, 2, 3; 3 2 1], [], 2); + assert (m, [2 2]'); + [~, m] = std ([1, 2, 3; 3 2 1], [], 3); + assert (m, [1 2 3; 3 2 1]); +***** test <*62395> + [~, m] = std (5,99); + assert (m, 5); + [~, m] = std ([1:7], [1:7]); + assert (m, 5); + [~, m] = std ([eye(3)], [1:3]); + assert (m, [1/6, 1/3, 0.5], eps); + [~, m] = std (ones (2,2,2), [1:2], 3); + assert (m, ones (2,2)); + [~, m] = std ([1 2; 3 4], 0, 'all'); + assert (m, 2.5, eps); + [~, m] = std (reshape ([1:8], 2, 2, 2), 0, [1 3]); + assert (m, [3.5, 5.5], eps); +***** test <*62395> + [~, m] = std ([]); + assert (m, NaN); +***** test <*63203> + [v, m] = std (Inf); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = std (NaN); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([1, Inf, 3]); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = std ([1, Inf, 3]'); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = std ([1, NaN, 3]); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([1, NaN, 3]'); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([1, Inf, 3], [], 1); + assert (v, [0, NaN, 0]); + assert (m, [1, Inf, 3]); +***** test <*63203> + [v, m] = std ([1, Inf, 3], [], 2); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = std ([1, Inf, 3], [], 3); + assert (v, [0, NaN, 0]); + assert (m, [1, Inf, 3]); +***** test <*63203> + [v, m] = std ([1, NaN, 3], [], 1); + assert (v, [0, NaN, 0]); + assert (m, [1, NaN, 3]); +***** test <*63203> + [v, m] = std ([1, NaN, 3], [], 2); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([1, NaN, 3], [], 3); + assert (v, [0, NaN, 0]); + assert (m, [1, NaN, 3]); +***** test <*63203> + [v, m] = std ([1, 2, 3; 3, Inf, 5]); + assert (v, sqrt ([2, NaN, 2])); + assert (m, [2, Inf, 4]); +***** test <*63203> + [v, m] = std ([1, Inf, 3; 3, Inf, 5]); + assert (v, sqrt ([2, NaN, 2])); + assert (m, [2, Inf, 4]); +***** test <*63203> + [v, m] = std ([1, 2, 3; 3, NaN, 5]); + assert (v, sqrt ([2, NaN, 2])); + assert (m, [2, NaN, 4]); +***** test <*63203> + [v, m] = std ([1, NaN, 3; 3, NaN, 5]); + assert (v, sqrt ([2, NaN, 2])); + assert (m, [2, NaN, 4]); +***** test <*63203> + [v, m] = std ([Inf, 2, NaN]); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([Inf, 2, NaN]'); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([NaN, 2, Inf]); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([NaN, 2, Inf]'); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([Inf, 2, NaN], [], 1); + assert (v, [NaN, 0, NaN]); + assert (m, [Inf, 2, NaN]); +***** test <*63203> + [v, m] = std ([Inf, 2, NaN], [], 2); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([NaN, 2, Inf], [], 1); + assert (v, [NaN, 0, NaN]); + assert (m, [NaN, 2, Inf]); +***** test <*63203> + [v, m] = std ([NaN, 2, Inf], [], 2); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = std ([1, 3, NaN; 3, 5, Inf]); + assert (v, sqrt ([2, 2, NaN])); + assert (m, [2, 4, NaN]); +***** test <*63203> + [v, m] = std ([1, 3, Inf; 3, 5, NaN]); + assert (v, sqrt ([2, 2, NaN])); + assert (m, [2, 4, NaN]); +***** test <*63291> + [v, m] = std (2 * eye (2)); + assert (v, sqrt ([2, 2])); + assert (m, [1, 1]); +***** test <*63291> + [v, m] = std (4 * eye (2), [1, 3]); + assert (v, sqrt ([3, 3])); + assert (m, [1, 3]); +***** test <*63291> + [v, m] = std (sparse (2 * eye (2))); + assert (full (v), sqrt ([2, 2])); + assert (full (m), [1, 1]); +***** test <*63291> + [v, m] = std (sparse (4 * eye (2)), [1, 3]); + assert (full (v), sqrt ([3, 3])); + assert (full (m), [1, 3]); +***** test <63291> + [v, m] = std (sparse (eye (2))); + assert (issparse (v)); + assert (issparse (m)); +***** test <63291> + [v, m] = std (sparse (eye (2)), [1, 3]); + assert (issparse (v)); + assert (issparse (m)); +***** error std () +***** error std (['A'; 'B']) +***** error std ([1 2 3], 2) +***** error std ([1 2], [-1 0]) +***** error ... + std ([1 2], eye (2)) +***** error ... + std (ones (2, 2), [1 2], [1 2]) +***** error ... + std ([1 2], [1 2 3]) +***** error ... + std (1, [1 2]) +***** error ... + std ([1 2], [1 2], 1) +***** error ... + std (1, [], ones (2,2)) +***** error std (1, [], 1.5) +***** error std (1, [], 0) +***** error std () +***** error std (1, 2, "omitnan", 3) +***** error std (1, 2, 3, 4) +***** error std (1, 2, 3, 4, 5) +***** error std (1, "foo") +***** error std (1, [], "foo") +***** error std ([1 2], 2, "all") +***** error std ([1 2],0.5, "all") +***** error std (1, -1) +***** error std (1, [1 -1]) +***** error ... + std ([1 2 3], [1 -1 0]) +***** error std ({1:5}) +***** error std ("char") +***** error std (1, [], ones (2,2)) +***** error std (1, 0, 1.5) +***** error std (1, [], 0) +***** error var ([1 2 3], [], [-1 1]) +***** error ... + std (repmat ([1:20;6:25], [5 2 6 3]), 0, [1 2 2 2]) +***** error ... + std ([1 2 3; 2 3 4], [1 3 4]) +***** error ... + std ([1 2], eye (2)) +***** error ... + std ([1 2 3; 2 3 4], [1 3 4], 1) +***** error ... + std ([1 2 3; 2 3 4], [1 3], 2) +***** error ... + std (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), [2 3]) +***** error ... + std (1, [], 1, "all") +***** error ... + std ([1 2 3; 2 3 4], [1 3], "all") +***** error ... + std (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), "all") +160 tests, 160 passed, 0 known failure, 0 skipped +[inst/shadow9/median.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/median.m +***** assert (median (1), 1) +***** assert (median ([1,2,3]), 2) +***** assert (median ([1,2,3]'), 2) +***** assert (median (cat(3,3,1,2)), 2) +***** assert (median ([3,1,2]), 2) +***** assert (median ([2,4,6,8]), 5) +***** assert (median ([8,2,6,4]), 5) +***** assert (median (single ([1,2,3])), single (2)) +***** assert (median ([1,2], 3), [1,2]) +***** test + x = [1, 2, 3, 4, 5, 6]; + x2 = x'; + y = [1, 2, 3, 4, 5, 6, 7]; + y2 = y'; + + assert (median (x) == median (x2) && median (x) == 3.5); + assert (median (y) == median (y2) && median (y) == 4); + assert (median ([x2, 2 * x2]), [3.5, 7]); + assert (median ([y2, 3 * y2]), [4, 12]); +***** test + in = [1 2 3]; + out = 2; + assert (median (in, "default"), median (in)); + assert (median (in, "default"), out); +***** test + in = single ([1 2 3]); + out = 2; + assert (median (in, "default"), single (median (in))); + assert (median (in, "default"), single (out)); + assert (median (in, "double"), double (out)); + assert (median (in, "native"), single (out)); +***** test + in = uint8 ([1 2 3]); + out = 2; + assert (median (in, "default"), double (median (in))); + assert (median (in, "default"), double (out)); + assert (median (in, "double"), out); + assert (median (in, "native"), uint8 (out)); +***** test + in = logical ([1 0 1]); + out = 1; + assert (median (in, "default"), double (median (in))); + assert (median (in, "default"), double (out)); + assert (median (in, "double"), double (out)); + assert (median (in, "native"), double (out)); +***** test + x = repmat ([2 2.1 2.2 2 NaN; 3 1 2 NaN 5; 1 1.1 1.4 5 3], [1, 1, 4]); + y = repmat ([2 1.1 2 NaN NaN], [1, 1, 4]); + assert (median (x), y); + assert (median (x, 1), y); + y = repmat ([2 1.1 2 3.5 4], [1, 1, 4]); + assert (median (x, "omitnan"), y); + assert (median (x, 1, "omitnan"), y); + y = repmat ([2.05; 2.5; 1.4], [1, 1, 4]); + assert (median (x, 2, "omitnan"), y); + y = repmat ([NaN; NaN; 1.4], [1, 1, 4]); + assert (median (x, 2), y); + assert (median (x, "all"), NaN); + assert (median (x, "all", "omitnan"), 2); +***** assert (median (cat (3, 3, 1, NaN, 2), "omitnan"), 2) +***** assert (median (cat (3, 3, 1, NaN, 2), 3, "omitnan"), 2) +***** test + assert (median (true, "all"), logical (1)); + assert (median (false), logical (0)); + assert (median ([true false true]), true); + assert (median ([true false true], 2), true); + assert (median ([true false true], 1), logical ([1 0 1])); + assert (median ([true false NaN], 1), [1 0 NaN]); + assert (median ([true false NaN], 2), NaN); + assert (median ([true false NaN], 2, "omitnan"), 0.5); + assert (median ([true false NaN], 2, "omitnan", "native"), double(0.5)); +***** test + x = repmat ([1:20;6:25], [5 2 6 3]); + assert (size (median (x, [3 2])), [10 1 1 3]); + assert (size (median (x, [1 2])), [1 1 6 3]); + assert (size (median (x, [1 2 4])), [1 1 6]); + assert (size (median (x, [1 4 3])), [1 40]); + assert (size (median (x, [1 2 3 4])), [1 1]); +***** assert (median (ones (2,2), 3), ones (2,2)); +***** assert (median (ones (2,2,2), 99), ones (2,2,2)); +***** assert (median (magic (3), 3), magic (3)); +***** assert (median (magic (3), [1 3]), [4, 5, 6]); +***** assert (median (magic (3), [1 99]), [4, 5, 6]); +***** test + x = repmat ([2 2.1 2.2 2 NaN; 3 1 2 NaN 5; 1 1.1 1.4 5 3], [1, 1, 4]); + assert (median (x, [3 2]), [NaN NaN 1.4]'); + assert (median (x, [3 2], "omitnan"), [2.05 2.5 1.4]'); + assert (median (x, [1 3]), [2 1.1 2 NaN NaN]); + assert (median (x, [1 3], "omitnan"), [2 1.1 2 3.5 4]); +***** assert (median (NaN), NaN) +***** assert (median (NaN, "omitnan"), NaN) +***** assert (median (NaN (2)), [NaN NaN]) +***** assert (median (NaN (2), "omitnan"), [NaN NaN]) +***** assert (median ([1 NaN 3]), NaN) +***** assert (median ([1 NaN 3], 1), [1 NaN 3]) +***** assert (median ([1 NaN 3], 2), NaN) +***** assert (median ([1 NaN 3]'), NaN) +***** assert (median ([1 NaN 3]', 1), NaN) +***** assert (median ([1 NaN 3]', 2), [1; NaN; 3]) +***** assert (median ([1 NaN 3], "omitnan"), 2) +***** assert (median ([1 NaN 3]', "omitnan"), 2) +***** assert (median ([1 NaN 3], 1, "omitnan"), [1 NaN 3]) +***** assert (median ([1 NaN 3], 2, "omitnan"), 2) +***** assert (median ([1 NaN 3]', 1, "omitnan"), 2) +***** assert (median ([1 NaN 3]', 2, "omitnan"), [1; NaN; 3]) +***** assert (median ([1 2 NaN 3]), NaN) +***** assert (median ([1 2 NaN 3], "omitnan"), 2) +***** assert (median ([1,2,NaN;4,5,6;NaN,8,9]), [NaN, 5, NaN]) +***** assert (median ([1 2 ; NaN 4]), [NaN 3]) +***** assert (median ([1 2 ; NaN 4], "omitnan"), [1 3]) +***** assert (median ([1 2 ; NaN 4], 1, "omitnan"), [1 3]) +***** assert (median ([1 2 ; NaN 4], 2, "omitnan"), [1.5; 4], eps) +***** assert (median ([1 2 ; NaN 4], 3, "omitnan"), [1 2 ; NaN 4]) +***** assert (median ([NaN 2 ; NaN 4]), [NaN 3]) +***** assert (median ([NaN 2 ; NaN 4], "omitnan"), [NaN 3]) +***** assert (median (ones (1, 0, 3)), NaN (1, 1, 3)) +***** assert (median (NaN("single")), NaN("single")); +***** assert (median (NaN("single"), "omitnan"), NaN("single")); +***** assert (median (NaN("single"), "double"), NaN("double")); +***** assert (median (single([1 2 ; NaN 4])), single([NaN 3])); +***** assert (median (single([1 2 ; NaN 4]), "double"), double([NaN 3])); +***** assert (median (single([1 2 ; NaN 4]), "omitnan"), single([1 3])); +***** assert (median (single([1 2 ; NaN 4]), "omitnan", "double"), double([1 3])); +***** assert (median (single([NaN 2 ; NaN 4]), "double"), double([NaN 3])); +***** assert (median (single([NaN 2 ; NaN 4]), "omitnan"), single([NaN 3])); +***** assert (median (single([NaN 2 ; NaN 4]), "omitnan", "double"), double([NaN 3])); +***** assert (median (Inf), Inf); +***** assert (median (-Inf), -Inf); +***** assert (median ([-Inf Inf]), NaN); +***** assert (median ([3 Inf]), Inf); +***** assert (median ([3 4 Inf]), 4); +***** assert (median ([Inf 3 4]), 4); +***** assert (median ([Inf 3 Inf]), Inf); +***** assert (median ([]), NaN); +***** assert (median (ones(1,0)), NaN); +***** assert (median (ones(0,1)), NaN); +***** assert (median ([], 1), NaN(1,0)); +***** assert (median ([], 2), NaN(0,1)); +***** assert (median ([], 3), NaN(0,0)); +***** assert (median (ones(1,0), 1), NaN(1,0)); +***** assert (median (ones(1,0), 2), NaN(1,1)); +***** assert (median (ones(1,0), 3), NaN(1,0)); +***** assert (median (ones(0,1), 1), NaN(1,1)); +***** assert (median (ones(0,1), 2), NaN(0,1)); +***** assert (median (ones(0,1), 3), NaN(0,1)); +***** assert (median (ones(0,1,0,1), 1), NaN(1,1,0)); +***** assert (median (ones(0,1,0,1), 2), NaN(0,1,0)); +***** assert (median (ones(0,1,0,1), 3), NaN(0,1,1)); +***** assert (median (ones(0,1,0,1), 4), NaN(0,1,0)); +***** assert (median([1 3 3i 2 1i]), 2) +***** assert (median([1 2 4i; 3 2i 4]), [2, 1+1i, 2+2i]) +***** shared a, b, x, y + old_state = rand ("state"); + restore_state = onCleanup (@() rand ("state", old_state)); + rand ("state", 2); + a = rand (2,3,4,5); + b = rand (3,4,6,5); + x = sort (a, 4); + y = sort (b, 3); +***** assert <*35679> (median (a, 4), x(:, :, :, 3)) +***** assert <*35679> (median (b, 3), (y(:, :, 3, :) + y(:, :, 4, :))/2) +***** shared ## Clear shared to prevent variable echo for any later test failures +***** assert (median ([true, false]), true) +***** assert (median (logical ([])), false) +***** assert (median (uint8 ([1, 3])), uint8 (2)) +***** assert (median (uint8 ([])), uint8 (NaN)) +***** assert (median (uint8 ([NaN 10])), uint8 (5)) +***** assert (median (int8 ([1, 3, 4])), int8 (3)) +***** assert (median (int8 ([])), int8 (NaN)) +***** assert (median (single ([1, 3, 4])), single (3)) +***** assert (median (single ([1, 3, NaN])), single (NaN)) +***** assert (median ([1 2 3], "aLL"), 2); +***** assert (median ([1 2 3], "OmitNan"), 2); +***** assert (median ([1 2 3], "DOUBle"), 2); +***** error median () +***** error median (1, 2, 3) +***** error median (1, 2, 3, 4) +***** error median (1, "all", 3) +***** error median (1, "b") +***** error median (1, 1, "foo") +***** error <'all' cannot be used with> median (1, 3, "all") +***** error <'all' cannot be used with> median (1, [2 3], "all") +***** error median ({1:5}) +***** error median ("char") +***** error median(1, "double", "native") +***** error median (1, ones (2,2)) +***** error median (1, 1.5) +***** error median (1, 0) +***** error median ([1 2 3], [-1 1]) +***** error median(1, [1 2 2]) +117 tests, 117 passed, 0 known failure, 0 skipped +[inst/shadow9/mean.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/mean.m +***** test + x = -10:10; + y = x'; + z = [y, y+10]; + assert (mean (x), 0); + assert (mean (y), 0); + assert (mean (z), [0, 10]); +***** assert (mean (magic (3), 1), [5, 5, 5]) +***** assert (mean (magic (3), 2), [5; 5; 5]) +***** assert (mean (logical ([1 0 1 1])), 0.75) +***** assert (mean (single ([1 0 1 1])), single (0.75)) +***** assert (mean ([1 2], 3), [1 2]) +***** error mean () +***** error mean (1, 2, 3) +***** error mean (1, 2, 3, 4) +***** error mean (1, "all", 3) +***** error mean (1, "b") +***** error mean (1, 1, "foo") +***** error mean ({1:5}) +***** error mean ("char") +***** error mean (1, ones (2,2)) +***** error mean (1, 1.5) +***** error mean (1, 0) +***** test + in = [1 2 3]; + out = 2; + assert (mean (in, "default"), mean (in)); + assert (mean (in, "default"), out); + + in = single ([1 2 3]); + out = 2; + assert (mean (in, "default"), mean (in)); + assert (mean (in, "default"), single (out)); + assert (mean (in, "double"), out); + assert (mean (in, "native"), single (out)); + + in = uint8 ([1 2 3]); + out = 2; + assert (mean (in, "default"), mean (in)); + assert (mean (in, "default"), out); + assert (mean (in, "double"), out); + assert (mean (in, "native"), uint8 (out)); + + in = logical ([1 0 1]); + out = 2/3; + assert (mean (in, "default"), mean (in)); + assert (mean (in, "default"), out); + assert (mean (in, "native"), out); # logical ignores native option +***** test + x = [-10:10]; + y = [x;x+5;x-5]; + assert (mean (x), 0); + assert (mean (y, 2), [0, 5, -5]'); + assert (mean (y, "all"), 0); + y(2,4) = NaN; + assert (mean (y', "omitnan"), [0 5.35 -5]); + z = y + 20; + assert (mean (z, "all"), NaN); + m = [20 NaN 15]; + assert (mean (z'), m); + assert (mean (z', "includenan"), m); + m = [20 25.35 15]; + assert (mean (z', "omitnan"), m); + assert (mean (z, 2, "omitnan"), m'); + assert (mean (z, 2, "native", "omitnan"), m'); + assert (mean (z, 2, "omitnan", "native"), m'); +***** test + assert (mean (true, "all"), 1); + assert (mean (false), 0); + assert (mean ([true false true]), 2/3, 4e-14); + assert (mean ([true false true], 1), [1 0 1]); + assert (mean ([true false NaN], 1), [1 0 NaN]); + assert (mean ([true false NaN], 2), NaN); + assert (mean ([true false NaN], 2, "omitnan"), 0.5); + assert (mean ([true false NaN], 2, "omitnan", "native"), 0.5); +***** test + x = repmat ([1:20;6:25], [5 2 6 3]); + assert (size (mean (x, [3 2])), [10 1 1 3]); + assert (size (mean (x, [1 2])), [1 1 6 3]); + assert (size (mean (x, [1 2 4])), [1 1 6]); + assert (size (mean (x, [1 4 3])), [1 40]); + assert (size (mean (x, [1 2 3 4])), [1 1]); +***** assert (mean (ones (2,2), 3), ones (2,2)); +***** assert (mean (ones (2,2,2), 99), ones (2,2,2)); +***** assert (mean (magic (3), 3), magic (3)); +***** assert (mean (magic (3), [1 3]), [5, 5, 5]); +***** assert (mean (magic (3), [1 99]), [5, 5, 5]); +***** test + x = repmat ([1:20;6:25], [5 2 6 3]); + m = repmat ([10.5;15.5], [5 1 1 3]); + assert (mean (x, [3 2]), m, 4e-14); + x(2,5,6,3) = NaN; + m(2,1,1,3) = NaN; + assert (mean (x, [3 2]), m, 4e-14); + m(2,1,1,3) = 15.52301255230125; + assert (mean (x, [3 2], "omitnan"), m, 4e-14); 27 tests, 27 passed, 0 known failure, 0 skipped -[inst/distributions/nctinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/nctinv.m -***** error p = nctinv (); -***** error p = nctinv (1); -***** error p = nctinv (1, [4, 3], [3, 4, 5]); +[inst/shadow9/var.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/shadow9/var.m ***** test - x = [-Inf,-0.3347,0.1756,0.5209,0.8279,1.1424,1.5021,1.9633,2.6571,4.0845,Inf]; - assert (nctinv ([0:0.1:1], 2, 1), x, 1e-4); + x = [-10:10]; + y = [x;x+5;x-5]; + assert (var (x), 38.5); + assert (var (y, [], 2), [38.5; 38.5; 38.5]); + assert (var (y, 0, 2), [38.5; 38.5; 38.5]); + assert (var (y, 1, 2), ones (3,1) * 36.66666666666666, 1e-14); + assert (var (y, "all"), 54.19354838709678, 1e-14); + y(2,4) = NaN; + assert (var (y, "all"), NaN); + assert (var (y, "all", "includenan"), NaN); + assert (var (y, "all", "omitnan"), 55.01533580116342, 1e-14); + assert (var (y, 0, 2, "includenan"), [38.5; NaN; 38.5]); + assert (var (y, [], 2), [38.5; NaN; 38.5]); + assert (var (y, [], 2, "omitnan"), [38.5; 37.81842105263158; 38.5], 1e-14); +***** assert (var ([1 NaN 3], [1 2 3], "omitnan"), 0.75, eps) +***** assert (var ([1 2 3], [1 NaN 3], "omitnan"), 0.75, eps) +***** assert (var (magic(3), [1 NaN 3], "omitnan"), [3 12 3], eps) +***** assert (var ([1 NaN 3], [1 2 3], "omitnan", "all"), 0.75, eps) +***** assert (var ([1 NaN 3], [1 2 3], "all", "omitnan"), 0.75, eps) +***** assert (var ([1 2 3], [1 NaN 3], "omitnan", "all"), 0.75, eps) +***** assert (var ([1 NaN 3], [1 2 3], 2, "omitnan"), 0.75, eps) +***** assert (var ([1 2 3], [1 NaN 3], 2, "omitnan"), 0.75, eps) +***** assert (var (magic(3), [1 NaN 3], 1, "omitnan"), [3 12 3], eps) +***** assert (var (magic(3), [1 NaN 3], 2, "omitnan"), [0.75;3;0.75], eps) +***** assert (var ([4 4; 4 6; 6 6], [1 3], 2, 'omitnan'), [0;0.75;0], eps) +***** assert (var ([4 NaN; 4 6; 6 6], [1 2 3], 1, 'omitnan'), [1 0]) +***** assert (var ([4 NaN; 4 6; 6 6], [1 3], 2, 'omitnan'), [0;0.75;0], eps) +***** assert (var (3*reshape(1:18, [3 3 2]), [1 2 3], 1, 'omitnan'), ones(1,3,2)*5) +***** assert (var (reshape(1:18, [3 3 2]), [1 2 3], 2, 'omitnan'), 5*ones(3,1,2)) +***** assert (var (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 2], 'omitnan'), 60*ones(1,1,2)) +***** assert (var (3*reshape(1:18, [3 3 2]), ones (3,3,2), [1 4], 'omitnan'), 6*ones(1,3,2)) +***** assert (var (6*reshape(1:18, [3 3 2]), ones (3,3,2), [1:3], 'omitnan'), 969) ***** test - x = [-Inf,1.5756,2.0827,2.5343,3.0043,3.5406,4.2050,5.1128,6.5510,9.6442,Inf]; - assert (nctinv ([0:0.1:1], 2, 3), x, 1e-4); + x = reshape(1:18, [3 3 2]); + x([2, 14]) = NaN; + w = ones (3,3,2); + assert (var (16*x, w, [1:3], 'omitnan'), 6519); ***** test - x = [-Inf,2.2167,2.9567,3.7276,4.6464,5.8455,7.5619,10.3327,15.7569,31.8159,Inf]; - assert (nctinv ([0:0.1:1], 1, 4), x, 1e-4); + x = reshape(1:18, [3 3 2]); + w = ones (3,3,2); + w([2, 14]) = NaN; + assert (var (16*x, w, [1:3], 'omitnan'), 6519); +***** assert (var ([1 2 3], "aLl"), 1); +***** assert (var ([1 2 3], "OmitNan"), 1); +***** assert (var ([1 2 3], "IncludeNan"), 1); ***** test - x = [1.7791 1.9368 2.0239 2.0801 2.1195 2.1489]; - assert (nctinv (0.05, [1, 2, 3, 4, 5, 6], 4), x, 1e-4); + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + assert (size (var (x, 0, [3 2])), [10, 1, 1, 3]); + assert (size (var (x, 1, [1 2])), [1, 1, 6, 3]); + assert (size (var (x, [], [1 2 4])), [1, 1, 6]); + assert (size (var (x, 0, [1 4 3])), [1, 40]); + assert (size (var (x, [], [1 2 3 4])), [1, 1]); +***** assert (var (3*magic(3)), [63 144 63]) +***** assert (var (3*magic(3), 'omitnan'), [63 144 63]) +***** assert (var (3*magic(3), 1), [42 96 42]) +***** assert (var (3*magic(3), 1, 'omitnan'), [42 96 42]) +***** assert (var (3*magic(3), ones(1,3), 1), [42 96 42]) +***** assert (var (3*magic(3), ones(1,3), 1, 'omitnan'), [42 96 42]) +***** assert (var (2*magic(3), [1 1 NaN], 1, 'omitnan'), [25 16 1]) +***** assert (var (3*magic(3), ones(3,3)), [42 96 42]) +***** assert (var (3*magic(3), ones(3,3), 'omitnan'), [42 96 42]) +***** assert (var (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 'omitnan'), [42 36 42]) +***** assert (var (3*magic(3), ones(3,3), 1), [42 96 42]) +***** assert (var (3*magic(3), ones(3,3), 1, 'omitnan'), [42 96 42]) +***** assert (var (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1], 1, 'omitnan'), [42 36 42]) +***** assert (var (3*magic(3), ones(3,3), [1 4]), [42 96 42]) +***** assert (var (3*magic(3), ones(3,3), [1 4], 'omitnan'), [42 96 42]) +***** assert (var (3*magic(3), [1 1 1; 1 1 1; 1 NaN 1],[1 4],'omitnan'), [42 36 42]) ***** test - x = [-0.7755, 0.3670, 1.2554, 2.0239, 2.7348, 3.4154]; - assert (nctinv (0.05, 3, [1, 2, 3, 4, 5, 6]), x, 1e-4); + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + v = repmat (33.38912133891213, [10, 1, 1, 3]); + assert (var (x, 0, [3, 2]), v, 1e-14); + v = repmat (33.250, [10, 1, 1, 3]); + assert (var (x, 1, [3, 2]), v, 1e-14); + x(2,5,6,3) = NaN; + v(2,1,1,3) = NaN; + assert (var (x, 1, [3, 2]), v, 4e-14); + v = repmat (33.38912133891213, [10 1 1 3]); + v(2,1,1,3) = NaN; + assert (var (x, [], [3, 2]), v, 4e-14); + v(2,1,1,3) = 33.40177912169048; + assert (var (x, [], [3, 2], "omitnan"), v, 4e-14); ***** test - x = [-0.7183, 0.3624, 1.2878, 2.1195, -3.5413, 3.6430]; - assert (nctinv (0.05, 5, [1, 2, 3, 4, -1, 6]), x, 1e-4); + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + [v, m] = var (x, 0, [3 2]); + assert (m, mean (x, [3 2])); + [v, m] = var (x, 0, [1 2]); + assert (m, mean (x, [1 2])); + [v, m] = var (x, 0, [1 3 4]); + assert (m, mean (x, [1 3 4])); ***** test - assert (nctinv (0.996, 5, 8), 30.02610554063658, 2e-11); -10 tests, 10 passed, 0 known failure, 0 skipped -[inst/distributions/wblinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/wblinv.m -***** shared p - p = [-1 0 0.63212055882855778 1 2]; -***** assert (wblinv (p, ones (1,5), ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (wblinv (p, 1, ones (1,5)), [NaN 0 1 Inf NaN], eps) -***** assert (wblinv (p, ones (1,5), 1), [NaN 0 1 Inf NaN], eps) -***** assert (wblinv (p, [1 -1 NaN Inf 1], 1), [NaN NaN NaN NaN NaN]) -***** assert (wblinv (p, 1, [1 -1 NaN Inf 1]), [NaN NaN NaN NaN NaN]) -***** assert (wblinv ([p(1:2) NaN p(4:5)], 1, 1), [NaN 0 NaN Inf NaN]) -***** assert (wblinv ([p, NaN], 1, 1), [NaN 0 1 Inf NaN NaN], eps) -***** assert (wblinv (single ([p, NaN]), 1, 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** assert (wblinv ([p, NaN], single (1), 1), single ([NaN 0 1 Inf NaN NaN]), eps ("single")) -***** assert (wblinv ([p, 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/exprnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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) + x = repmat ([1:20;6:25], [5, 2, 6, 3]); + x(2,5,6,3) = NaN; + [v, m] = var (x, 0, [3 2], "omitnan"); + assert (m, mean (x, [3 2], "omitnan")); +***** test + [v, m] = var (4 * eye (2), [1, 3]); + assert (v, [3, 3]); + assert (m, [1, 3]); +***** assert (var (ones (2,2,2), [1:2], 3), [(zeros (2, 2))]); +***** assert (var (magic (3), [1:9], "all"), 6.666666666666667, 1e-14); +***** assert (var (ones (2,2), [], 3), zeros (2,2)); +***** assert (var (ones (2,2,2), [], 99), zeros (2,2,2)); +***** assert (var (magic (3), [], 3), zeros (3,3)); +***** assert (var (magic (3), [], 1), [7, 16, 7]); +***** assert (var (magic (3), [], [1 3]), [7, 16, 7]); +***** assert (var (magic (3), [], [1 99]), [7, 16, 7]); +***** test + [v, m] = var ([]); + assert (v, NaN); + assert (m, NaN); + [v, m] = var (3); + assert (v, 0); + assert (m, 3); +***** assert (var (13), 0) +***** assert (var (single (13)), single (0)) +***** assert (var ([1,2,3]), 1) +***** assert (var ([1,2,3], 1), 2/3, eps) +***** assert (var ([1,2,3], [], 1), [0,0,0]) +***** assert (var ([1,2,3], [], 3), [0,0,0]) +***** assert (var (5, 99), 0) +***** assert (var (5, 99, 1), 0) +***** assert (var (5, 99, 2), 0) +***** assert (var ([5 3], [99 99], 2), 1) +***** assert (var ([1:7], [1:7]), 3) +***** assert (var ([eye(3)], [1:3]), [5/36, 2/9, 1/4], eps) +***** assert (var (ones (2,2,2), [1:2], 3), [(zeros (2,2))]) +***** assert (var ([1 2; 3 4], 0, 'all'), var ([1:4])) +***** assert (var (reshape ([1:8], 2, 2, 2), 0, [1 3]), [17/3 17/3], eps) +***** assert (var ([1 2 3;1 2 3], [], [1 2]), 0.8, eps) +***** assert (var ([]), NaN) +***** assert (var ([],[],1), NaN(1,0)) +***** assert (var ([],[],2), NaN(0,1)) +***** assert (var ([],[],3), []) +***** assert (var (ones (1,0)), NaN) +***** assert (var (ones (1,0), [], 1), NaN(1,0)) +***** assert (var (ones (1,0), [], 2), NaN) +***** assert (var (ones (1,0), [], 3), NaN(1,0)) +***** assert (var (ones (0,1)), NaN) +***** assert (var (ones (0,1), [], 1), NaN) +***** assert (var (ones (0,1), [], 2), NaN(0,1)) +***** assert (var (ones (0,1), [], 3), NaN(0,1)) +***** assert (var (ones (1,3,0,2)), NaN(1,1,0,2)) +***** assert (var (ones (1,3,0,2), [], 1), NaN(1,3,0,2)) +***** assert (var (ones (1,3,0,2), [], 2), NaN(1,1,0,2)) +***** assert (var (ones (1,3,0,2), [], 3), NaN(1,3,1,2)) +***** assert (var (ones (1,3,0,2), [], 4), NaN(1,3,0)) +***** test <*62395> + [~, m] = var (13); + assert (m, 13); + [~, m] = var (single(13)); + assert (m, single(13)); + [~, m] = var ([1, 2, 3; 3 2 1], []); + assert (m, [2 2 2]); + [~, m] = var ([1, 2, 3; 3 2 1], [], 1); + assert (m, [2 2 2]); + [~, m] = var ([1, 2, 3; 3 2 1], [], 2); + assert (m, [2 2]'); + [~, m] = var ([1, 2, 3; 3 2 1], [], 3); + assert (m, [1 2 3; 3 2 1]); +***** test <*62395> + [~, m] = var (5,99); + assert (m, 5); + [~, m] = var ([1:7], [1:7]); + assert (m, 5); + [~, m] = var ([eye(3)], [1:3]); + assert (m, [1/6, 1/3, 0.5], eps); + [~, m] = var (ones (2,2,2), [1:2], 3); + assert (m, ones (2,2)); + [~, m] = var ([1 2; 3 4], 0, 'all'); + assert (m, 2.5, eps); + [~, m] = var (reshape ([1:8], 2, 2, 2), 0, [1 3]); + assert (m, [3.5, 5.5], eps); +***** test <*62395> + [~, m] = var ([]); + assert (m, NaN); +***** test <*63203> + [v, m] = var (Inf); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = var (NaN); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([1, Inf, 3]); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = var ([1, Inf, 3]'); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = var ([1, NaN, 3]); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([1, NaN, 3]'); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([1, Inf, 3], [], 1); + assert (v, [0, NaN, 0]); + assert (m, [1, Inf, 3]); +***** test <*63203> + [v, m] = var ([1, Inf, 3], [], 2); + assert (v, NaN); + assert (m, Inf); +***** test <*63203> + [v, m] = var ([1, Inf, 3], [], 3); + assert (v, [0, NaN, 0]); + assert (m, [1, Inf, 3]); +***** test <*63203> + [v, m] = var ([1, NaN, 3], [], 1); + assert (v, [0, NaN, 0]); + assert (m, [1, NaN, 3]); +***** test <*63203> + [v, m] = var ([1, NaN, 3], [], 2); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([1, NaN, 3], [], 3); + assert (v, [0, NaN, 0]); + assert (m, [1, NaN, 3]); +***** test <*63203> + [v, m] = var ([1, 2, 3; 3, Inf, 5]); + assert (v, [2, NaN, 2]); + assert (m, [2, Inf, 4]); +***** test <*63203> + [v, m] = var ([1, Inf, 3; 3, Inf, 5]); + assert (v, [2, NaN, 2]); + assert (m, [2, Inf, 4]); +***** test <*63203> + [v, m] = var ([1, 2, 3; 3, NaN, 5]); + assert (v, [2, NaN, 2]); + assert (m, [2, NaN, 4]); +***** test <*63203> + [v, m] = var ([1, NaN, 3; 3, NaN, 5]); + assert (v, [2, NaN, 2]); + assert (m, [2, NaN, 4]); +***** test <*63203> + [v, m] = var ([Inf, 2, NaN]); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([Inf, 2, NaN]'); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([NaN, 2, Inf]); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([NaN, 2, Inf]'); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([Inf, 2, NaN], [], 1); + assert (v, [NaN, 0, NaN]); + assert (m, [Inf, 2, NaN]); +***** test <*63203> + [v, m] = var ([Inf, 2, NaN], [], 2); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([NaN, 2, Inf], [], 1); + assert (v, [NaN, 0, NaN]); + assert (m, [NaN, 2, Inf]); +***** test <*63203> + [v, m] = var ([NaN, 2, Inf], [], 2); + assert (v, NaN); + assert (m, NaN); +***** test <*63203> + [v, m] = var ([1, 3, NaN; 3, 5, Inf]); + assert (v, [2, 2, NaN]); + assert (m, [2, 4, NaN]); +***** test <*63203> + [v, m] = var ([1, 3, Inf; 3, 5, NaN]); + assert (v, [2, 2, NaN]); + assert (m, [2, 4, NaN]); +***** test <*63291> + [v, m] = var (2 * eye (2)); + assert (v, [2, 2]); + assert (m, [1, 1]); +***** test <*63291> + [v, m] = var (4 * eye (2), [1, 3]); + assert (v, [3, 3]); + assert (m, [1, 3]); +***** test <*63291> + [v, m] = var (sparse (2 * eye (2))); + assert (full (v), [2, 2]); + assert (full (m), [1, 1]); +***** test <*63291> + [v, m] = var (sparse (4 * eye (2)), [1, 3]); + assert (full (v), [3, 3]); + assert (full (m), [1, 3]); +***** test <63291> + [v, m] = var (sparse (eye (2))); + assert (issparse (v)); + assert (issparse (m)); +***** test <63291> + [v, m] = var (sparse (eye (2)), [1, 3]); + assert (issparse (v)); + assert (issparse (m)); +***** error var () +***** error var (['A'; 'B']) +***** error var ([1 2 3], 2) +***** error var ([1 2], [-1 0]) +***** error ... + var ([1 2], eye (2)) +***** error ... + var (ones (2, 2), [1 2], [1 2]) +***** error ... + var ([1 2], [1 2 3]) +***** error ... + var (1, [1 2]) +***** error ... + var ([1 2], [1 2], 1) +***** error ... + var (1, [], ones (2,2)) +***** error var (1, [], 1.5) +***** error var (1, [], 0) +***** error var () +***** error var (1, 2, "omitnan", 3) +***** error var (1, 2, 3, 4) +***** error var (1, 2, 3, 4, 5) +***** error var (1, "foo") +***** error var (1, [], "foo") +***** error var ([1 2], 2, "all") +***** error var ([1 2],0.5, "all") +***** error var (1, -1) +***** error var (1, [1 -1]) +***** error ... + var ([1 2 3], [1 -1 0]) +***** error var ({1:5}) +***** error var ("char") +***** error var (1, [], ones (2,2)) +***** error var (1, 0, 1.5) +***** error var (1, [], 0) +***** error var ([1 2 3], [], [-1 1]) +***** error ... + var (repmat ([1:20;6:25], [5 2 6 3]), 0, [1 2 2 2]) +***** error ... + var ([1 2 3; 2 3 4], [1 3 4]) +***** error ... + var ([1 2], eye (2)) +***** error ... + var ([1 2 3; 2 3 4], [1 3 4], 1) +***** error ... + var ([1 2 3; 2 3 4], [1 3], 2) +***** error ... + var (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), [2 3]) +***** error ... + var (1, [], 1, "all") +***** error ... + var ([1 2 3; 2 3 4], [1 3], "all") +***** error ... + var (repmat ([1:20;6:25], [5 2 6 3]), repmat ([1:20;6:25], [5 2 3]), "all") +160 tests, 160 passed, 0 known failure, 0 skipped +[inst/ecdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ecdf.m +***** demo + y = exprnd (10, 50, 1); ## random failure times are exponential(10) + d = exprnd (20, 50, 1); ## drop-out times are exponential(20) + t = min (y, d); ## we observe the minimum of these times + censored = (y > d); ## we also observe whether the subject failed + + ## Calculate and plot the empirical cdf and confidence bounds + [f, x, flo, fup] = ecdf (t, "censoring", censored); + stairs (x, f); + hold on; + stairs (x, flo, "r:"); stairs (x, fup, "r:"); + + ## Superimpose a plot of the known true cdf + xx = 0:.1:max (t); yy = 1 - exp (-xx / 10); plot (xx, yy, "g-"); + hold off; +***** demo + R = wblrnd (100, 2, 100, 1); + ecdf (R, "Function", "survivor", "Alpha", 0.01, "Bounds", "on"); + hold on + x = 1:1:250; + wblsurv = 1 - cdf ("weibull", x, 100, 2); + plot (x, wblsurv, "g-", "LineWidth", 2) + legend ("Empirical survivor function", "Lower confidence bound", ... + "Upper confidence bound", "Weibull survivor function", ... + "Location", "northeast"); + hold off +***** error ecdf (); +***** error ecdf (randi (15,2)); +***** error ecdf ([3,2,4,3+2i,5]); +***** error kstest ([2,3,4,5,6],"tail"); +***** error kstest ([2,3,4,5,6],"tail", "whatever"); +***** error kstest ([2,3,4,5,6],"function", ""); +***** error kstest ([2,3,4,5,6],"badoption", 0.51); +***** error kstest ([2,3,4,5,6],"tail", 0); +***** error kstest ([2,3,4,5,6],"alpha", 0); +***** error kstest ([2,3,4,5,6],"alpha", NaN); +***** error kstest ([NaN,NaN,NaN,NaN,NaN],"tail", "unequal"); +***** error kstest ([2,3,4,5,6],"alpha", 0.05, "CDF", [2,3,4;1,3,4;1,2,1]); +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); +***** test + set (0, "DefaultFigureVisible", "off"); + x = [2, 3, 4, 3, 5, 4, 6, 5, 8, 3, 7, 8, 9, 0]; + [F, x, Flo, Fup] = ecdf (x); + F_out = [0; 0.0714; 0.1429; 0.3571; 0.5; 0.6429; 0.7143; 0.7857; 0.9286; 1]; + assert (F, F_out, ones (10,1) * 1e-4); + x_out = [0 0 2 3 4 5 6 7 8 9]'; + assert (x, x_out); + Flo_out = [NaN, 0, 0, 0.1061, 0.2381, 0.3919, 0.4776, 0.5708, 0.7937, NaN]'; + assert (Flo, Flo_out, ones (10,1) * 1e-4); + Fup_out = [NaN, 0.2063, 0.3262, 0.6081, 0.7619, 0.8939, 0.9509, 1, 1, NaN]'; + assert (Fup, Fup_out, ones (10,1) * 1e-4); + set (0, "DefaultFigureVisible", visibility_setting); +***** test + set (0, "DefaultFigureVisible", "off"); + x = [2, 3, 4, 3, 5, 4, 6, 5, 8, 3, 7, 8, 9, 0]; + ecdf (x); + set (0, "DefaultFigureVisible", visibility_setting); +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/hmmviterbi.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hmmviterbi.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]; + 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/reproducible-path/octave-statistics-1.5.3/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/expfit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/expfit.m +***** assert (expfit (1), 1) +***** assert (expfit (1:3), 2) +***** assert (expfit ([1:3]'), 2) +***** assert (expfit (1:3, []), 2) +***** assert (expfit (1:3, [], [], []), 2) +***** assert (expfit (magic (3)), [5 5 5]) +***** assert (expfit (cat (3, magic (3), 2*magic (3))), cat (3,[5 5 5], [10 10 10])) +***** assert (expfit (1:3, 0.1, [0 0 0], [1 1 1]), 2) +***** assert (expfit ([1:3]', 0.1, [0 0 0]', [1 1 1]'), 2) +***** assert (expfit (1:3, 0.1, [0 0 0]', [1 1 1]'), 2) +***** assert (expfit (1:3, 0.1, [1 0 0], [1 1 1]), 3) +***** assert (expfit (1:3, 0.1, [0 0 0], [4 1 1]), 1.5) +***** assert (expfit (1:3, 0.1, [1 0 0], [4 1 1]), 4.5) +***** assert (expfit (1:3, 0.1, [1 0 1], [4 1 1]), 9) +***** assert (expfit (1:3, 0.1, [], [-1 1 1]), 4) +***** assert (expfit (1:3, 0.1, [], [0.5 1 1]), 2.2) +***** assert (expfit (1:3, 0.1, [1 1 1]), NaN) +***** assert (expfit (1:3, 0.1, [], [0 0 0]), NaN) +***** assert (expfit (reshape (1:9, [3 3])), [2 5 8]) +***** assert (expfit (reshape (1:9, [3 3]), [], eye(3)), [3 7.5 12]) +***** assert (expfit (reshape (1:9, [3 3]), [], 2*eye(3)), [3 7.5 12]) +***** assert (expfit (reshape (1:9, [3 3]), [], [], [2 2 2; 1 1 1; 1 1 1]), [1.75 4.75 7.75]) +***** assert (expfit (reshape (1:9, [3 3]), [], [], [2 2 2; 1 1 1; 1 1 1]), [1.75 4.75 7.75]) +***** assert (expfit (reshape (1:9, [3 3]), [], eye(3), [2 2 2; 1 1 1; 1 1 1]), [3.5 19/3 31/3]) +***** assert ([~,v] = expfit (1:3, 0), [0; Inf]) +***** assert ([~,v] = expfit (1:3, 2), [Inf; 0]) +***** assert ([~,v] = expfit (1:3, 0.1, [1 1 1]), [NaN; NaN]) +***** assert ([~,v] = expfit (1:3, 0.1, [], [0 0 0]), [NaN; NaN]) +***** assert ([~,v] = expfit (1:3, -1), [NaN; NaN]) +***** assert ([~,v] = expfit (1:3, 5), [NaN; NaN]) +***** assert ([~,v] = expfit (1:3), [0.830485728373393; 9.698190330474096], 1000*eps) +***** assert ([~,v] = expfit (1:3, 0.1), [0.953017262058213; 7.337731146400207], 1000*eps) +***** assert ([~,v] = expfit ([1:3;2:4]), ... + [0.538440777613095, 0.897401296021825, 1.256361814430554; ... + 12.385982973214016, 20.643304955356694, 28.900626937499371], 1000*eps) +***** assert ([~,v] = expfit ([1:3;2:4], [], [1 1 1; 0 0 0]), ... + 100*[0.008132550920455, 0.013554251534091, 0.018975952147727; ... + 1.184936706156216, 1.974894510260360, 2.764852314364504], 1000*eps) +***** assert ([~,v] = expfit ([1:3;2:4], [], [], [3 3 3; 1 1 1]), ... + [0.570302756652583, 1.026544961974649, 1.482787167296715; ... + 4.587722594914109, 8.257900670845396, 11.928078746776684], 1000*eps) +***** assert ([~,v] = expfit ([1:3;2:4], [], [0 0 0; 1 1 1], [3 3 3; 1 1 1]), ... + [0.692071440311161, 1.245728592560089, 1.799385744809018; ... + 8.081825275395081, 14.547285495711145, 21.012745716027212], 1000*eps) +***** test + s = reshape (1:8, [4 2]); + s(4) = NaN; + [m,v] = expfit (s); + assert ({m, v}, {[NaN, 6.5], [NaN, 2.965574334593430;NaN, 23.856157493553368]}, 1000*eps); +***** test + s = magic (3); + c = [0 1 0; 0 1 0; 0 1 0]; + f = [1 1 0; 1 1 0; 1 1 0]; + [m,v] = expfit (s, [], c, f); + assert ({m, v}, {[5 NaN NaN], [[2.076214320933482; 24.245475826185242],NaN(2)]}, 1000*eps); +***** error expfit () +***** error expfit (1,2,3,4,5) +***** error [a b c] = expfit (1) +***** error expfit (1, [1 2]) +***** error expfit ([-1 2 3 4 5]) +***** error expfit ([1:5], [], "test") +***** error expfit ([1:5], [], [], "test") +***** error expfit ([1:5], [], [0 0 0 0]) +***** error expfit ([1:5], [], [], [1 1 1 1]) +47 tests, 47 passed, 0 known failure, 0 skipped +[inst/princomp.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/princomp.m +***** shared COEFF,SCORE,latent,tsquare,m,x,R,V,lambda,i,S,F +***** 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); +***** 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); +***** 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/distributions/gevinv.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/gevinv.m +[inst/ff2n.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ff2n.m +***** error ff2n (); +***** error ff2n (2, 5); +***** error ff2n (2.5); +***** error ff2n (0); +***** error ff2n (-3); +***** error ff2n (3+2i); +***** error ff2n (Inf); +***** error ff2n (NaN); ***** test - p = 0.1:0.1:0.9; + A = ff2n (3); + assert (A, fullfact (3)); +***** test + A = ff2n (8); + assert (A, fullfact (8)); +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/grp2idx.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/grp2idx.m +***** test + in = [true false false true]; + out = {[1; 2; 2; 1] {"1"; "0"} [true; false]}; + 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]), + {[1; 2] {"1"; "0"} [true; false]}); +***** 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]), + {[1; 2; 3; 2; 2; 4; 1; 5; 6; 2], {"1"; "-3"; "-2"; "2"; "-1"; "3"}, ... + [1; -3; -2; 2; -1; 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"}}) +***** test assert (nthargout (1:3, @grp2idx, ["sci"; "oct"; "sci"; "oct"; "oct"]), + {[1; 2; 1; 2; 2] {"sci"; "oct"} ["sci"; "oct"]}); +***** test assert (nthargout (1:3, @grp2idx, {"sci"; "oct"; "sci"; "oct"; "oct"}), + {[1; 2; 1; 2; 2] {"sci"; "oct"} {"sci"; "oct"}}); +***** test assert (nthargout (1:3, @grp2idx, {"sa" "et" "et" "" "sa"}), + {[1; 2; 2; NaN; 1] {"sa"; "et"} {"sa"; "et"}}) +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/inconsistent.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/inconsistent.m +***** error inconsistent () +***** error inconsistent ([1 2 1], 2, 3) +***** error inconsistent (ones (2, 2)) +***** error inconsistent ([1 2 1], -1) +***** error inconsistent ([1 2 1], 1.3) +***** error inconsistent ([1 2 1], [1 1]) +***** error inconsistent (ones (2, 3)) +***** test + load fisheriris; + Z = linkage(meas, 'average', 'chebychev'); + assert (cond (inconsistent (Z)), 39.9, 1e-3); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/hotelling_t2test2.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hotelling_t2test2.m +***** error hotelling_t2test2 (); +***** error ... + hotelling_t2test2 ([2, 3, 4, 5, 6]); +***** error ... + hotelling_t2test2 (1, [2, 3, 4, 5, 6]); +***** error ... + hotelling_t2test2 (ones (2,2,2), [2, 3, 4, 5, 6]); +***** error ... + hotelling_t2test2 ([2, 3, 4, 5, 6], 2); +***** error ... + hotelling_t2test2 ([2, 3, 4, 5, 6], ones (2,2,2)); +***** error ... + hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", 1); +***** error ... + hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", -0.2); +***** error ... + hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", "a"); +***** error ... + hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", [0.01, 0.05]); +***** error ... + hotelling_t2test2 (ones (20,2), ones (20,2), "name", 0.01); +***** error ... + hotelling_t2test2 (ones (20,1), ones (20,2)); +***** error ... + hotelling_t2test2 (ones (20,2), ones (25,3)); +***** test + [h, pval, stats] = hotelling_t2test2 (randn(5000,5), randn(3000,5)); + assert (h, 0); + assert (stats.df1, 5); + assert (stats.df2, 7994); +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/kmeans.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/inst/gevlike.m +***** test + x = 1; + k = 0.2; + sigma = 0.3; + mu = 0.5; + [L, D, C] = gevlike ([k sigma mu], x); + expected_L = 0.75942; + expected_D = [0.53150; -0.67790; -2.40674]; + expected_C = [-0.12547 1.77884 1.06731; 1.77884 16.40761 8.48877; 1.06731 8.48877 0.27979]; + assert (L, expected_L, 0.001); + assert (D, expected_D, 0.001); + assert (C, inv (expected_C), 0.001); +***** test + x = 1; k = 0; - sigma = 1; - mu = 0; - x = gevinv (p, k, sigma, mu); - c = gevcdf(x, k, sigma, mu); - assert (c, p, 0.001); + sigma = 0.3; + mu = 0.5; + [L, D, C] = gevlike ([k sigma mu], x); + expected_L = 0.65157; + expected_D = [0.54011; -1.17291; -2.70375]; + expected_C = [0.090036 3.41229 2.047337; 3.412229 24.760027 12.510190; 2.047337 12.510190 2.098618]; + assert (L, expected_L, 0.001); + assert (D, expected_D, 0.001); + assert (C, inv (expected_C), 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); + x = -5:-1; + k = -0.2; + sigma = 0.3; + mu = 0.5; + [L, D, C] = gevlike ([k sigma mu], x); + expected_L = 3786.4; + expected_D = [6.4511e+04; -4.8194e+04; 3.0633e+03]; + expected_C = [1.6802e-07, 4.6110e-06, 8.7297e-05; ... + 4.6110e-06, 7.5693e-06, 1.2034e-05; ... + 8.7297e-05, 1.2034e-05, -0.0019125]; + assert (L, expected_L, -0.001); + assert (D, expected_D, -0.001); + assert (C, expected_C, -0.001); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/nansum.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/manovacluster.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/manovacluster.m +***** demo + load carbig + X = [MPG Acceleration Weight Displacement]; + [d, p, stats] = manova1 (X, Origin); + manovacluster (stats) +***** error manovacluster (stats, "some"); +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); ***** 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); -***** error gevinv () -***** error ... - gevinv (ones (3), ones (2)) -***** error ... - gevinv (ones (3), ones (2), 1) -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/distributions/evcdf.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/distributions/evcdf.m -***** error evcdf () -***** error evcdf (1,2,3,4,5,6,7) -***** error evcdf (1, 2, 3, 4, "uper") -***** error ... - evcdf (ones (3), ones (2), ones (2)) -***** error evcdf (2, 3, 4, [1, 2]) -***** error ... - [p, plo, pup] = evcdf (1, 2, 3) -***** error [p, plo, pup] = ... - evcdf (1, 2, 3, [1, 0; 0, 1], 0) -***** error [p, plo, pup] = ... - evcdf (1, 2, 3, [1, 0; 0, 1], 1.22) -***** error [p, plo, pup] = ... - evcdf (1, 2, 3, [1, 0; 0, 1], "alpha", "upper") -***** error evcdf (i, 2, 2) -***** error evcdf (2, i, 2) -***** error evcdf (2, 2, i) -***** error ... - [p, plo, pup] = evcdf (1, 2, 3, [1, 0; 0, -inf], 0.04) -***** shared x, y - x = [-Inf, 1, 2, Inf]; - y = [0, 0.6321, 0.9340, 1]; -***** assert (evcdf (x, ones (1,4), ones (1,4)), y, 1e-4) -***** assert (evcdf (x, 1, ones (1,4)), y, 1e-4) -***** assert (evcdf (x, ones (1,4), 1), y, 1e-4) -***** assert (evcdf (x, [0, -Inf, NaN, Inf], 1), [0, 1, NaN, NaN], 1e-4) -***** assert (evcdf (x, 1, [Inf, NaN, -1, 0]), [NaN, NaN, NaN, NaN], 1e-4) -***** assert (evcdf ([x(1:2), NaN, x(4)], 1, 1), [y(1:2), NaN, y(4)], 1e-4) -***** assert (evcdf (x, "upper"), [1, 0.0660, 0.0006, 0], 1e-4) -***** assert (evcdf ([x, NaN], 1, 1), [y, NaN], 1e-4) -***** assert (evcdf (single ([x, NaN]), 1, 1), single ([y, NaN]), 1e-4) -***** assert (evcdf ([x, NaN], single (1), 1), single ([y, NaN]), 1e-4) -***** assert (evcdf ([x, NaN], 1, single (1)), single ([y, NaN]), 1e-4) -24 tests, 24 passed, 0 known failure, 0 skipped -[inst/distributions/normrnd.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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 + set (0, "DefaultFigureVisible", "off"); + load carbig + X = [MPG Acceleration Weight Displacement]; + [d, p, stats] = manova1 (X, Origin); + manovacluster (stats); + set (0, "DefaultFigureVisible", visibility_setting); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/geostat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/evstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/evstat.m +***** error evstat () +***** error evstat (1) +***** error evstat (i, 2) +***** error evstat (2, i) +***** error ... + evstat (ones (3), ones (2)) +***** shared x, y0, y1 + x = [-5, 0, 1, 2, 3]; + y0 = [NaN, NaN, 0.4228, 0.8456, 1.2684]; + y1 = [-5.5772, -3.4633, -3.0405, -2.6177, -2.1949]; +***** assert (evstat (x, x), y0, 1e-4) +***** assert (evstat (x, x+6), y1, 1e-4) +***** assert (evstat (x, x-6), NaN (1,5)) +8 tests, 8 passed, 0 known failure, 0 skipped [inst/standardizeMissing.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/standardizeMissing.m ***** assert (standardizeMissing (1, 1), NaN) @@ -12574,181 +9928,53 @@ ***** error <'indicator' and 'A' must have > standardizeMissing ({'foo'}, 1); ***** error <'indicator' and 'A' must have > standardizeMissing ({'foo'}, 1); 49 tests, 49 passed, 0 known failure, 0 skipped -[inst/logit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/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/gevstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/gpstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gpstat.m -***** shared x, y - x = [-Inf, -1, 0, 1/2, 1, Inf]; - y = [0, 0.5, 1, 2, Inf, Inf]; -***** assert (gpstat (x, ones (1,6), zeros (1,6)), y, eps) -***** assert (gpstat (single (x), 1, 0), single (y), eps("single")) -***** assert (gpstat (x, single (1), 0), single (y), eps("single")) -***** assert (gpstat (x, single (1)), single (y), eps("single")) -***** assert (gpstat (x, 1, single (0)), single (y), eps("single")) -***** assert (gpstat (single ([x, NaN]), 1, 0), single ([y, NaN]), eps("single")) -***** assert (gpstat ([x, NaN], single (1), 0), single ([y, NaN]), eps("single")) -***** assert (gpstat ([x, NaN], single (1)), single ([y, NaN]), eps("single")) -***** assert (gpstat ([x, NaN], 1, single (0)), single ([y, NaN]), eps("single")) -***** error gpstat () -***** error gpstat (1) -***** error ... - gpstat (1, ones (2), ones (3)) -***** error ... - gpstat (rand (3), ones (2), ones (3)) -***** error gpstat (i, 2, 2) -***** error gpstat (2, i, 2) -***** error gpstat (2, 2, i) -16 tests, 16 passed, 0 known failure, 0 skipped -[inst/wblplot.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/wblplot.m -***** demo - x = [16 34 53 75 93 120]; - wblplot (x); -***** demo - x = [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67]'; - c = [0 1 0 1 0 1 1 1 0 0 1 0 1 0 1 1 0 1 1]'; - [h, p] = wblplot (x, c) -***** demo - x = [16, 34, 53, 75, 93, 120, 150, 191, 240 ,339]; - [h, p] = wblplot (x, [], [], 0.05) - ## Benchmark Reliasoft eta = 146.2545 beta 1.1973 rho = 0.9999 -***** demo - x = [46 64 83 105 123 150 150]; - c = [0 0 0 0 0 0 1]; - f = [1 1 1 1 1 1 4]; - wblplot (x, c, f, 0.05); +[inst/pdist.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/manova1.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/manova1.m ***** demo - x = [46 64 83 105 123 150 150]; - c = [0 0 0 0 0 0 1]; - f = [1 1 1 1 1 1 4]; - ## Subtract 30.92 from x to simulate a 3 parameter wbl with gamma = 30.92 - wblplot (x - 30.92, c, f, 0.05); -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - x = [16, 34, 53, 75, 93, 120, 150, 191, 240 ,339]; - [h, p] = wblplot (x, [], [], 0.05); - assert (numel (h), 4) - assert (p(1), 146.2545, 1E-4) - assert (p(2), 1.1973, 1E-4) - assert (p(3), 0.9999, 5E-5) - set (0, "DefaultFigureVisible", visibility_setting); -1 test, 1 passed, 0 known failure, 0 skipped -[inst/levene_test.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/levene_test.m -***** error levene_test () -***** error ... - levene_test (1, 2, 3, 4, 5); -***** error levene_test (randn (50, 2), 0); -***** error ... - levene_test (randn (50, 2), [1, 2, 3]); -***** error ... - levene_test (randn (50, 1), ones (55, 1)); -***** error ... - levene_test (randn (50, 1), ones (50, 2)); -***** error ... - levene_test (randn (50, 2), [], 1.2); -***** error ... - levene_test (randn (50, 2), "some_string"); -***** error ... - levene_test (randn (50, 2), [], "alpha"); -***** error ... - levene_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], 1.2); -***** error ... - levene_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], "err"); -***** error ... - levene_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], 0.05, "type"); -***** warning ... - levene_test (randn (50, 1), [ones(24, 1); 2*ones(25, 1); 3]); -***** test - load examgrades - [h, pval, W, df] = levene_test (grades); - assert (h, 1); - assert (pval, 9.523239714592791e-07, 1e-14); - assert (W, 8.59529, 1e-5); - assert (df, [4, 595]); -***** test - load examgrades - [h, pval, W, df] = levene_test (grades, [], "quadratic"); - assert (h, 1); - assert (pval, 9.523239714592791e-07, 1e-14); - assert (W, 8.59529, 1e-5); - assert (df, [4, 595]); -***** test - load examgrades - [h, pval, W, df] = levene_test (grades, [], "median"); - assert (h, 1); - assert (pval, 1.312093241723211e-06, 1e-14); - assert (W, 8.415969, 1e-6); - assert (df, [4, 595]); -***** test - load examgrades - [h, pval, W, df] = levene_test (grades(:,[1:3])); - assert (h, 1); - assert (pval, 0.004349390980463497, 1e-14); - assert (W, 5.52139, 1e-5); - assert (df, [2, 357]); -***** test - load examgrades - [h, pval, W, df] = levene_test (grades(:,[1:3]), "median"); - assert (h, 1); - assert (pval, 0.004355216763951453, 1e-14); - assert (W, 5.52001, 1e-5); - assert (df, [2, 357]); -***** test - load examgrades - [h, pval, W, df] = levene_test (grades(:,[3,4]), "quadratic"); - assert (h, 0); - assert (pval, 0.1807494957440653, 2e-14); - assert (W, 1.80200, 1e-5); - assert (df, [1, 238]); -***** test - load examgrades - [h, pval, W, df] = levene_test (grades(:,[3,4]), "median"); - assert (h, 0); - assert (pval, 0.1978225622063785, 2e-14); - assert (W, 1.66768, 1e-5); - assert (df, [1, 238]); -20 tests, 20 passed, 0 known failure, 0 skipped -[inst/wblstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/wblstat.m + load carbig + [d,p] = manova1([MPG, Acceleration, Weight, Displacement], Origin) ***** 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); + load carbig + [d,p] = manova1([MPG, Acceleration, Weight, Displacement], Origin); + assert (d, 3); + assert (p, [0, 3.140583347827075e-07, 0.007510999577743149, ... + 0.1934100745898493]', [1e-12, 1e-12, 1e-12, 1e-12]'); ***** 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); + load carbig + [d,p] = manova1([MPG, Acceleration, Weight], Origin); + assert (d, 2); + assert (p, [0, 0.00516082975137544, 0.1206528056514453]', ... + [1e-12, 1e-12, 1e-12]'); 2 tests, 2 passed, 0 known failure, 0 skipped +[inst/poisstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/evlike.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/evlike.m ***** test @@ -12776,153 +10002,87 @@ ***** error evlike ([12, 15], [1:50], [1, 2, 3]); ***** error evlike ([12, 15], [1:50], [], [1, 2, 3]); 8 tests, 8 passed, 0 known failure, 0 skipped -[inst/ranksum.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ranksum.m +[inst/dendrogram.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/dendrogram.m +***** demo "simple 1" + y = [4, 5; 2, 6; 3, 7; 8, 9; 1, 10]; + y(:,3) = 1:5; + dendrogram (y); +***** demo "simple 2" + v = 2 * rand (30, 1) - 1; + d = abs (bsxfun (@minus, v(:, 1), v(:, 1)')); + y = linkage (squareform (d, "tovector")); + dendrogram (y); +***** demo "collapsed tree, find all the leaves of node 5" + X = randn (60, 2); + D = pdist (X); + y = linkage (D, "average"); + subplot (2, 1, 1); + title ("original tree"); + dendrogram (y, 0); + subplot (2, 1, 2); + title ("collapsed tree"); + [~, t] = dendrogram (y, 20); + find(t == 5) +***** demo "optimal leaf order" + X = randn (30, 2); + D = pdist (X); + y = linkage (D, "average"); + order = optimalleaforder (y, D); + subplot (2, 1, 1); + title ("original leaf order"); + dendrogram (y); + subplot (2, 1, 2); + title ("optimal leaf order"); + dendrogram (y, "Reorder", order); +***** demo "horizontal orientation and labels" + X = randn (8, 2); + D = pdist (X); + L = ["Snow White"; "Doc"; "Grumpy"; "Happy"; "Sleepy"; "Bashful"; ... + "Sneezy"; "Dopey"]; + y = linkage (D, "average"); + dendrogram (y, "Orientation", "left", "Labels", L); +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); ***** test - mileage = [33.3, 34.5, 37.4; 33.4, 34.8, 36.8; ... - 32.9, 33.8, 37.6; 32.6, 33.4, 36.6; ... - 32.5, 33.7, 37.0; 33.0, 33.9, 36.7]; - [p,h,stats] = ranksum(mileage(:,1),mileage(:,2)); - assert (p, 0.004329004329004329, 1e-14); - assert (h, true); - assert (stats.ranksum, 21.5); + set (0, "DefaultFigureVisible", "off"); + y = [4, 5; 2, 6; 3, 7; 8, 9; 1, 10]; + y(:,3) = 1:5; + dendrogram (y); + set (0, "DefaultFigureVisible", visibility_setting); ***** test - year1 = [51 52 62 62 52 52 51 53 59 63 59 56 63 74 68 86 82 70 69 75 73 ... - 49 47 50 60 59 60 62 61 71]'; - year2 = [54 53 64 66 57 53 54 54 62 66 59 59 67 76 75 86 82 67 74 80 75 ... - 54 50 53 62 62 62 72 60 67]'; - [p,h,stats] = ranksum(year1, year2, "alpha", 0.01, "tail", "left"); - assert (p, 0.1270832752950605, 1e-14); - assert (h, false); - assert (stats.ranksum, 837.5); - assert (stats.zval, -1.140287483634606, 1e-14); - [p,h,stats] = ranksum(year1, year2, "alpha", 0.01, "tail", "left", ... - "method", "exact"); - assert (p, 0.127343916432862, 1e-14); - assert (h, false); - assert (stats.ranksum, 837.5); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/fitlm.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/fitlm.m -***** demo - y = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... - 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... - 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... - 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... - 25.694 ]'; - X = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; - - [TAB,STATS] = fitlm (X,y,"linear","CategoricalVars",1,"display","on"); -***** demo - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - brands = {'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'}; - popper = {'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; ... - 'air', 'air', 'air'; 'air', 'air', 'air'; 'air', 'air', 'air'}; - - [TAB, STATS] = fitlm ({brands(:),popper(:)},popcorn(:),"interactions",... - "CategoricalVars",[1,2],"display","on"); + set (0, "DefaultFigureVisible", "off"); + y = [4, 5; 2, 6; 3, 7; 8, 9; 1, 10]; + y(:,3) = 1:5; + dendrogram (y); + set (0, "DefaultFigureVisible", visibility_setting); ***** test - y = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... - 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... - 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... - 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... - 25.694 ]'; - X = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; - [TAB,STATS] = fitlm (X,y,"continuous",[],"display","off"); - [TAB,STATS] = fitlm (X,y,"CategoricalVars",1,"display","off"); - [TAB,STATS] = fitlm (X,y,"constant","categorical",1,"display","off"); - [TAB,STATS] = fitlm (X,y,"linear","categorical",1,"display","off"); - [TAB,STATS] = fitlm (X,y,[0,0;1,0],"categorical",1,"display","off"); - assert (TAB{2,2}, 10, 1e-04); - assert (TAB{3,2}, 7.99999999999999, 1e-09); - assert (TAB{4,2}, 8.99999999999999, 1e-09); - assert (TAB{5,2}, 11.0001428571429, 1e-09); - assert (TAB{6,2}, 19.0001111111111, 1e-09); - assert (TAB{2,3}, 1.01775379540949, 1e-09); - assert (TAB{3,3}, 1.64107868458008, 1e-09); - assert (TAB{4,3}, 1.43932122062479, 1e-09); - assert (TAB{5,3}, 1.48983900477565, 1e-09); - assert (TAB{6,3}, 1.3987687997822, 1e-09); - assert (TAB{2,6}, 9.82555903510687, 1e-09); - assert (TAB{3,6}, 4.87484242844031, 1e-09); - assert (TAB{4,6}, 6.25294748040552, 1e-09); - assert (TAB{5,6}, 7.38344399756088, 1e-09); - assert (TAB{6,6}, 13.5834536158296, 1e-09); - assert (TAB{3,7}, 2.85812420217862e-05, 1e-12); - assert (TAB{4,7}, 5.22936741204002e-07, 1e-06); - assert (TAB{5,7}, 2.12794763209106e-08, 1e-07); - assert (TAB{6,7}, 7.82091664406755e-15, 1e-08); + set (0, "DefaultFigureVisible", "off"); + v = 2 * rand (30, 1) - 1; + d = abs (bsxfun (@minus, v(:, 1), v(:, 1)')); + y = linkage (squareform (d, "tovector")); + dendrogram (y); + set (0, "DefaultFigureVisible", visibility_setting); ***** test - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - brands = bsxfun (@times, ones(6,1), [1,2,3]); - popper = bsxfun (@times, [1;1;1;2;2;2], ones(1,3)); - - [TAB, STATS] = fitlm ({brands(:),popper(:)},popcorn(:),"interactions",... - "categoricalvars",[1,2],"display","off"); - assert (TAB{2,2}, 5.66666666666667, 1e-09); - assert (TAB{3,2}, -1.33333333333333, 1e-09); - assert (TAB{4,2}, -2.16666666666667, 1e-09); - assert (TAB{5,2}, 1.16666666666667, 1e-09); - assert (TAB{6,2}, -0.333333333333334, 1e-09); - assert (TAB{7,2}, -0.166666666666667, 1e-09); - assert (TAB{2,3}, 0.215165741455965, 1e-09); - assert (TAB{3,3}, 0.304290309725089, 1e-09); - assert (TAB{4,3}, 0.304290309725089, 1e-09); - assert (TAB{5,3}, 0.304290309725089, 1e-09); - assert (TAB{6,3}, 0.43033148291193, 1e-09); - assert (TAB{7,3}, 0.43033148291193, 1e-09); - assert (TAB{2,6}, 26.3362867542108, 1e-09); - assert (TAB{3,6}, -4.38178046004138, 1e-09); - assert (TAB{4,6}, -7.12039324756724, 1e-09); - assert (TAB{5,6}, 3.83405790253621, 1e-09); - assert (TAB{6,6}, -0.774596669241495, 1e-09); - assert (TAB{7,6}, -0.387298334620748, 1e-09); - assert (TAB{2,7}, 5.49841502258254e-12, 1e-09); - assert (TAB{3,7}, 0.000893505495903642, 1e-09); - assert (TAB{4,7}, 1.21291454302428e-05, 1e-09); - assert (TAB{5,7}, 0.00237798044119407, 1e-09); - assert (TAB{6,7}, 0.453570536021938, 1e-09); - assert (TAB{7,7}, 0.705316781644046, 1e-09); - ## Test with string ids for categorical variables - brands = {'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'; ... - 'Gourmet', 'National', 'Generic'}; - popper = {'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; ... - 'air', 'air', 'air'; 'air', 'air', 'air'; 'air', 'air', 'air'}; - [TAB, STATS] = fitlm ({brands(:),popper(:)},popcorn(:),"interactions",... - "categoricalvars",[1,2],"display","off"); -***** test - load carsmall - X = [Weight,Horsepower,Acceleration]; - [TAB, STATS] = fitlm (X, MPG,"constant","display","off"); - [TAB, STATS] = fitlm (X, MPG,"linear","display","off"); - assert (TAB{2,2}, 47.9767628118615, 1e-09); - assert (TAB{3,2}, -0.00654155878851796, 1e-09); - assert (TAB{4,2}, -0.0429433065881864, 1e-09); - assert (TAB{5,2}, -0.0115826516894871, 1e-09); - assert (TAB{2,3}, 3.87851641748551, 1e-09); - assert (TAB{3,3}, 0.00112741016370336, 1e-09); - assert (TAB{4,3}, 0.0243130608813806, 1e-09); - assert (TAB{5,3}, 0.193325043113178, 1e-09); - assert (TAB{2,6}, 12.369874881944, 1e-09); - assert (TAB{3,6}, -5.80228828790225, 1e-09); - assert (TAB{4,6}, -1.76626492228599, 1e-09); - assert (TAB{5,6}, -0.0599128364487485, 1e-09); - assert (TAB{2,7}, 4.89570341688996e-21, 1e-09); - assert (TAB{3,7}, 9.87424814144e-08, 1e-09); - assert (TAB{4,7}, 0.0807803098213114, 1e-09); - assert (TAB{5,7}, 0.952359384151778, 1e-09); -3 tests, 3 passed, 0 known failure, 0 skipped + set (0, "DefaultFigureVisible", "off"); + X = randn (30, 2); + D = pdist (X); + y = linkage (D, "average"); + order = optimalleaforder (y, D); + subplot (2, 1, 1); + title ("original leaf order"); + dendrogram (y); + subplot (2, 1, 2); + title ("optimal leaf order"); + dendrogram (y, "Reorder", order); + set (0, "DefaultFigureVisible", visibility_setting); +***** error dendrogram (); +***** error dendrogram (ones (2, 2), 1); +***** error dendrogram ([1 2 1], 1, "xxx", "xxx"); +***** error dendrogram ([1 2 1], "Reorder", "xxx"); +***** error dendrogram ([1 2 1], "Reorder", [1 2 3 4]); + fail ('dendrogram ([1 2 1], "Orientation", "north")', "invalid orientation .*") +9 tests, 9 passed, 0 known failure, 0 skipped [inst/tstat.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/tstat.m ***** test @@ -12933,25 +10093,163 @@ assert (m, expected_m); assert (v, expected_v, 0.001); 1 test, 1 passed, 0 known failure, 0 skipped -[inst/anova1.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/anova1.m +[inst/nbinstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/hmmestimate.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/inst/binostat.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); + 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); + assert (v, expected_v, 0.001); +***** 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/fullfact.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/fullfact.m +***** demo + ## Full factorial design with 3 binary variables + fullfact (3) +***** demo + ## Full factorial design with 3 ordinal variables + fullfact ([2, 3, 4]) +***** error fullfact (); +***** error fullfact (2, 5); +***** error fullfact (2.5); +***** error fullfact (0); +***** error fullfact (-3); +***** error fullfact (3+2i); +***** error fullfact (Inf); +***** error fullfact (NaN); +***** error fullfact ([1, 2, -3]); +***** error fullfact ([0, 1, 2]); +***** error fullfact ([1, 2, NaN]); +***** error fullfact ([1, 2, Inf]); +***** test + A = fullfact (2); + assert (A, [0, 0; 0, 1; 1, 0; 1, 1]); +***** test + A = fullfact ([1, 2]); + assert (A, [1, 1; 1, 2]); +***** test + A = fullfact ([1, 2, 4]); + A_out = [1, 1, 1; 1, 1, 2; 1, 1, 3; 1, 1, 4; ... + 1, 2, 1; 1, 2, 2; 1, 2, 3; 1, 2, 4]; + assert (A, A_out); +15 tests, 15 passed, 0 known failure, 0 skipped +[inst/ncfstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ncfstat.m +***** error p = ncfstat (); +***** error p = ncfstat (1); +***** error p = ncfstat (1, 2); +***** error p = ncfstat (5, [4, 3], [3, 4, 5]); +***** shared df1, df2, delta + df1 = [2, 0, -1, 1, 4, 5]; + df2 = [2, 4, -1, 5, 6, 7]; + delta = [1, NaN, 3, 0, 2, -1]; +***** assert (ncfstat (df1, df2, delta), [NaN, NaN, NaN, 1.6667, 2.25, 1.12], 1e-4); +***** assert (ncfstat (df1(4:6), df2(4:6), 1), [3.3333, 1.8750, 1.6800], 1e-4); +***** assert (ncfstat (df1(4:6), df2(4:6), 2), [5.0000, 2.2500, 1.9600], 1e-4); +***** assert (ncfstat (df1(4:6), df2(4:6), 3), [6.6667, 2.6250, 2.2400], 1e-4); +***** assert (ncfstat (2, [df2(1), df2(4:6)], 5), [NaN,5.8333,5.2500,4.9000], 1e-4); +***** assert (ncfstat (0, [df2(1), df2(4:6)], 5), [NaN, Inf, Inf, Inf]); +***** assert (ncfstat (1, [df2(1), df2(4:6)], 5), [NaN, 10, 9, 8.4], 1e-14); +***** assert (ncfstat (4, [df2(1), df2(4:6)], 5), [NaN, 3.75, 3.375, 3.15], 1e-14); +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/kruskalwallis.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/kruskalwallis.m ***** demo x = meshgrid (1:6); x = x + normrnd (0, 1, 6, 6); - anova1 (x, [], 'off'); + kruskalwallis (x, [], 'off'); ***** demo x = meshgrid (1:6); x = x + normrnd (0, 1, 6, 6); - [p, atab] = anova1(x); -***** demo - x = ones (50, 4) .* [-2, 0, 1, 5]; - x = x + normrnd (0, 2, 50, 4); - groups = {"A", "B", "C", "D"}; - anova1 (x, groups); + [p, atab] = kruskalwallis(x); ***** demo - y = [54 87 45; 23 98 39; 45 64 51; 54 77 49; 45 89 50; 47 NaN 55]; - g = [1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ]; - anova1 (y(:), g(:), "on", "unequal"); + x = ones (30, 4) .* [-2, 0, 1, 5]; + x = x + normrnd (0, 2, 30, 4); + group = {"A", "B", "C", "D"}; + kruskalwallis (x, group); ***** test data = [1.006, 0.996, 0.998, 1.000, 0.992, 0.993, 1.002, 0.999, 0.994, 1.000, ... 0.998, 1.006, 1.000, 1.002, 0.997, 0.998, 0.996, 1.000, 1.006, 0.988, ... @@ -12965,108 +10263,22 @@ 0.991, 0.995, 0.984, 0.994, 0.997, 0.997, 0.991, 0.998, 1.004, 0.997]; group = [1:10] .* ones (10,10); group = group(:); - [p, tbl] = anova1 (data, group, "off"); - assert (p, 0.022661, 1e-6); - assert (tbl{2,5}, 2.2969, 1e-4); + [p, tbl] = kruskalwallis (data, group, "off"); + assert (p, 0.048229, 1e-6); + assert (tbl{2,5}, 17.03124, 1e-5); assert (tbl{2,3}, 9, 0); - assert (tbl{4,2}, 0.003903, 1e-6); + assert (tbl{4,2}, 82655.5, 1e-16); data = reshape (data, 10, 10); - [p, tbl, stats] = anova1 (data, [], "off"); - assert (p, 0.022661, 1e-6); - assert (tbl{2,5}, 2.2969, 1e-4); + [p, tbl, stats] = kruskalwallis (data, [], "off"); + assert (p, 0.048229, 1e-6); + assert (tbl{2,5}, 17.03124, 1e-5); assert (tbl{2,3}, 9, 0); - assert (tbl{4,2}, 0.003903, 1e-6); - means = [0.998, 0.9991, 0.9954, 0.9982, 0.9919, 0.9988, 1.0015, 1.0004, 0.9983, 0.9948]; + assert (tbl{4,2}, 82655.5, 1e-16); + means = [51.85, 60.45, 37.6, 51.1, 29.5, 54.25, 64.55, 66.7, 53.65, 35.35]; N = 10 * ones (1, 10); - assert (stats.means, means, 1e-6); + assert (stats.meanranks, means, 1e-6); assert (length (stats.gnames), 10, 0); assert (stats.n, N, 0); -***** test - y = [54 87 45; 23 98 39; 45 64 51; 54 77 49; 45 89 50; 47 NaN 55]; - g = [1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ]; - [p, tbl] = anova1 (y(:), g(:), "off", "equal"); - assert (p, 0.00004163, 1e-6); - assert (tbl{2,5}, 22.573418, 1e-6); - assert (tbl{2,3}, 2, 0); - assert (tbl{3,3}, 14, 0); - [p, tbl] = anova1 (y(:), g(:), "off", "unequal"); - assert (p, 0.00208877, 1e-8); - assert (tbl{2,5}, 15.523192, 1e-6); - assert (tbl{2,3}, 2, 0); - assert (tbl{2,4}, 7.5786897, 1e-6); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/cl_multinom.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cl_multinom.m -***** error cl_multinom (); -***** error cl_multinom (1, 2, 3, 4, 5); -***** error ... - cl_multinom (1, 2, 3, 4); -***** error ... - cl_multinom (1, 2, 3, "some string"); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/normplot.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/normplot.m -***** demo - h = normplot([1:20]); -***** demo - h = normplot([1:20;5:2:44]'); -***** demo - ax = newplot(); - h = normplot(ax, [1:20]); - ax = gca; - h = normplot(ax, [-10:10]); - set (ax, "xlim", [-11, 21]); -***** test -***** error normplot (); -***** error normplot (23); -***** error normplot (23, [1:20]); -***** error normplot (ones(3,4,5)); -***** shared visibility_setting - visibility_setting = get (0, "DefaultFigureVisible"); -***** test - set (0, "DefaultFigureVisible", "off"); - ax = newplot(); - h = normplot(ax, [1:20]); - ax = gca; - h = normplot(ax, [-10:10]); - set (ax, "xlim", [-11, 21]); - set (0, "DefaultFigureVisible", visibility_setting); -***** test - set (0, "DefaultFigureVisible", "off"); - h = normplot([1:20;5:2:44]'); - set (0, "DefaultFigureVisible", visibility_setting); -7 tests, 7 passed, 0 known failure, 0 skipped -[inst/gmdistribution.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/expstat.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/expstat.m @@ -13076,135 +10288,52 @@ 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/ttest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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) -***** error ttest ([8:0.1:12], 10, "tail", "invalid"); -***** error ttest ([8:0.1:12], 10, "tail", 25); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/crossval.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/crossval.m +[inst/regress.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/regress.m ***** test - load fisheriris - y = meas(:, 1); - X = [ones(size(y)) meas(:, 2:4)]; - 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', grp2idx(species)); + % Longley data from the NIST Statistical Reference Dataset + Z = [ 60323 83.0 234289 2356 1590 107608 1947 + 61122 88.5 259426 2325 1456 108632 1948 + 60171 88.2 258054 3682 1616 109773 1949 + 61187 89.5 284599 3351 1650 110929 1950 + 63221 96.2 328975 2099 3099 112075 1951 + 63639 98.1 346999 1932 3594 113270 1952 + 64989 99.0 365385 1870 3547 115094 1953 + 63761 100.0 363112 3578 3350 116219 1954 + 66019 101.2 397469 2904 3048 117388 1955 + 67857 104.6 419180 2822 2857 118734 1956 + 68169 108.4 442769 2936 2798 120445 1957 + 66513 110.8 444546 4681 2637 121950 1958 + 68655 112.6 482704 3813 2552 123366 1959 + 69564 114.2 502601 3931 2514 125368 1960 + 69331 115.7 518173 4806 2572 127852 1961 + 70551 116.9 554894 4007 2827 130081 1962 ]; + % Results certified by NIST using 500 digit arithmetic + % b and standard error in b + V = [ -3482258.63459582 890420.383607373 + 15.0618722713733 84.9149257747669 + -0.358191792925910E-01 0.334910077722432E-01 + -2.02022980381683 0.488399681651699 + -1.03322686717359 0.214274163161675 + -0.511041056535807E-01 0.226073200069370 + 1829.15146461355 455.478499142212 ]; + Rsq = 0.995479004577296; + F = 330.285339234588; + y = Z(:,1); X = [ones(rows(Z),1), Z(:,2:end)]; + alpha = 0.05; + [b, bint, r, rint, stats] = regress (y, X, alpha); + assert(b,V(:,1),3e-6); + assert(stats(1),Rsq,1e-12); + assert(stats(2),F,3e-8); + assert(((bint(:,1)-bint(:,2))/2)/tinv(alpha/2,9),V(:,2),-1.e-5); +warning: matrix singular to machine precision, rcond = 3.50566e-20 +warning: called from + regress at line 130 column 7 + __test__ at line 33 column 28 + test at line 683 column 11 + /tmp/tmp.vT34KPeaaR at line 1798 column 31 - assert (results0, results1); - assert (results2, results3); - assert (size(results4), [1 numel(y)]); - assert (mean(results4), 0.1018, 1e-4); - assert (size(results5), [mcreps 1]); -warning: strmatch is obsolete; use strncmp or strcmp instead 1 test, 1 passed, 0 known failure, 0 skipped -[inst/probit.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/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/ztest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ztest.m -***** error ztest (); -***** error ... - ztest ([1, 2, 3, 4], 2, -0.5); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "alpha", 0); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "alpha", 1.2); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "alpha", "val"); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "tail", "val"); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "alpha", 0.01, "tail", "val"); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "dim", 3); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "alpha", 0.01, "tail", "both", "dim", 3); -***** error ... - ztest ([1, 2, 3, 4], 1, 2, "alpha", 0.01, "tail", "both", "badoption", 3); -***** test - load carsmall - [h, pval, ci] = ztest (MPG, mean (MPG, "omitnan"), std (MPG, "omitnan")); - assert (h, 0); - assert (pval, 1, 1e-14); - assert (ci, [22.094; 25.343], 1e-3); -***** test - load carsmall - [h, pval, ci] = ztest (MPG, 26, 8); - assert (h, 1); - assert (pval, 0.00568359158544743, 1e-14); - assert (ci, [22.101; 25.335], 1e-3); -***** test - load carsmall - [h, pval, ci] = ztest (MPG, 26, 4); - assert (h, 1); - assert (pval, 3.184168011941316e-08, 1e-14); - assert (ci, [22.909; 24.527], 1e-3); -13 tests, 13 passed, 0 known failure, 0 skipped -[inst/crosstab.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/crosstab.m -***** error crosstab () -***** error crosstab (1) -***** error crosstab (ones (2), [1 1]) -***** error crosstab ([1 1], ones (2)) -***** error crosstab ([1], [1 2]) -***** error crosstab ([1 2], [1]) -***** test - load carbig - [table, chisq, p, labels] = crosstab (cyl4, when, org); - assert (table(2,3,1), 38); - assert (labels{3,3}, "Japan"); -***** test - load carbig - [table, chisq, p, labels] = crosstab (cyl4, when, org); - assert (table(2,3,2), 17); - assert (labels{1,3}, "USA"); -8 tests, 8 passed, 0 known failure, 0 skipped -[inst/x2fx.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/x2fx.m -***** test - X = [1, 10; 2, 20; 3, 10; 4, 20; 5, 15; 6, 15]; - D = x2fx(X,'quadratic'); - assert (D(1,:) , [1, 1, 10, 10, 1, 100]); - assert (D(2,:) , [1, 2, 20, 40, 4, 400]); -***** test - X = [1, 10; 2, 20; 3, 10; 4, 20; 5, 15; 6, 15]; - model = [0, 0; 1, 0; 0, 1; 1, 1; 2, 0]; - D = x2fx(X,model); - assert (D(1,:) , [1, 1, 10, 10, 1]); - assert (D(2,:) , [1, 2, 20, 40, 4]); - assert (D(4,:) , [1, 4, 20, 80, 16]); -***** error x2fx ([1, 10; 2, 20; 3, 10], [0; 1]); -***** error x2fx ([1, 10, 15; 2, 20, 40; 3, 10, 25], [0, 0; 1, 0; 0, 1; 1, 1; 2, 0]); -***** error x2fx ([1, 10; 2, 20; 3, 10], "whatever"); -5 tests, 5 passed, 0 known failure, 0 skipped [inst/normalise_distribution.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/normalise_distribution.m ***** test @@ -13257,35 +10386,204 @@ ***** test ***** error normalise_distribution (zeros (3, 4), {@unifcdf; @normcdf; @(x)(expcdf (x,1))}); 14 tests, 14 passed, 0 known failure, 0 skipped -[inst/hotelling_t2test.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hotelling_t2test.m -***** error hotelling_t2test (); -***** error ... - hotelling_t2test (1); -***** error ... - hotelling_t2test (ones(2,2,2)); -***** error ... - hotelling_t2test (ones(20,2), [0, 0], "alpha", 1); -***** error ... - hotelling_t2test (ones(20,2), [0, 0], "alpha", -0.2); -***** error ... - hotelling_t2test (ones(20,2), [0, 0], "alpha", "a"); -***** error ... - hotelling_t2test (ones(20,2), [0, 0], "alpha", [0.01, 0.05]); -***** error ... - hotelling_t2test (ones(20,2), [0, 0], "name", 0.01); -***** error ... - hotelling_t2test (ones(20,1), [0, 0]); -***** error ... - hotelling_t2test (ones(4,5), [0, 0, 0, 0, 0]); -***** error ... - hotelling_t2test (ones(20,5), [0, 0, 0, 0]); +[inst/adtest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/adtest.m +***** error adtest (); +***** error adtest (ones (20,2)); +***** error adtest ([1+i,0-3i]); +***** error ... + adtest (ones (20,1), "Distribution", "normal"); +***** error ... + adtest (rand (20,1), "Distribution", {"normal", 5, 3}); +***** error ... + adtest (rand (20,1), "Distribution", {"norm", 5}); +***** error ... + adtest (rand (20,1), "Distribution", {"exp", 5, 4}); +***** error ... + adtest (rand (20,1), "Distribution", {"ev", 5}); +***** error ... + adtest (rand (20,1), "Distribution", {"logn", 5, 3, 2}); +***** error ... + adtest (rand (20,1), "Distribution", {"Weibull", 5}); +***** error ... + adtest (rand (20,1), "Distribution", 35); +***** error ... + adtest (rand (20,1), "Name", "norm"); +***** error ... + adtest (rand (20,1), "Name", {"norm", 75, 10}); +***** error ... + adtest (rand (20,1), "Distribution", "norm", "Asymptotic", true); +***** error ... + adtest (rand (20,1), "MCTol", 0.001, "Asymptotic", true); +***** error ... + adtest (rand (20,1), "Distribution", {"norm", 5, 3}, "MCTol", 0.001, ... + "Asymptotic", true); +***** error ... + [h, pval, ADstat, CV] = adtest (ones (20,1), "Distribution", {"norm",5,3},... + "Alpha", 0.000000001); +***** error ... + [h, pval, ADstat, CV] = adtest (ones (20,1), "Distribution", {"norm",5,3},... + "Alpha", 0.999999999); +***** error ... + adtest (10); +***** warning ... + adtest (ones (20,1), "Alpha", 0.000001); +***** warning ... + adtest (normrnd(0,1,100,1), "Alpha", 0.99999); +***** warning ... + adtest (normrnd(0,1,100,1), "Alpha", 0.00001); ***** test - [h, pval, stats] = hotelling_t2test (randn(5000,5)); - assert (h, 0); - assert (stats.df1, 5); - assert (stats.df2, 4995); -12 tests, 12 passed, 0 known failure, 0 skipped + load examgrades + x = grades(:,1); + [h, pval, adstat, cv] = adtest (x); + assert (h, false); + assert (pval, 0.1854, 1e-4); + assert (adstat, 0.5194, 1e-4); + assert (cv, 0.7470, 1e-4); +***** test + load examgrades + x = grades(:,1); + [h, pval, adstat, cv] = adtest (x, "Distribution", "ev"); + assert (h, false); + assert (pval, 0.071363, 1e-6); +***** test + load examgrades + x = grades(:,1); + [h, pval, adstat, cv] = adtest (x, "Distribution", {"norm", 75, 10}); + assert (h, false); + assert (pval, 0.4687, 1e-4); +25 tests, 25 passed, 0 known failure, 0 skipped +[inst/chi2stat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/reproducible-path/octave-statistics-1.5.3/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/kstest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/kstest.m +***** error kstest () +***** error kstest (ones(2,4)) +***** error kstest ([2,3,5,7,3+3i]) +***** error kstest ([2,3,4,5,6],"tail") +***** error kstest ([2,3,4,5,6],"tail", "whatever") +***** error kstest ([2,3,4,5,6],"badoption", 0.51) +***** error kstest ([2,3,4,5,6],"tail", 0) +***** error kstest ([2,3,4,5,6],"alpha", 0) +***** error kstest ([2,3,4,5,6],"alpha", NaN) +***** error kstest ([NaN,NaN,NaN,NaN,NaN],"tail", "unequal") +***** error kstest ([2,3,4,5,6],"alpha", 0.05, "CDF", [2,3,4;1,3,4;1,2,1]) +***** test + load examgrades + [h, p] = kstest (grades(:,1)); + assert (h, true); + assert (p, 7.58603305206105e-107, 1e-14); +***** test + load stockreturns + x = stocks(:,3); + [h,p,k,c] = kstest (x, "Tail", "larger"); + assert (h, true); + assert (p, 5.085438806199252e-05, 1e-14); + assert (k, 0.2197, 1e-4); + assert (c, 0.1207, 1e-4); +13 tests, 13 passed, 0 known failure, 0 skipped +[inst/combnk.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/combnk.m +***** demo + c = combnk (1:5, 2); + disp ("All pairs of integers between 1 and 5:"); + disp (c); +***** test + c = combnk (1:3, 2); + assert (c, [1, 2; 1, 3; 2, 3]); +***** test + c = combnk (1:3, 6); + assert (isempty (c)); +***** test + c = combnk ({1, 2, 3}, 2); + assert (c, {1, 2; 1, 3; 2, 3}); +***** test + 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/evfit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/evfit.m +***** error evfit (ones (2,5)); +***** error evfit (single (ones (1,5))); +***** error evfit ([1, 2, 3, 4, NaN]); +***** error evfit ([1, 2, 3, 4, 5], 1.2); +***** error evfit ([1, 2, 3, 4, 5], 0.05, [1 1 0]); +***** error evfit ([1, 2, 3, 4, 5], 0.05, [], [1 1 0]); +***** error evfit ([1, 2, 3, 4, 5], 0.05, [], [], 2); +***** test + data = 1:50; + [paramhat, paramci] = evfit (data); + paramhat_out = [32.6811, 13.0509]; + paramci_out = [28.8504, 10.5294; 36.5118, 16.1763]; + assert (paramhat, paramhat_out, 1e-4); + assert (paramci, paramci_out, 1e-4); +***** test + data = 1:50; + [paramhat, paramci] = evfit (data, 0.01); + paramci_out = [27.6468, 9.8426; 37.7155, 17.3051]; + assert (paramci, paramci_out, 1e-4); +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/wblplot.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/wblplot.m +***** demo + x = [16 34 53 75 93 120]; + wblplot (x); +***** demo + x = [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67]'; + c = [0 1 0 1 0 1 1 1 0 0 1 0 1 0 1 1 0 1 1]'; + [h, p] = wblplot (x, c) +***** demo + x = [16, 34, 53, 75, 93, 120, 150, 191, 240 ,339]; + [h, p] = wblplot (x, [], [], 0.05) + ## Benchmark Reliasoft eta = 146.2545 beta 1.1973 rho = 0.9999 +***** demo + x = [46 64 83 105 123 150 150]; + c = [0 0 0 0 0 0 1]; + f = [1 1 1 1 1 1 4]; + wblplot (x, c, f, 0.05); +***** demo + x = [46 64 83 105 123 150 150]; + c = [0 0 0 0 0 0 1]; + f = [1 1 1 1 1 1 4]; + ## Subtract 30.92 from x to simulate a 3 parameter wbl with gamma = 30.92 + wblplot (x - 30.92, c, f, 0.05); +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); +***** test + set (0, "DefaultFigureVisible", "off"); + x = [16, 34, 53, 75, 93, 120, 150, 191, 240 ,339]; + [h, p] = wblplot (x, [], [], 0.05); + assert (numel (h), 4) + assert (p(1), 146.2545, 1E-4) + assert (p(2), 1.1973, 1E-4) + assert (p(3), 0.9999, 5E-5) + set (0, "DefaultFigureVisible", visibility_setting); +1 test, 1 passed, 0 known failure, 0 skipped [inst/anovan.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/anovan.m ***** demo @@ -13864,242 +11162,778 @@ assert (STATS.coeffs(4,6), 2.86e-05, 1e-07); assert (STATS.coeffs(5,6), 4.44e-06, 1e-08); 12 tests, 12 passed, 0 known failure, 0 skipped -[inst/ttest2.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ttest2.m +[inst/cophenet.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cophenet.m +***** error cophenet () +***** error cophenet (ones (2,2), 1) +***** error cophenet ([1 2 1], "a") +***** error cophenet ([1 2 1], [1 2]) +***** demo "usage"; + X = randn (10,2); + y = pdist (X); + Z = linkage (y, "average"); + cophenet (Z, y) +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/multcompare.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/multcompare.m +***** demo + + ## Demonstration using balanced one-way ANOVA from anova1 + + x = ones (50, 4) .* [-2, 0, 1, 5]; + x = x + normrnd (0, 2, 50, 4); + groups = {"A", "B", "C", "D"}; + [p, tbl, stats] = anova1 (x, groups, "off"); + multcompare (stats); +***** demo + + ## Demonstration using unbalanced one-way ANOVA example from anovan + + dv = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... + 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... + 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... + 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... + 25.694 ]'; + g = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 ... + 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; + + [P,ATAB, STATS] = anovan (dv, g, "varnames", "score", "display", "off"); + + [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "holm", ... + "ControlGroup", 1, "display", "on") + +***** demo + + ## Demonstration using factorial ANCOVA example from anovan + + score = [95.6 82.2 97.2 96.4 81.4 83.6 89.4 83.8 83.3 85.7 ... + 97.2 78.2 78.9 91.8 86.9 84.1 88.6 89.8 87.3 85.4 ... + 81.8 65.8 68.1 70.0 69.9 75.1 72.3 70.9 71.5 72.5 ... + 84.9 96.1 94.6 82.5 90.7 87.0 86.8 93.3 87.6 92.4 ... + 100. 80.5 92.9 84.0 88.4 91.1 85.7 91.3 92.3 87.9 ... + 91.7 88.6 75.8 75.7 75.3 82.4 80.1 86.0 81.8 82.5]'; + treatment = {"yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" ... + "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" ... + "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" "yes" ... + "no" "no" "no" "no" "no" "no" "no" "no" "no" "no" ... + "no" "no" "no" "no" "no" "no" "no" "no" "no" "no" ... + "no" "no" "no" "no" "no" "no" "no" "no" "no" "no"}'; + exercise = {"lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" ... + "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" ... + "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" ... + "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" "lo" ... + "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" "mid" ... + "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi"}'; + age = [59 65 70 66 61 65 57 61 58 55 62 61 60 59 55 57 60 63 62 57 ... + 58 56 57 59 59 60 55 53 55 58 68 62 61 54 59 63 60 67 60 67 ... + 75 54 57 62 65 60 58 61 65 57 56 58 58 58 52 53 60 62 61 61]'; + + [P, ATAB, STATS] = anovan (score, {treatment, exercise, age}, "model", ... + [1 0 0; 0 1 0; 0 0 1; 1 1 0], "continuous", 3, ... + "sstype", "h", "display", "off", "contrasts", ... + {"simple","poly",""}); + + [C, M, H, GNAMES] = multcompare (STATS, "dim", [1 2], "ctype", "holm", ... + "display", "on") + +***** demo + + ## Demonstration using one-way ANOVA from anovan, with fit by weighted least + ## squares to account for heteroskedasticity. + + g = [1, 1, 1, 1, 1, 1, 1, 1, ... + 2, 2, 2, 2, 2, 2, 2, 2, ... + 3, 3, 3, 3, 3, 3, 3, 3]'; + + y = [13, 16, 16, 7, 11, 5, 1, 9, ... + 10, 25, 66, 43, 47, 56, 6, 39, ... + 11, 39, 26, 35, 25, 14, 24, 17]'; + + [P,ATAB,STATS] = anovan(y, g, "display", "off"); + fitted = STATS.X * STATS.coeffs(:,1); # fitted values + b = polyfit (fitted, abs (STATS.resid), 1); + v = polyval (b, fitted); # Variance as a function of the fitted values + [P,ATAB,STATS] = anovan (y, g, "weights", v.^-1, "display", "off"); + [C, M] = multcompare (STATS, "display", "on", "ctype", "mvt") +***** demo + + ## Demonstration of p-value adjustments to control the false discovery rate + ## Data from Westfall (1997) JASA. 92(437):299-306 + + p = [.005708; .023544; .024193; .044895; ... + .048805; .221227; .395867; .693051; .775755]; + + padj = multcompare(p,'ctype','fdr') ***** test - a = 1:5; - b = 6:10; - b(5) = NaN; - [h,p,ci,stats] = ttest2 (a,b); - assert (h, 1); - assert (p, 0.002535996080258229, 1e-14); - assert (ci, [-6.822014919225481, -2.17798508077452], 1e-14); - assert (stats.tstat, -4.582575694955839, 1e-14); - assert (stats.df, 7); - assert (stats.sd, 1.4638501094228, 1e-13); -***** error ttest2 ([8:0.1:12], [8:0.1:12], "tail", "invalid"); -***** error ttest2 ([8:0.1:12], [8:0.1:12], "tail", 25); -3 tests, 3 passed, 0 known failure, 0 skipped -[inst/vartest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/vartest.m -***** error vartest (); -***** error vartest ([1, 2, 3, 4], -0.5); -***** error ... - vartest ([1, 2, 3, 4], 1, "alpha", 0); -***** error ... - vartest ([1, 2, 3, 4], 1, "alpha", 1.2); -***** error ... - vartest ([1, 2, 3, 4], 1, "alpha", "val"); -***** error ... - vartest ([1, 2, 3, 4], 1, "tail", "val"); -***** error ... - vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail", "val"); -***** error ... - vartest ([1, 2, 3, 4], 1, "dim", 3); -***** error ... - vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail", "both", "dim", 3); -***** error ... - vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail", "both", "badoption", 3); -***** error ... - vartest ([1, 2, 3, 4], 1, "alpha", 0.01, "tail"); + + ## Tests using unbalanced one-way ANOVA example from anovan and anova1 + + ## Test for anovan - compare pairwise comparisons with matlab for CTYPE "lsd" + + dv = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... + 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... + 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... + 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... + 25.694 ]'; + g = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 ... + 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; + + [P, ATAB, STATS] = anovan (dv, g, "varnames", "score", "display", "off"); + [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "lsd", ... + "display", "off"); + assert (C(1,6), 2.85812420217898e-05, 1e-09); + assert (C(2,6), 5.22936741204085e-07, 1e-09); + assert (C(3,6), 2.12794763209146e-08, 1e-09); + assert (C(4,6), 7.82091664406946e-15, 1e-09); + assert (C(5,6), 0.546591417210693, 1e-09); + assert (C(6,6), 0.0845897945254446, 1e-09); + assert (C(7,6), 9.47436557975328e-08, 1e-09); + assert (C(8,6), 0.188873478781067, 1e-09); + assert (C(9,6), 4.08974010364197e-08, 1e-09); + assert (C(10,6), 4.44427348175241e-06, 1e-09); + assert (M(1,1), 10, 1e-09); + assert (M(2,1), 18, 1e-09); + assert (M(3,1), 19, 1e-09); + assert (M(4,1), 21.0001428571429, 1e-09); + assert (M(5,1), 29.0001111111111, 1e-09); + assert (M(1,2), 1.0177537954095, 1e-09); + assert (M(2,2), 1.28736803631001, 1e-09); + assert (M(3,2), 1.0177537954095, 1e-09); + assert (M(4,2), 1.0880245732889, 1e-09); + assert (M(5,2), 0.959547480416536, 1e-09); + + ## Compare "fdr" adjusted p-values to those obtained using p.adjust in R + + [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "fdr", ... + "display", "off"); + assert (C(1,6), 4.08303457454140e-05, 1e-09); + assert (C(2,6), 1.04587348240817e-06, 1e-09); + assert (C(3,6), 1.06397381604573e-07, 1e-09); + assert (C(4,6), 7.82091664406946e-14, 1e-09); + assert (C(5,6), 5.46591417210693e-01, 1e-09); + assert (C(6,6), 1.05737243156806e-01, 1e-09); + assert (C(7,6), 2.36859139493832e-07, 1e-09); + assert (C(8,6), 2.09859420867852e-01, 1e-09); + assert (C(9,6), 1.36324670121399e-07, 1e-09); + assert (C(10,6), 7.40712246958735e-06, 1e-09); + + ## Compare "hochberg" adjusted p-values to those obtained using p.adjust in R + + [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "hochberg", ... + "display", "off"); + assert (C(1,6), 1.14324968087159e-04, 1e-09); + assert (C(2,6), 3.13762044722451e-06, 1e-09); + assert (C(3,6), 1.91515286888231e-07, 1e-09); + assert (C(4,6), 7.82091664406946e-14, 1e-09); + assert (C(5,6), 5.46591417210693e-01, 1e-09); + assert (C(6,6), 2.53769383576334e-01, 1e-09); + assert (C(7,6), 6.63205590582730e-07, 1e-09); + assert (C(8,6), 3.77746957562134e-01, 1e-09); + assert (C(9,6), 3.27179208291358e-07, 1e-09); + assert (C(10,6), 2.22213674087620e-05, 1e-09); + + ## Compare "holm" adjusted p-values to those obtained using p.adjust in R + + [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "holm", ... + "display", "off"); + assert (C(1,6), 1.14324968087159e-04, 1e-09); + assert (C(2,6), 3.13762044722451e-06, 1e-09); + assert (C(3,6), 1.91515286888231e-07, 1e-09); + assert (C(4,6), 7.82091664406946e-14, 1e-09); + assert (C(5,6), 5.46591417210693e-01, 1e-09); + assert (C(6,6), 2.53769383576334e-01, 1e-09); + assert (C(7,6), 6.63205590582730e-07, 1e-09); + assert (C(8,6), 3.77746957562134e-01, 1e-09); + assert (C(9,6), 3.27179208291358e-07, 1e-09); + assert (C(10,6), 2.22213674087620e-05, 1e-09); + + ## Compare "scheffe" adjusted p-values to those obtained using 'scheffe' in Matlab + + [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "scheffe", ... + "display", "off"); + assert (C(1,6), 0.00108105386141085, 1e-09); + assert (C(2,6), 2.7779386789517e-05, 1e-09); + assert (C(3,6), 1.3599854038198e-06, 1e-09); + assert (C(4,6), 7.58830197867751e-13, 1e-09); + assert (C(5,6), 0.984039948220281, 1e-09); + assert (C(6,6), 0.539077018557706, 1e-09); + assert (C(7,6), 5.59475764460574e-06, 1e-09); + assert (C(8,6), 0.771173490574105, 1e-09); + assert (C(9,6), 2.52838425729905e-06, 1e-09); + assert (C(10,6), 0.000200719143889168, 1e-09); + + ## Compare "bonferroni" adjusted p-values to those obtained using p.adjust in R + + [C, M, H, GNAMES] = multcompare (STATS, "dim", 1, "ctype", "bonferroni", ... + "display", "off"); + assert (C(1,6), 2.85812420217898e-04, 1e-09); + assert (C(2,6), 5.22936741204085e-06, 1e-09); + assert (C(3,6), 2.12794763209146e-07, 1e-09); + assert (C(4,6), 7.82091664406946e-14, 1e-09); + assert (C(5,6), 1.00000000000000e+00, 1e-09); + assert (C(6,6), 8.45897945254446e-01, 1e-09); + assert (C(7,6), 9.47436557975328e-07, 1e-09); + assert (C(8,6), 1.00000000000000e+00, 1e-09); + assert (C(9,6), 4.08974010364197e-07, 1e-09); + assert (C(10,6), 4.44427348175241e-05, 1e-09); + + ## Test for anova1 ("equal")- comparison of results from Matlab + + [P, ATAB, STATS] = anova1 (dv, g, "off", "equal"); + [C, M, H, GNAMES] = multcompare (STATS, "ctype", "lsd", "display", "off"); + assert (C(1,6), 2.85812420217898e-05, 1e-09); + assert (C(2,6), 5.22936741204085e-07, 1e-09); + assert (C(3,6), 2.12794763209146e-08, 1e-09); + assert (C(4,6), 7.82091664406946e-15, 1e-09); + assert (C(5,6), 0.546591417210693, 1e-09); + assert (C(6,6), 0.0845897945254446, 1e-09); + assert (C(7,6), 9.47436557975328e-08, 1e-09); + assert (C(8,6), 0.188873478781067, 1e-09); + assert (C(9,6), 4.08974010364197e-08, 1e-09); + assert (C(10,6), 4.44427348175241e-06, 1e-09); + assert (M(1,1), 10, 1e-09); + assert (M(2,1), 18, 1e-09); + assert (M(3,1), 19, 1e-09); + assert (M(4,1), 21.0001428571429, 1e-09); + assert (M(5,1), 29.0001111111111, 1e-09); + assert (M(1,2), 1.0177537954095, 1e-09); + assert (M(2,2), 1.28736803631001, 1e-09); + assert (M(3,2), 1.0177537954095, 1e-09); + assert (M(4,2), 1.0880245732889, 1e-09); + assert (M(5,2), 0.959547480416536, 1e-09); + + ## Test for anova1 ("unequal") - comparison with results from GraphPad Prism 8 + [P, ATAB, STATS] = anova1 (dv, g, "off", "unequal"); + [C, M, H, GNAMES] = multcompare (STATS, "ctype", "lsd", "display", "off"); + assert (C(1,6), 0.001247025266382, 1e-09); + assert (C(2,6), 0.000018037115146, 1e-09); + assert (C(3,6), 0.000002974595187, 1e-09); + assert (C(4,6), 0.000000000786046, 1e-09); + assert (C(5,6), 0.5693192886650109, 1e-09); + assert (C(6,6), 0.110501699029776, 1e-09); + assert (C(7,6), 0.000131226488700, 1e-09); + assert (C(8,6), 0.1912101409715992, 1e-09); + assert (C(9,6), 0.000005385256394, 1e-09); + assert (C(10,6), 0.000074089106171, 1e-09); ***** test - load carsmall - [h, pval, ci] = vartest (MPG, 7^2); - assert (h, 1); - assert (pval, 0.04335086742174443, 1e-14); - assert (ci, [49.397; 88.039], 1e-3); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/friedman.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/friedman.m -***** demo - load popcorn; - friedman (popcorn, 3); -***** demo - load popcorn; - [p, atab] = friedman (popcorn, 3, "off"); - disp (p); -***** test - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - [p, atab] = friedman (popcorn, 3, "off"); - assert (p, 0.001028853354594794, 1e-14); - assert (atab{2,2}, 99.75, 1e-14); - assert (atab{2,3}, 2, 0); - assert (atab{2,4}, 49.875, 1e-14); - assert (atab{2,5}, 13.75862068965517, 1e-14); - assert (atab{2,6}, 0.001028853354594794, 1e-14); - assert (atab{3,2}, 0.08333333333333215, 1e-14); - assert (atab{3,4}, 0.04166666666666607, 1e-14); - assert (atab{4,3}, 12, 0); -***** test - popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... - 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; - [p, atab, stats] = friedman (popcorn, 3, "off"); - assert (atab{5,2}, 116, 0); - assert (atab{5,3}, 17, 0); - assert (stats.source, "friedman"); - assert (stats.n, 2); - assert (stats.meanranks, [8, 4.75, 2.25], 0); - assert (stats.sigma, 2.692582403567252, 1e-14); -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/fstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/fstat.m + + ## Test for anova2 ("interaction") - comparison with results from Matlab for column effect + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + [P, ATAB, STATS] = anova2 (popcorn, 3, "off"); + [C, M, H, GNAMES] = multcompare (STATS, "estimate", "column",... + "ctype", "lsd", "display", "off"); + assert (C(1,6), 1.49311100811177e-05, 1e-09); + assert (C(2,6), 2.20506904243535e-07, 1e-09); + assert (C(3,6), 0.00449897860490058, 1e-09); + assert (M(1,1), 6.25, 1e-09); + assert (M(2,1), 4.75, 1e-09); + assert (M(3,1), 4, 1e-09); + assert (M(1,2), 0.152145154862547, 1e-09); + assert (M(2,2), 0.152145154862547, 1e-09); + assert (M(3,2), 0.152145154862547, 1e-09); ***** 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 for anova2 ("linear") - comparison with results from GraphPad Prism 8 + words = [10 13 13; 6 8 8; 11 14 14; 22 23 25; 16 18 20; ... + 15 17 17; 1 1 4; 12 15 17; 9 12 12; 8 9 12]; + [P, ATAB, STATS] = anova2 (words, 1, "off", "linear"); + [C, M, H, GNAMES] = multcompare (STATS, "estimate", "column",... + "ctype", "lsd", "display", "off"); + assert (C(1,6), 0.000020799832702, 1e-09); + assert (C(2,6), 0.000000035812410, 1e-09); + assert (C(3,6), 0.003038942449215, 1e-09); ***** 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/poisstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/poisstat.m + + ## Test for anova2 ("nested") - comparison with results from GraphPad Prism 8 + data = [4.5924 7.3809 21.322; -0.5488 9.2085 25.0426; ... + 6.1605 13.1147 22.66; 2.3374 15.2654 24.1283; ... + 5.1873 12.4188 16.5927; 3.3579 14.3951 10.2129; ... + 6.3092 8.5986 9.8934; 3.2831 3.4945 10.0203]; + [P, ATAB, STATS] = anova2 (data, 4, "off", "nested"); + [C, M, H, GNAMES] = multcompare (STATS, "estimate", "column",... + "ctype", "lsd", "display", "off"); + assert (C(1,6), 0.261031111511073, 1e-09); + assert (C(2,6), 0.065879755907745, 1e-09); + assert (C(3,6), 0.241874613529270, 1e-09); +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); ***** 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/runstest.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/runstest.m + set (0, "DefaultFigureVisible", "off"); + + ## Test for kruskalwallis - comparison with results from MATLAB + data = [3,2,4; 5,4,4; 4,2,4; 4,2,4; 4,1,5; ... + 4,2,3; 4,3,5; 4,2,4; 5,2,4; 5,3,3]; + group = [1:3] .* ones (10,3); + [P, ATAB, STATS] = kruskalwallis (data(:), group(:), "off"); + C = multcompare (STATS, "ctype", "lsd", "display", "off"); + assert (C(1,6), 0.000163089828959986, 1e-09); + assert (C(2,6), 0.630298044801257, 1e-09); + assert (C(3,6), 0.00100567660695682, 1e-09); + C = multcompare (STATS, "ctype", "bonferroni", "display", "off"); + assert (C(1,6), 0.000489269486879958, 1e-09); + assert (C(2,6), 1, 1e-09); + assert (C(3,6), 0.00301702982087047, 1e-09); + C = multcompare(STATS, "ctype", "scheffe", "display", "off"); + assert (C(1,6), 0.000819054880289573, 1e-09); + assert (C(2,6), 0.890628039849261, 1e-09); + assert (C(3,6), 0.00447816059021654, 1e-09); + set (0, "DefaultFigureVisible", visibility_setting); ***** test - ## NIST beam deflection data - ## http://www.itl.nist.gov/div898/handbook/eda/section4/eda425.htm - 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]; - [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/confusionmat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/confusionmat.m + set (0, "DefaultFigureVisible", "off"); + ## Test for friedman - comparison with results from MATLAB + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + [P, ATAB, STATS] = friedman (popcorn, 3, "off"); + C = multcompare(STATS, "ctype", "lsd", "display", "off"); + assert (C(1,6), 0.227424558028569, 1e-09); + assert (C(2,6), 0.0327204848315735, 1e-09); + assert (C(3,6), 0.353160353315988, 1e-09); + C = multcompare(STATS, "ctype", "bonferroni", "display", "off"); + assert (C(1,6), 0.682273674085708, 1e-09); + assert (C(2,6), 0.0981614544947206, 1e-09); + assert (C(3,6), 1, 1e-09); + C = multcompare(STATS, "ctype", "scheffe", "display", "off"); + assert (C(1,6), 0.482657360384373, 1e-09); + assert (C(2,6), 0.102266573027672, 1e-09); + assert (C(3,6), 0.649836502233148, 1e-09); + set (0, "DefaultFigureVisible", visibility_setting); ***** test - Yt = [8 5 6 8 5 3 1 6 4 2 5 3 1 4]'; - Yp = [8 5 6 8 5 2 3 4 4 5 5 7 2 6]'; - C = [0 1 1 0 0 0 0 0; 0 0 0 0 1 0 0 0; 0 1 0 0 0 0 1 0; 0 0 0 1 0 1 0 0; ... - 0 0 0 0 3 0 0 0; 0 0 0 1 0 1 0 0; 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 2]; - assert (confusionmat (Yt, Yp), C) + set (0, "DefaultFigureVisible", "off"); + ## Test for fitlm - same comparisons as for first anovan example + y = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... + 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... + 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... + 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... + 25.694 ]'; + X = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; + [TAB,STATS] = fitlm (X,y,"linear","categorical",1,"display","off"); + [C, M] = multcompare(STATS, "ctype", "lsd", "display", "off"); + assert (C(1,6), 2.85812420217898e-05, 1e-09); + assert (C(2,6), 5.22936741204085e-07, 1e-09); + assert (C(3,6), 2.12794763209146e-08, 1e-09); + assert (C(4,6), 7.82091664406946e-15, 1e-09); + assert (C(5,6), 0.546591417210693, 1e-09); + assert (C(6,6), 0.0845897945254446, 1e-09); + assert (C(7,6), 9.47436557975328e-08, 1e-09); + assert (C(8,6), 0.188873478781067, 1e-09); + assert (C(9,6), 4.08974010364197e-08, 1e-09); + assert (C(10,6), 4.44427348175241e-06, 1e-09); + assert (M(1,1), 10, 1e-09); + assert (M(2,1), 18, 1e-09); + assert (M(3,1), 19, 1e-09); + assert (M(4,1), 21.0001428571429, 1e-09); + assert (M(5,1), 29.0001111111111, 1e-09); + assert (M(1,2), 1.0177537954095, 1e-09); + assert (M(2,2), 1.28736803631001, 1e-09); + assert (M(3,2), 1.0177537954095, 1e-09); + assert (M(4,2), 1.0880245732889, 1e-09); + assert (M(5,2), 0.959547480416536, 1e-09); + set (0, "DefaultFigureVisible", visibility_setting); +***** test + ## Test p-value adjustments compared to R stats package function p.adjust + ## Data from Westfall (1997) JASA. 92(437):299-306 + p = [.005708; .023544; .024193; .044895; ... + .048805; .221227; .395867; .693051; .775755]; + padj = multcompare (p); + assert (padj(1), 0.051372, 1e-06); + assert (padj(2), 0.188352, 1e-06); + assert (padj(3), 0.188352, 1e-06); + assert (padj(4), 0.269370, 1e-06); + assert (padj(5), 0.269370, 1e-06); + assert (padj(6), 0.884908, 1e-06); + assert (padj(7), 1.000000, 1e-06); + assert (padj(8), 1.000000, 1e-06); + assert (padj(9), 1.000000, 1e-06); + padj = multcompare(p,'ctype','holm'); + assert (padj(1), 0.051372, 1e-06); + assert (padj(2), 0.188352, 1e-06); + assert (padj(3), 0.188352, 1e-06); + assert (padj(4), 0.269370, 1e-06); + assert (padj(5), 0.269370, 1e-06); + assert (padj(6), 0.884908, 1e-06); + assert (padj(7), 1.000000, 1e-06); + assert (padj(8), 1.000000, 1e-06); + assert (padj(9), 1.000000, 1e-06); + padj = multcompare(p,'ctype','hochberg'); + assert (padj(1), 0.051372, 1e-06); + assert (padj(2), 0.169351, 1e-06); + assert (padj(3), 0.169351, 1e-06); + assert (padj(4), 0.244025, 1e-06); + assert (padj(5), 0.244025, 1e-06); + assert (padj(6), 0.775755, 1e-06); + assert (padj(7), 0.775755, 1e-06); + assert (padj(8), 0.775755, 1e-06); + assert (padj(9), 0.775755, 1e-06); + padj = multcompare(p,'ctype','fdr'); + assert (padj(1), 0.0513720, 1e-07); + assert (padj(2), 0.0725790, 1e-07); + assert (padj(3), 0.0725790, 1e-07); + assert (padj(4), 0.0878490, 1e-07); + assert (padj(5), 0.0878490, 1e-07); + assert (padj(6), 0.3318405, 1e-07); + assert (padj(7), 0.5089719, 1e-07); + assert (padj(8), 0.7757550, 1e-07); + assert (padj(9), 0.7757550, 1e-07); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/fitlm.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/fitlm.m +***** demo + y = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... + 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... + 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... + 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... + 25.694 ]'; + X = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; + + [TAB,STATS] = fitlm (X,y,"linear","CategoricalVars",1,"display","on"); +***** demo + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + brands = {'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'}; + popper = {'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; ... + 'air', 'air', 'air'; 'air', 'air', 'air'; 'air', 'air', 'air'}; + + [TAB, STATS] = fitlm ({brands(:),popper(:)},popcorn(:),"interactions",... + "CategoricalVars",[1,2],"display","on"); +***** test + y = [ 8.706 10.362 11.552 6.941 10.983 10.092 6.421 14.943 15.931 ... + 22.968 18.590 16.567 15.944 21.637 14.492 17.965 18.851 22.891 ... + 22.028 16.884 17.252 18.325 25.435 19.141 21.238 22.196 18.038 ... + 22.628 31.163 26.053 24.419 32.145 28.966 30.207 29.142 33.212 ... + 25.694 ]'; + X = [1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5]'; + [TAB,STATS] = fitlm (X,y,"continuous",[],"display","off"); + [TAB,STATS] = fitlm (X,y,"CategoricalVars",1,"display","off"); + [TAB,STATS] = fitlm (X,y,"constant","categorical",1,"display","off"); + [TAB,STATS] = fitlm (X,y,"linear","categorical",1,"display","off"); + [TAB,STATS] = fitlm (X,y,[0,0;1,0],"categorical",1,"display","off"); + assert (TAB{2,2}, 10, 1e-04); + assert (TAB{3,2}, 7.99999999999999, 1e-09); + assert (TAB{4,2}, 8.99999999999999, 1e-09); + assert (TAB{5,2}, 11.0001428571429, 1e-09); + assert (TAB{6,2}, 19.0001111111111, 1e-09); + assert (TAB{2,3}, 1.01775379540949, 1e-09); + assert (TAB{3,3}, 1.64107868458008, 1e-09); + assert (TAB{4,3}, 1.43932122062479, 1e-09); + assert (TAB{5,3}, 1.48983900477565, 1e-09); + assert (TAB{6,3}, 1.3987687997822, 1e-09); + assert (TAB{2,6}, 9.82555903510687, 1e-09); + assert (TAB{3,6}, 4.87484242844031, 1e-09); + assert (TAB{4,6}, 6.25294748040552, 1e-09); + assert (TAB{5,6}, 7.38344399756088, 1e-09); + assert (TAB{6,6}, 13.5834536158296, 1e-09); + assert (TAB{3,7}, 2.85812420217862e-05, 1e-12); + assert (TAB{4,7}, 5.22936741204002e-07, 1e-06); + assert (TAB{5,7}, 2.12794763209106e-08, 1e-07); + assert (TAB{6,7}, 7.82091664406755e-15, 1e-08); +***** test + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + brands = bsxfun (@times, ones(6,1), [1,2,3]); + popper = bsxfun (@times, [1;1;1;2;2;2], ones(1,3)); + + [TAB, STATS] = fitlm ({brands(:),popper(:)},popcorn(:),"interactions",... + "categoricalvars",[1,2],"display","off"); + assert (TAB{2,2}, 5.66666666666667, 1e-09); + assert (TAB{3,2}, -1.33333333333333, 1e-09); + assert (TAB{4,2}, -2.16666666666667, 1e-09); + assert (TAB{5,2}, 1.16666666666667, 1e-09); + assert (TAB{6,2}, -0.333333333333334, 1e-09); + assert (TAB{7,2}, -0.166666666666667, 1e-09); + assert (TAB{2,3}, 0.215165741455965, 1e-09); + assert (TAB{3,3}, 0.304290309725089, 1e-09); + assert (TAB{4,3}, 0.304290309725089, 1e-09); + assert (TAB{5,3}, 0.304290309725089, 1e-09); + assert (TAB{6,3}, 0.43033148291193, 1e-09); + assert (TAB{7,3}, 0.43033148291193, 1e-09); + assert (TAB{2,6}, 26.3362867542108, 1e-09); + assert (TAB{3,6}, -4.38178046004138, 1e-09); + assert (TAB{4,6}, -7.12039324756724, 1e-09); + assert (TAB{5,6}, 3.83405790253621, 1e-09); + assert (TAB{6,6}, -0.774596669241495, 1e-09); + assert (TAB{7,6}, -0.387298334620748, 1e-09); + assert (TAB{2,7}, 5.49841502258254e-12, 1e-09); + assert (TAB{3,7}, 0.000893505495903642, 1e-09); + assert (TAB{4,7}, 1.21291454302428e-05, 1e-09); + assert (TAB{5,7}, 0.00237798044119407, 1e-09); + assert (TAB{6,7}, 0.453570536021938, 1e-09); + assert (TAB{7,7}, 0.705316781644046, 1e-09); + ## Test with string ids for categorical variables + brands = {'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'; ... + 'Gourmet', 'National', 'Generic'}; + popper = {'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; 'oil', 'oil', 'oil'; ... + 'air', 'air', 'air'; 'air', 'air', 'air'; 'air', 'air', 'air'}; + [TAB, STATS] = fitlm ({brands(:),popper(:)},popcorn(:),"interactions",... + "categoricalvars",[1,2],"display","off"); +***** test + load carsmall + X = [Weight,Horsepower,Acceleration]; + [TAB, STATS] = fitlm (X, MPG,"constant","display","off"); + [TAB, STATS] = fitlm (X, MPG,"linear","display","off"); + assert (TAB{2,2}, 47.9767628118615, 1e-09); + assert (TAB{3,2}, -0.00654155878851796, 1e-09); + assert (TAB{4,2}, -0.0429433065881864, 1e-09); + assert (TAB{5,2}, -0.0115826516894871, 1e-09); + assert (TAB{2,3}, 3.87851641748551, 1e-09); + assert (TAB{3,3}, 0.00112741016370336, 1e-09); + assert (TAB{4,3}, 0.0243130608813806, 1e-09); + assert (TAB{5,3}, 0.193325043113178, 1e-09); + assert (TAB{2,6}, 12.369874881944, 1e-09); + assert (TAB{3,6}, -5.80228828790225, 1e-09); + assert (TAB{4,6}, -1.76626492228599, 1e-09); + assert (TAB{5,6}, -0.0599128364487485, 1e-09); + assert (TAB{2,7}, 4.89570341688996e-21, 1e-09); + assert (TAB{3,7}, 9.87424814144e-08, 1e-09); + assert (TAB{4,7}, 0.0807803098213114, 1e-09); + assert (TAB{5,7}, 0.952359384151778, 1e-09); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/cholcov.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cholcov.m +***** demo + C1 = [2, 1, 1, 2; 1, 2, 1, 2; 1, 1, 2, 2; 2, 2, 2, 3] + T = cholcov (C1) + C2 = T'*T +***** test + C1 = [2, 1, 1, 2; 1, 2, 1, 2; 1, 1, 2, 2; 2, 2, 2, 3]; + T = cholcov (C1); + assert (C1, T'*T, 1e-15 * ones (size (C1))); 1 test, 1 passed, 0 known failure, 0 skipped -[inst/binostat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/binostat.m +[inst/hmmgenerate.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hmmgenerate.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); - assert (v, expected_v, 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 - 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); + 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/datasample.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/datasample.m +***** error datasample(); +***** error datasample(1); +***** error datasample({1, 2, 3}, 1); +***** error datasample([1 2], -1); +***** error datasample([1 2], 1.5); +***** error datasample([1 2], [1 1]); +***** error datasample([1 2], 'g', [1 1]); +***** error datasample([1 2], 1, -1); +***** error datasample([1 2], 1, 1.5); +***** error datasample([1 2], 1, [1 1]); +***** error datasample([1 2], 1, 1, "Replace", -2); +***** error datasample([1 2], 1, 1, "Weights", "abc"); +***** error datasample([1 2], 1, 1, "Weights", [1 -2 3]); +***** error datasample([1 2], 1, 1, "Weights", ones (2)); +***** error datasample([1 2], 1, 1, "Weights", [1 2 3]); ***** 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/ppplot.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ppplot.m -***** error ppplot () -***** error ppplot (ones (2,2)) -***** error ppplot (1, 2) -***** error ppplot ([1 2 3 4], 2) + dat = randn (10, 4); + assert (size (datasample (dat, 3, 1)), [3 4]); +***** test + dat = randn (10, 4); + assert (size (datasample (dat, 3, 2)), [10 3]); +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/violin.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/violin.m +***** demo + clf + x = zeros (9e2, 10); + for i=1:10 + x(:,i) = (0.1 * randn (3e2, 3) * (randn (3,1) + 1) + 2 * randn (1,3))(:); + endfor + h = violin (x, "color", "c"); + axis tight + set (h.violin, "linewidth", 2); + set (gca, "xgrid", "on"); + xlabel ("Variables") + ylabel ("Values") +***** demo + clf + data = {randn(100,1)*5+140, randn(130,1)*8+135}; + subplot (1,2,1) + title ("Grade 3 heights - vertical"); + set (gca, "xtick", 1:2, "xticklabel", {"girls"; "boys"}); + violin (data, "Nbins", 10); + axis tight + + subplot(1,2,2) + title ("Grade 3 heights - horizontal"); + set (gca, "ytick", 1:2, "yticklabel", {"girls"; "boys"}); + violin (data, "horizontal", "Nbins", 10); + axis tight +***** demo + clf + data = exprnd (0.1, 500,4); + violin (data, "nbins", {5,10,50,100}); + axis ([0 5 0 max(data(:))]) +***** demo + clf + data = exprnd (0.1, 500,4); + violin (data, "color", jet(4)); + axis ([0 5 0 max(data(:))]) +***** demo + clf + data = repmat(exprnd (0.1, 500,1), 1, 4); + violin (data, "width", linspace (0.1,0.5,4)); + axis ([0 5 0 max(data(:))]) +***** demo + clf + data = repmat(exprnd (0.1, 500,1), 1, 4); + violin (data, "nbins", [5,10,50,100], "smoothfactor", [4 4 8 10]); + axis ([0 5 0 max(data(:))]) ***** shared visibility_setting visibility_setting = get (0, "DefaultFigureVisible"); ***** test set (0, "DefaultFigureVisible", "off"); - ppplot ([2 3 3 4 4 5 6 5 6 7 8 9 8 7 8 9 0 8 7 6 5 4 6 13 8 15 9 9]); + data = exprnd (0.1, 500,4); + violin (data, "color", jet(4)); + axis ([0 5 0 max(data(:))]) set (0, "DefaultFigureVisible", visibility_setting); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/hotelling_t2test2.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hotelling_t2test2.m -***** error hotelling_t2test2 (); -***** error ... - hotelling_t2test2 ([2, 3, 4, 5, 6]); -***** error ... - hotelling_t2test2 (1, [2, 3, 4, 5, 6]); -***** error ... - hotelling_t2test2 (ones (2,2,2), [2, 3, 4, 5, 6]); -***** error ... - hotelling_t2test2 ([2, 3, 4, 5, 6], 2); -***** error ... - hotelling_t2test2 ([2, 3, 4, 5, 6], ones (2,2,2)); -***** error ... - hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", 1); -***** error ... - hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", -0.2); -***** error ... - hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", "a"); -***** error ... - hotelling_t2test2 (ones (20,2), ones (20,2), "alpha", [0.01, 0.05]); -***** error ... - hotelling_t2test2 (ones (20,2), ones (20,2), "name", 0.01); -***** error ... - hotelling_t2test2 (ones (20,1), ones (20,2)); -***** error ... - hotelling_t2test2 (ones (20,2), ones (25,3)); +warning: Non-positive limit for logarithmic axis ignored ***** test - [h, pval, stats] = hotelling_t2test2 (randn(5000,5), randn(3000,5)); - assert (h, 0); - assert (stats.df1, 5); - assert (stats.df2, 7994); -14 tests, 14 passed, 0 known failure, 0 skipped -[inst/cdfcalc.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cdfcalc.m + set (0, "DefaultFigureVisible", "off"); + data = {randn(100,1)*5+140, randn(130,1)*8+135}; + subplot (1,2,1) + title ("Grade 3 heights - vertical"); + set (gca, "xtick", 1:2, "xticklabel", {"girls"; "boys"}); + violin (data, "Nbins", 10); + axis tight + set (0, "DefaultFigureVisible", visibility_setting); ***** test - x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4]; - [yCDF, xCDF, n, emsg, eid] = cdfcalc (x); - assert (yCDF, [0, 0.3, 0.5, 0.8, 0.9, 1]'); - assert (xCDF, [2, 3, 4, 5, 6]'); - assert (n, 10); -***** shared x - x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4]; -***** error yCDF = cdfcalc (x); -***** error [yCDF, xCDF] = cdfcalc (); -***** error [yCDF, xCDF] = cdfcalc (x, x); -***** warning [yCDF, xCDF] = cdfcalc (ones(10,2)); + set (0, "DefaultFigureVisible", "off"); + data = {randn(100,1)*5+140, randn(130,1)*8+135}; + subplot (1,2,1) + title ("Grade 3 heights - vertical"); + set (gca, "xtick", 1:2, "xticklabel", {"girls"; "boys"}); + violin (data, "Nbins", 10); + axis tight + subplot(1,2,2) + title ("Grade 3 heights - horizontal"); + set (gca, "ytick", 1:2, "yticklabel", {"girls"; "boys"}); + violin (data, "horizontal", "Nbins", 10); + axis tight + set (0, "DefaultFigureVisible", visibility_setting); +***** test + set (0, "DefaultFigureVisible", "off"); + data = repmat(exprnd (0.1, 500,1), 1, 4); + violin (data, "nbins", [5,10,50,100], "smoothfactor", [4 4 8 10]); + axis ([0 5 0 max(data(:))]) + set (0, "DefaultFigureVisible", visibility_setting); +***** test + set (0, "DefaultFigureVisible", "off"); + data = repmat(exprnd (0.1, 500,1), 1, 4); + violin (data, "width", linspace (0.1,0.5,4)); + axis ([0 5 0 max(data(:))]) + set (0, "DefaultFigureVisible", visibility_setting); 5 tests, 5 passed, 0 known failure, 0 skipped +[inst/randsample.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/crosstab.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/crosstab.m +***** error crosstab () +***** error crosstab (1) +***** error crosstab (ones (2), [1 1]) +***** error crosstab ([1 1], ones (2)) +***** error crosstab ([1], [1 2]) +***** error crosstab ([1 2], [1]) +***** test + load carbig + [table, chisq, p, labels] = crosstab (cyl4, when, org); + assert (table(2,3,1), 38); + assert (labels{3,3}, "Japan"); +***** test + load carbig + [table, chisq, p, labels] = crosstab (cyl4, when, org); + assert (table(2,3,2), 17); + assert (labels{1,3}, "USA"); +8 tests, 8 passed, 0 known failure, 0 skipped +[inst/linkage.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/linkage.m +***** shared x, t + x = reshape (mod (magic (6),5), [], 3); + t = 1e-6; +***** assert (cond (linkage (pdist (x))), 34.119045, t); +***** assert (cond (linkage (pdist (x), "complete")), 21.793345, t); +***** assert (cond (linkage (pdist (x), "average")), 27.045012, t); +***** assert (cond (linkage (pdist (x), "weighted")), 27.412889, t); + lastwarn(); # Clear last warning before the test +***** warning linkage (pdist (x), "centroid"); +***** test + warning off Octave:clustering + assert (cond (linkage (pdist (x), "centroid")), 27.457477, t); + warning on Octave:clustering +***** warning linkage (pdist (x), "median"); +***** test + warning off Octave:clustering + assert (cond (linkage (pdist (x), "median")), 27.683325, t); + warning on Octave:clustering +***** 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/rmmissing.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/rmmissing.m ***** assert (rmmissing ([1,NaN,3]), [1,3]) @@ -14152,6 +11986,1434 @@ ***** error <'MinNumMissing'> rmmissing ([1 2; 3 4], "MinNumMissing", [1 2 3]) ***** error <'MinNumMissing'> rmmissing ([1 2; 3 4], "MinNumMissing", 'xxx') 31 tests, 31 passed, 0 known failure, 0 skipped +[inst/crossval.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/crossval.m +***** test + load fisheriris + y = meas(:, 1); + X = [ones(size(y)) meas(:, 2:4)]; + 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', grp2idx(species)); + + assert (results0, results1); + assert (results2, results3); + assert (size(results4), [1 numel(y)]); + assert (mean(results4), 0.1018, 1e-4); + assert (size(results5), [mcreps 1]); +warning: strmatch is obsolete; use strncmp or strcmp instead +1 test, 1 passed, 0 known failure, 0 skipped +[inst/sampsizepwr.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/sampsizepwr.m +***** demo + ## Compute the mean closest to 100 that can be determined to be + ## significantly different from 100 using a t-test with a sample size + ## of 60 and a power of 0.8. + mu1 = sampsizepwr ("t", [100, 10], [], 0.8, 60); + disp (mu1); +***** demo + ## Compute the sample sizes required to distinguish mu0 = 100 from + ## mu1 = 110 by a two-sample t-test with a ratio of the larger and the + ## smaller sample sizes of 1.5 and a power of 0.6. + [N1,N2] = sampsizepwr ("t2", [100, 10], 110, 0.6, [], "ratio", 1.5) +***** demo + ## Compute the sample size N required to distinguish p=.26 from p=.2 + ## with a binomial test. The result is approximate, so make a plot to + ## see if any smaller N values also have the required power of 0.6. + Napprox = sampsizepwr ("p", 0.2, 0.26, 0.6); + nn = 1:250; + pwr = sampsizepwr ("p", 0.2, 0.26, [], nn); + Nexact = min (nn(pwr >= 0.6)); + plot(nn,pwr,'b-', [Napprox Nexact],pwr([Napprox Nexact]),'ro'); + grid on +***** demo + ## The company must test 52 bottles to detect the difference between a mean + ## volume of 100 mL and 102 mL with a power of 0.80. Generate a power curve + ## to visualize how the sample size affects the power of the test. + + nout = sampsizepwr('t',[100 5],102,0.80); + nn = 1:100; + pwrout = sampsizepwr('t',[100 5],102,[],nn); + + figure; + plot (nn, pwrout, "b-", nout, 0.8, "ro") + title ("Power versus Sample Size") + xlabel ("Sample Size") + ylabel ("Power") +***** error ... + out = sampsizepwr ([], [100, 10], [], 0.8, 60); +***** error ... + out = sampsizepwr (3, [100, 10], [], 0.8, 60); +***** error ... + out = sampsizepwr ({"t", "t2"}, [100, 10], [], 0.8, 60); +***** error ... + out = sampsizepwr ("reg", [100, 10], [], 0.8, 60); +***** error ... + out = sampsizepwr ("t", ["a", "e"], [], 0.8, 60); +***** error ... + out = sampsizepwr ("z", 100, [], 0.8, 60); +***** error ... + out = sampsizepwr ("t", 100, [], 0.8, 60); +***** error ... + out = sampsizepwr ("t2", 60, [], 0.8, 60); +***** error ... + out = sampsizepwr ("var", [100, 10], [], 0.8, 60); +***** error ... + out = sampsizepwr ("p", [100, 10], [], 0.8, 60); +***** error ... + out = sampsizepwr ("r", [100, 10], [], 0.8, 60); +***** error ... + [out, N1] = sampsizepwr ("z", [100, 10], [], 0.8, 60); +***** error ... + [out, N1] = sampsizepwr ("t", [100, 10], [], 0.8, 60); +***** error ... + [out, N1] = sampsizepwr ("var", 2, [], 0.8, 60); +***** error ... + [out, N1] = sampsizepwr ("p", 0.1, [], 0.8, 60); +***** error ... + [out, N1] = sampsizepwr ("r", 0.5, [], 0.8, 60); +***** error ... + out = sampsizepwr ("z", [100, 0], [], 0.8, 60); +***** error ... + out = sampsizepwr ("z", [100, -5], [], 0.8, 60); +***** error ... + out = sampsizepwr ("t", [100, 0], [], 0.8, 60); +***** error ... + out = sampsizepwr ("t", [100, -5], [], 0.8, 60); +***** error ... + [out, N1] = sampsizepwr ("t2", [100, 0], [], 0.8, 60); +***** error ... + [out, N1] = sampsizepwr ("t2", [100, -5], [], 0.8, 60); +***** error ... + out = sampsizepwr ("var", 0, [], 0.8, 60); +***** error ... + out = sampsizepwr ("var", -5, [], 0.8, 60); +***** error ... + out = sampsizepwr ("p", 0, [], 0.8, 60); +***** error ... + out = sampsizepwr ("p", 1.2, [], 0.8, 60); +***** error ... + out = sampsizepwr ("r", -1.5, [], 0.8, 60); +***** error ... + out = sampsizepwr ("r", -1, [], 0.8, 60); +***** error ... + out = sampsizepwr ("r", 1.2, [], 0.8, 60); +***** error ... + out = sampsizepwr ("r", 0, [], 0.8, 60); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", -0.2); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", 0); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", 1.5); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "alpha", "zero"); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "tail", 1.5); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "tail", {"both", "left"}); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "tail", "other"); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "ratio", "some"); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "ratio", 0.5); +***** error ... + out = sampsizepwr ("r", 0.2, [], 0.8, 60, "ratio", [2, 1.3, 0.3]); +***** error ... + out = sampsizepwr ("z", [100, 5], [], [], 60); +***** error ... + out = sampsizepwr ("z", [100, 5], 110, [], []); +***** error ... + out = sampsizepwr ("z", [100, 5], [], 0.8, []); +***** error ... + out = sampsizepwr ("z", [100, 5], 110, 0.8, 60); +***** error ... + out = sampsizepwr ("z", [100, 5], "mu", [], 60); +***** error ... + out = sampsizepwr ("var", 5, -1, [], 60); +***** error ... + out = sampsizepwr ("p", 0.8, 1.2, [], 60, "tail", "right"); +***** error ... + out = sampsizepwr ("r", 0.8, 1.2, [], 60); +***** error ... + out = sampsizepwr ("r", 0.8, -1.2, [], 60); +***** error ... + out = sampsizepwr ("z", [100, 5], 110, 1.2); +***** error ... + out = sampsizepwr ("z", [100, 5], 110, 0); +***** error ... + out = sampsizepwr ("z", [100, 5], 110, 0.05, [], "alpha", 0.1); +***** error ... + out = sampsizepwr ("z", [100, 5], [], [0.8, 0.7], [60, 80, 100]); +***** error ... + out = sampsizepwr ("t", [100, 5], 100, 0.8, []); +***** error ... + out = sampsizepwr ("t", [100, 5], 110, 0.8, [], "tail", "left"); +***** error ... + out = sampsizepwr ("t", [100, 5], 90, 0.8, [], "tail", "right"); +***** warning ... + Napprox = sampsizepwr ("p", 0.2, 0.26, 0.6); +***** warning ... + Napprox = sampsizepwr ("p", 0.30, 0.36, 0.8); +***** test + mu1 = sampsizepwr ("t", [100, 10], [], 0.8, 60); + assert (mu1, 103.67704316, 1e-8); +***** test + [N1,N2] = sampsizepwr ("t2", [100, 10], 110, 0.6, [], "ratio", 1.5); + assert (N1, 9); + assert (N2, 14); +***** test + nn = 1:250; + pwr = sampsizepwr ("p", 0.2, 0.26, [], nn); + pwr_out = [0, 0.0676, 0.0176, 0.0566, 0.0181, 0.0431, 0.0802, 0.0322]; + assert (pwr([1:8]), pwr_out, 1e-4 * ones (1,8)); + pwr_out = [0.59275, 0.6073, 0.62166, 0.6358, 0.6497, 0.6087, 0.6229, 0.6369]; + assert (pwr([243:end]), pwr_out, 1e-4 * ones (1,8)); +***** test + nout = sampsizepwr ("t", [100, 5], 102, 0.80); + assert (nout, 52); +***** test + power = sampsizepwr ("t", [20, 5], 25, [], 5, "Tail", "right"); + assert (power, 0.5797373588621888, 1e-14); +***** test + nout = sampsizepwr ("t", [20, 5], 25, 0.99, [], "Tail", "right"); + assert (nout, 18); +***** test + p1out = sampsizepwr ("t", [20, 5], [], 0.95, 10, "Tail", "right"); + assert (p1out, 25.65317979360237, 1e-14); +***** test + pwr = sampsizepwr ("t2", [1.4, 0.2], 1.7, [], 5, "Ratio", 2); + assert (pwr, 0.716504004686586, 1e-14); +***** test + n = sampsizepwr ("t2", [1.4, 0.2], 1.7, 0.9, []); + assert (n, 11); +***** test + [n1, n2] = sampsizepwr ("t2", [1.4, 0.2], 1.7, 0.9, [], "Ratio", 2); + assert ([n1, n2], [8, 16]); +68 tests, 68 passed, 0 known failure, 0 skipped +[inst/vartest2.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/vartest2.m +***** error vartest2 (); +***** error vartest2 (ones (20,1)); +***** error ... + vartest2 (rand (20,1), 5); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "alpha", 0); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "alpha", 1.2); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "alpha", "some"); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "alpha", [0.05, 0.001]); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "tail", [0.05, 0.001]); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "tail", "some"); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "dim", 3); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "alpha", 0.001, "dim", 3); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "some", 3); +***** error ... + vartest2 (rand (20,1), rand (25,1)*2, "some"); +***** test + load carsmall + [h, pval, ci, stat] = vartest2 (MPG(Model_Year==82), MPG(Model_Year==76)); + assert (h, 0); + assert (pval, 0.6288022362718455, 1e-13); + assert (ci, [0.4139; 1.7193], 1e-4); + assert (stat.fstat, 0.8384, 1e-4); + assert (stat.df1, 30); + assert (stat.df2, 33); +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/clusterdata.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/clusterdata.m +***** error clusterdata () +***** error clusterdata (1) +***** error clusterdata ([1 1], "Bogus", 1) +***** error clusterdata ([1 1], "Depth", 1) +***** demo + X = [(randn (10, 2) * 0.25) + 1; (randn (20, 2) * 0.5) - 1]; + wnl = warning ("off", "Octave:linkage_savemem", "local"); + T = clusterdata (X, "linkage", "ward", "MaxClust", 2); + scatter (X(:,1), X(:,2), 36, T, "filled"); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/barttest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/barttest.m +***** error barttest () +***** error barttest ([2,NaN;3,4]) +***** error barttest (ones (30, 4), "alpha") +***** error barttest (ones (30, 4), 0) +***** error barttest (ones (30, 4), 1.2) +***** error barttest (ones (30, 4), [0.2, 0.05]) +***** error barttest (ones (30, 1)) +***** error barttest (ones (30, 1), 0.05) +***** test + x = [2, 3, 4, 5, 6, 7, 8, 9; 1, 2, 3, 4, 5, 6, 7, 8]'; + [ndim, pval, chisq] = barttest (x); + assert (ndim, 2); + assert (pval, 0); + ## assert (chisq, 512.0558, 1e-4); Result differs between octave 6 and 7 ? +***** test + x = [0.53767, 0.62702, -0.10224, -0.25485, 1.4193, 1.5237 ; ... + 1.8339, 1.6452, -0.24145, -0.23444, 0.29158, 0.1634 ; ... + -2.2588, -2.1351, 0.31286, 0.39396, 0.19781, 0.20995 ; ... + 0.86217, 1.0835, 0.31286, 0.46499, 1.5877, 1.495 ; ... + 0.31877, 0.38454, -0.86488, -0.63839, -0.80447, -0.7536 ; ... + -1.3077, -1.1487, -0.030051, -0.017629, 0.69662, 0.60497 ; ... + -0.43359, -0.32672, -0.16488, -0.37364, 0.83509, 0.89586 ; ... + 0.34262, 0.29639, 0.62771, 0.51672, -0.24372, -0.13698 ; ... + 3.5784, 3.5841, 1.0933, 0.93258, 0.21567, 0.455 ; ... + 2.7694, 2.6307, 1.1093, 1.4298, -1.1658, -1.1816 ; ... + -1.3499, -1.2111, -0.86365, -0.94186, -1.148, -1.4381 ; ... + 3.0349, 2.8428, 0.077359, 0.18211, 0.10487, -0.014613; ... + 0.7254, 0.56737, -1.2141, -1.2291, 0.72225, 0.90612 ; ... + -0.063055,-0.17662, -1.1135, -0.97701, 2.5855, 2.4084 ; ... + 0.71474, 0.29225, -0.0068493, -0.11468, -0.66689, -0.52466 ; ... + -0.20497, -7.8874e-06, 1.5326, 1.3195, 0.18733, 0.20296 ; ... + -0.12414, -0.077029, -0.76967, -0.96262, -0.082494, 0.121 ; ... + 1.4897, 1.3683, 0.37138, 0.43653, -1.933, -2.1903 ; ... + 1.409, 1.5882, -0.22558, -0.24835, -0.43897, -0.46247 ; ... + 1.4172, 1.1616, 1.1174, 1.0785, -1.7947, -1.9471 ]; + [ndim, pval, chisq] = barttest (x); + assert (ndim, 3); + assert (pval, [0; 0; 0; 0.52063; 0.34314], 1e-5); + chisq_out = [251.6802; 210.2670; 153.1773; 4.2026; 2.1392]; + assert (chisq, chisq_out, 1e-4); +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/normlike.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/normlike.m +***** error normlike ([12, 15]); +***** error normlike ([12, 15], ones (2)); +***** error ... + normlike ([12, 15, 3], [1:50]); +***** error ... + normlike ([12, 15], [1:50], [1, 2, 3]); +***** error ... + normlike ([12, 15], [1:50], [], [1, 2, 3]); +***** test + data = 1:50; + [nlogL, avar] = normlike ([2.3, 1.2], data); + avar_out = [7.5767e-01, -1.8850e-02; -1.8850e-02, 4.8750e-04]; + assert (nlogL, 13014.95883783327, 1e-10); + assert (avar, avar_out, 1e-4); +***** test + data = 1:50; + [nlogL, avar] = normlike ([2.3, 1.2], data * 0.5); + avar_out = [3.0501e-01, -1.5859e-02; -1.5859e-02, 9.1057e-04]; + assert (nlogL, 2854.802587833265, 1e-10); + assert (avar, avar_out, 1e-4); +***** test + data = 1:50; + [nlogL, avar] = normlike ([21, 15], data); + avar_out = [5.460474308300396, -1.600790513833993; ... + -1.600790513833993, 2.667984189723321]; + assert (nlogL, 206.738325604233, 1e-12); + assert (avar, avar_out, 1e-14); +***** test + data = 1:50; + censor = ones (1, 50); + censor([2, 4, 6, 8, 12, 14]) = 0; + [nlogL, avar] = normlike ([2.3, 1.2], data, censor); + avar_out = [3.0501e-01, -1.5859e-02; -1.5859e-02, 9.1057e-04]; + assert (nlogL, Inf); + assert (avar, [NaN, NaN; NaN, NaN]); +***** test + data = 1:50; + censor = ones (1, 50); + censor([2, 4, 6, 8, 12, 14]) = 0; + [nlogL, avar] = normlike ([21, 15], data, censor); + avar_out = [24.4824488866131, -10.6649544179636; ... + -10.6649544179636, 6.22827849965737]; + assert (nlogL, 86.9254371829733, 1e-12); + assert (avar, avar_out, 8e-14); +10 tests, 10 passed, 0 known failure, 0 skipped +[inst/friedman.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/friedman.m +***** demo + load popcorn; + friedman (popcorn, 3); +***** demo + load popcorn; + [p, atab] = friedman (popcorn, 3, "off"); + disp (p); +***** test + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + [p, atab] = friedman (popcorn, 3, "off"); + assert (p, 0.001028853354594794, 1e-14); + assert (atab{2,2}, 99.75, 1e-14); + assert (atab{2,3}, 2, 0); + assert (atab{2,4}, 49.875, 1e-14); + assert (atab{2,5}, 13.75862068965517, 1e-14); + assert (atab{2,6}, 0.001028853354594794, 1e-14); + assert (atab{3,2}, 0.08333333333333215, 1e-14); + assert (atab{3,4}, 0.04166666666666607, 1e-14); + assert (atab{4,3}, 12, 0); +***** test + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + [p, atab, stats] = friedman (popcorn, 3, "off"); + assert (atab{5,2}, 116, 0); + assert (atab{5,3}, 17, 0); + assert (stats.source, "friedman"); + assert (stats.n, 2); + assert (stats.meanranks, [8, 4.75, 2.25], 0); + assert (stats.sigma, 2.692582403567252, 1e-14); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/pca.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/pca.m +***** shared COEFF,SCORE,latent,tsquare,m,x,R,V,lambda,i,S,F +***** 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] = pca(zscore(x, 1)); +***** assert(tsquare,sumsq(F, 2),1E4*eps); +***** test + x=[1,2,3;2,1,3]'; + [COEFF,SCORE,latent,tsquare] = pca(x, "Economy", false); + 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); + [COEFF,SCORE,latent,tsquare] = pca(x, "Economy", false, "weights", [1 2 1], "variableweights", "variance"); +***** assert(COEFF, [0.632455532033676 -0.632455532033676; 0.741619848709566 0.741619848709566], 10*eps); +***** assert(SCORE, [-0.622019449426284 0.959119380657905; -0.505649896847432 -0.505649896847431; 1.633319243121148 0.052180413036957], 10*eps); +***** assert(latent, [1.783001790889027; 0.716998209110974], 10*eps); +***** xtest assert(tsquare, [1.5; 0.5; 1.5], 10*eps); #currently, [4; 2; 4]/3 is actually returned; see comments above +!!!!! known failure +ASSERT errors for: assert (tsquare,[1.5; 0.5; 1.5],10 * eps) + + Location | Observed | Expected | Reason + (1) 1.3333 1.5 Abs err 0.16667 exceeds tol 2.2204e-15 by 0.2 + (2) 0.66667 0.5 Abs err 0.16667 exceeds tol 2.2204e-15 by 0.2 + (3) 1.3333 1.5 Abs err 0.16667 exceeds tol 2.2204e-15 by 0.2 +***** test + x=x'; + [COEFF,SCORE,latent,tsquare] = pca(x, "Economy", false); + 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] = pca(x); +***** 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) +***** error pca([1 2; 3 4], "Algorithm", "xxx") +***** error <'centered' requires a boolean value> pca([1 2; 3 4], "Centered", "xxx") +***** error pca([1 2; 3 4], "NumComponents", -4) +***** error pca([1 2; 3 4], "Rows", 1) +***** error pca([1 2; 3 4], "Weights", [1 2 3]) +***** error pca([1 2; 3 4], "Weights", [-1 2]) +***** error pca([1 2; 3 4], "VariableWeights", [-1 2]) +***** error pca([1 2; 3 4], "VariableWeights", "xxx") +***** error pca([1 2; 3 4], "XXX", 1) +32 tests, 31 passed, 1 known failure, 0 skipped +[inst/stepwisefit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/stepwisefit.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)) + [X_use, b, bint, r, rint, stats] = stepwisefit(y, X, 0.05, 0.1, "corr"); + assert(X_use, [4 1]) + assert(b, regress(y, [ones(size(y)) X(:, X_use)], 0.05)) + [X_use, b, bint, r, rint, stats] = stepwisefit(y, X, [], [], "p"); + 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/confusionchart.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/confusionchart.m +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); +***** test + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ()", "Invalid call"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 1; 2 2; 3 3])", "invalid argument"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'xxx', 1)", "invalid property"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'XLabel', 1)", "XLabel .* string"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'YLabel', [1 0])", ".* YLabel .* string"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'Title', .5)", ".* Title .* string"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'FontName', [])", ".* FontName .* string"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'FontSize', 'b')", ".* FontSize .* numeric"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'DiagonalColor', 'h')", ".* DiagonalColor .* color"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'OffDiagonalColor', [])", ".* OffDiagonalColor .* color"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'Normalization', '')", ".* invalid .* Normalization"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'ColumnSummary', [])", ".* invalid .* ColumnSummary"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'RowSummary', 1)", ".* invalid .* RowSummary"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'GridVisible', .1)", ".* invalid .* GridVisible"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'HandleVisibility', .1)", ".* invalid .* HandleVisibility"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'OuterPosition', .1)", ".* invalid .* OuterPosition"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'Position', .1)", ".* invalid .* Position"); + set (0, "DefaultFigureVisible", visibility_setting); +***** xtest + set (0, "DefaultFigureVisible", "off"); + fail ("confusionchart ([1 2], [0 1], 'Units', .1)", ".* invalid .* Units"); + set (0, "DefaultFigureVisible", visibility_setting); +***** demo "Setting the chart properties" + Yt = [8 5 6 8 5 3 1 6 4 2 5 3 1 4]'; + Yp = [8 5 6 8 5 2 3 4 4 5 5 7 2 6]'; + confusionchart (Yt, Yp, "Title", ... + "Demonstration with summaries","Normalization",... + "absolute","ColumnSummary", "column-normalized","RowSummary",... + "row-normalized") +***** demo "Cellstr as inputs" + Yt = {'Positive', 'Positive', 'Positive', 'Negative', 'Negative' }; + Yp = {'Positive', 'Positive', 'Negative', 'Negative', 'Negative' }; + m = confusionmat ( Yt, Yp ); + confusionchart ( m, { 'Positive', 'Negative' } ); +***** demo "Editing the object properties" + Yt = {'Positive', 'Positive', 'Positive', 'Negative', 'Negative' }; + Yp = {'Positive', 'Positive', 'Negative', 'Negative', 'Negative' }; + cm = confusionchart ( Yt, Yp ); + cm.Title = "This is an example with a green diagonal"; + cm.DiagonalColor = [0.4660, 0.6740, 0.1880]; +***** demo "Confusion chart in a uipanel" + h = uipanel (); + Yt = {'Positive', 'Positive', 'Positive', 'Negative', 'Negative' }; + Yp = {'Positive', 'Positive', 'Negative', 'Negative', 'Negative' }; + cm = confusionchart ( h, Yt, Yp ); +***** demo "Sorting classes" + Yt = [8 5 6 8 5 3 1 6 4 2 5 3 1 4]'; + Yp = [8 5 6 8 5 2 3 4 4 5 5 7 2 6]'; + cm = confusionchart (Yt, Yp, "Title", ... + "Classes are sorted according to clusters"); + sortClasses (cm, "cluster"); +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/hygestat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hygestat.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); +***** 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 +[inst/nanmin.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/nanmin.m +***** assert (nanmin ([2 4 NaN 7]), 2) +***** assert (nanmin ([2 4 NaN Inf]), 2) +***** assert (nanmin ([1 NaN 3; NaN 5 6; 7 8 NaN]), [1, 5, 3]) +***** assert (nanmin ([1 NaN 3; NaN 5 6; 7 8 NaN]'), [1, 5, 7]) +***** assert (nanmin (single ([1 NaN 3; NaN 5 6; 7 8 NaN])), single ([1 5 3])) +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/hotelling_t2test.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/hotelling_t2test.m +***** error hotelling_t2test (); +***** error ... + hotelling_t2test (1); +***** error ... + hotelling_t2test (ones(2,2,2)); +***** error ... + hotelling_t2test (ones(20,2), [0, 0], "alpha", 1); +***** error ... + hotelling_t2test (ones(20,2), [0, 0], "alpha", -0.2); +***** error ... + hotelling_t2test (ones(20,2), [0, 0], "alpha", "a"); +***** error ... + hotelling_t2test (ones(20,2), [0, 0], "alpha", [0.01, 0.05]); +***** error ... + hotelling_t2test (ones(20,2), [0, 0], "name", 0.01); +***** error ... + hotelling_t2test (ones(20,1), [0, 0]); +***** error ... + hotelling_t2test (ones(4,5), [0, 0, 0, 0, 0]); +***** error ... + hotelling_t2test (ones(20,5), [0, 0, 0, 0]); +***** test + [h, pval, stats] = hotelling_t2test (randn(5000,5)); + assert (h, 0); + assert (stats.df1, 5); + assert (stats.df2, 4995); +12 tests, 12 passed, 0 known failure, 0 skipped +[inst/fillmissing.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/fillmissing.m +***** assert (fillmissing ([1 2 3], "constant", 99), [1 2 3]) +***** assert (fillmissing ([1 2 NaN], "constant", 99), [1 2 99]) +***** assert (fillmissing ([NaN 2 NaN], "constant", 99), [99 2 99]) +***** assert (fillmissing ([1 2 3]', "constant", 99), [1 2 3]') +***** assert (fillmissing ([1 2 NaN]', "constant", 99), [1 2 99]') +***** assert (fillmissing ([1 2 3; 4 5 6], "constant", 99), [1 2 3; 4 5 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "constant", 99), [1 2 99; 4 99 6]) +***** assert (fillmissing ([NaN 2 NaN; 4 NaN 6], "constant", [97, 98, 99]), [97 2 99; 4 98 6]) +***** test + x = cat (3, [1, 2, NaN; 4, NaN, 6], [NaN, 2, 3; 4, 5, NaN]); + y = cat (3, [1, 2, 99; 4, 99, 6], [99, 2, 3; 4, 5, 99]); + assert (fillmissing (x, "constant", 99), y); + y = cat (3, [1, 2, 96; 4, 95, 6], [97, 2, 3; 4, 5, 99]); + assert (fillmissing (x, "constant", [94:99]), y); + assert (fillmissing (x, "constant", [94:99]'), y); + assert (fillmissing (x, "constant", permute ([94:99], [1 3 2])), y); + assert (fillmissing (x, "constant", [94, 96, 98; 95, 97, 99]), y); + assert (fillmissing (x, "constant", [94:99], 1), y); + y = cat (3, [1, 2, 96; 4, 97, 6], [98, 2, 3; 4, 5, 99]); + assert (fillmissing (x, "constant", [96:99], 2), y); + y = cat (3, [1, 2, 98; 4, 97, 6], [94, 2, 3; 4, 5, 99]); + assert (fillmissing (x, "constant", [94:99], 3), y); + y = cat (3, [1, 2, 92; 4, 91, 6], [94, 2, 3; 4, 5, 99]); + assert (fillmissing (x, "constant", [88:99], 99), y); +***** test + x = reshape([1:24],4,3,2); + x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; + y = x; + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [94 95 95 96 96 97 97 98 99 99]; + assert (fillmissing (x, "constant", [94:99], 1), y); + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [92 93 94 92 95 97 99 98 97 98]; + assert (fillmissing (x, "constant", [92:99], 2), y); + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [88 93 94 96 99 89 91 94 97 98]; + assert (fillmissing (x, "constant", [88:99], 3), y); + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [76 81 82 84 87 89 91 94 97 98]; + assert (fillmissing (x, "constant", [76:99], 99), y); +***** assert (fillmissing ([1 2 3], "constant", 99, "endvalues", 88), [1 2 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", 88), [1 99 3]) +***** assert (fillmissing ([1 2 NaN], "constant", 99, "endvalues", 88), [1 2 88]) +***** assert (fillmissing ([NaN 2 3], "constant", 99, "endvalues", 88), [88 2 3]) +***** assert (fillmissing ([NaN NaN 3], "constant", 99, "endvalues", 88), [88 88 3]) +***** assert (fillmissing ([1 NaN NaN], "constant", 99, "endvalues", 88), [1 88 88]) +***** assert (fillmissing ([NaN 2 NaN], "constant", 99, "endvalues", 88), [88 2 88]) +***** assert (fillmissing ([NaN 2 NaN]', "constant", 99, "endvalues", 88), [88 2 88]') +***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 99, "endvalues", 88), [1 99 3 99 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "constant", 99, "endvalues", 88), [1 99 99 99 5]) +***** assert (fillmissing ([NaN NaN NaN NaN 5], "constant", 99, "endvalues", 88), [88 88 88 88 5]) +***** assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, "endvalues", 88), [1 99 3 4 88]) +***** assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, 1, "endvalues", 88), [1 88 3 4 88]) +***** assert (fillmissing ([1 NaN 3 4 NaN], "constant", 99, 1, "endvalues", "extrap"), [1 99 3 4 99]) +***** test + x = reshape ([1:24], 3, 4, 2); + y = x; + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y([1,2,5,6,10,13,16,18,19,20,21,22])= 88; y([8])=99; + assert (fillmissing (x, "constant", 99, "endvalues", 88), y); + assert (fillmissing (x, "constant", 99, 1, "endvalues", 88), y); + y = x; y([1,2,5,8,10,13,16,19,22])= 88; y([6,18,20,21])=99; + assert (fillmissing (x, "constant", 99, 2, "endvalues", 88), y); + y(y==99) = 88; + assert (fillmissing (x, "constant", 99, 3, "endvalues", 88), y); + assert (fillmissing (x, "constant", 99, 4, "endvalues", 88), y); + assert (fillmissing (x, "constant", 99, 99, "endvalues", 88), y); + y([8]) = 94; + assert (fillmissing (x, "constant", [92:99], 1, "endvalues", 88), y); + y([6,8,18,20,21]) = [96,88,99,98,99]; + assert (fillmissing (x, "constant", [94:99], 2, "endvalues", 88), y); + y = x; y(isnan(y)) = 88; + assert (fillmissing (x, "constant", [88:99], 3, "endvalues", 88), y); + y = x; y(isnan(y)) = [82,82,83,83,94,85,86,87,87,88,88,88,89]; + assert (fillmissing (x, "constant", [92:99], 1, "endvalues", [82:89]), y); + y = x; y(isnan(y)) = [84,85,85,96,85,84,87,87,99,87,98,99,87]; + assert (fillmissing (x, "constant", [94:99], 2, "endvalues", [84:89]), y); + y = x; y(isnan(y)) = [68,69,72,73,75,77,68,71,73,74,75,76,77]; + assert (fillmissing (x, "constant", [88:99], 3, "endvalues", [68:79]), y); + assert (fillmissing (x, "constant", [88:93;94:99]', 3, "endvalues", [68:73;74:79]'), y) +***** test + x = reshape([1:24],4,3,2); + x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; + y = x; + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [94 95 95 96 96 97 97 98 99 99]; + assert (fillmissing (x, "constant", [94:99], 1), y); + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [92 93 94 92 95 97 99 98 97 98]; + assert (fillmissing (x, "constant", [92:99], 2), y); + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [88 93 94 96 99 89 91 94 97 98]; + assert (fillmissing (x, "constant", [88:99], 3), y); + y([1,6,7,9 12, 14, 16, 19, 22, 23]) = [76 81 82 84 87 89 91 94 97 98]; + assert (fillmissing (x, "constant", [76:99], 99), y); +***** assert (fillmissing ([1 2 3], "previous"), [1 2 3]) +***** assert (fillmissing ([1 2 3], "next"), [1 2 3]) +***** assert (fillmissing ([1 2 3]', "previous"), [1 2 3]') +***** assert (fillmissing ([1 2 3]', "next"), [1 2 3]') +***** assert (fillmissing ([1 2 NaN], "previous"), [1 2 2]) +***** assert (fillmissing ([1 2 NaN], "next"), [1 2 NaN]) +***** assert (fillmissing ([NaN 2 NaN], "previous"), [NaN 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "next"), [2 2 NaN]) +***** assert (fillmissing ([1 NaN 3], "previous"), [1 1 3]) +***** assert (fillmissing ([1 NaN 3], "next"), [1 3 3]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 1), [1 2 NaN; 4 2 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 2), [1 2 2; 4 4 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "previous", 3), [1 2 NaN; 4 NaN 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 1), [1 2 6; 4 NaN 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 2), [1 2 NaN; 4 6 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "next", 3), [1 2 NaN; 4 NaN 6]) +***** test + x = reshape([1:24],4,3,2); + x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; + y = x; + y([1, 6, 7, 9, 14, 19, 22, 23]) = [2 8 8 10 15 20 24 24]; + assert (fillmissing (x, "next", 1), y); + y = x; + y([1, 6, 7, 14, 16]) = [5, 10, 11, 18, 20]; + assert (fillmissing (x, "next", 2), y); + y = x; + y([1, 6, 9, 12]) = [13 18 21 24]; + assert (fillmissing (x, "next", 3), y); + assert (fillmissing (x, "next", 99), x); + y = x; + y([6, 7, 12, 14, 16, 19, 22, 23]) = [5 5 11 13 15 18 21 21]; + assert (fillmissing (x, "previous", 1), y); + y = x; + y([6, 7, 9, 12, 19, 22, 23]) = [2 3 5 8 15 18 15]; + assert (fillmissing (x, "previous", 2), y); + y = x; + y([14, 16, 22, 23]) = [2 4 10 11]; + assert (fillmissing (x, "previous", 3), y); + assert (fillmissing (x, "previous", 99), x); +***** assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "previous"), [1 2 3]) +***** assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "next"), [1 2 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "previous"), [1 0 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "next"), [1 0 3]) +***** assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "previous"), [1 2 2]) +***** assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "next"), [1 2 NaN]) +***** assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "previous"), [1 1 1]) +***** assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "next"), [1 NaN NaN]) +***** assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "previous"), [NaN 2 3]) +***** assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "next"), [2 2 3]) +***** assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "previous"), [NaN NaN 3]) +***** assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "next"), [3 3 3]) +***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "previous"), [NaN NaN NaN]) +***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "next"), [NaN NaN NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "previous"), [NaN 2 0 4 4]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "next"), [2 2 0 4 NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "previous"), [NaN 2 NaN 4 NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "next"), [NaN 2 NaN 4 NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "previous"), [NaN 2 0 4 4]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "next"), [2 2 0 4 NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "previous"), [NaN 2 NaN 4 NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "next"), [NaN 2 NaN 4 NaN]) +***** test + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([5,6,8,18])=[4,4,0,17]; + assert (fillmissing (x, "constant", 0, "endvalues", "previous"), y); + assert (fillmissing (x, "constant", 0, 1, "endvalues", "previous"), y); + y = x; + y([6,10,18,20,21])=[0,7,0,0,0]; + assert (fillmissing (x, "constant", 0, 2, "endvalues", "previous"), y); + y = x; + y([16,19,21])=[4,7,9]; + assert (fillmissing (x, "constant", 0, 3, "endvalues", "previous"), y); + assert (fillmissing (x, "constant", 0, 4, "endvalues", "previous"), x); + assert (fillmissing (x, "constant", 0, 99, "endvalues", "previous"), x); + y = x; + y([1,2,8,10,13,16,22])=[3,3,0,11,14,17,23]; + assert (fillmissing (x, "constant", 0, "endvalues", "next"), y); + assert (fillmissing (x, "constant", 0, 1, "endvalues", "next"), y); + y = x; + y([1,2,5,6,8,18,20,21])=[4,11,11,0,11,0,0,0]; + assert (fillmissing (x, "constant", 0, 2, "endvalues", "next"), y); + y = x; + y([2,5])=[14,17]; + assert (fillmissing (x, "constant", 0, 3, "endvalues", "next"), y); + assert (fillmissing (x, "constant", 0, 4, "endvalues", "next"), x); + assert (fillmissing (x, "constant", 0, 99, "endvalues", "next"), x); +***** assert (fillmissing ([1 2 3], "nearest"), [1 2 3]) +***** assert (fillmissing ([1 2 3]', "nearest"), [1 2 3]') +***** assert (fillmissing ([1 2 NaN], "nearest"), [1 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "nearest"), [2 2 2]) +***** assert (fillmissing ([1 NaN 3], "nearest"), [1 3 3]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 1), [1 2 6; 4 2 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 2), [1 2 2; 4 6 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "nearest", 3), [1 2 NaN; 4 NaN 6]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "nearest"), [1 3 3 5 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "nearest", "samplepoints", [0 1 2 3 4]), [1 3 3 5 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "nearest", "samplepoints", [0.5 1 2 3 5]), [1 1 3 3 5]) +***** test + x = reshape([1:24],4,3,2); + x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; + y = x; + y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [2 5 8 10 11 15 15 20 21 24]; + assert (fillmissing (x, "nearest", 1), y); + y = x; + y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = [5 10 11 5 8 18 20 15 18 15]; + assert (fillmissing (x, "nearest", 2), y); + y = x; + y([1, 6, 9, 12, 14, 16, 22, 23]) = [13 18 21 24 2 4 10 11]; + assert (fillmissing (x, "nearest", 3), y); + assert (fillmissing (x, "nearest", 99), x); +***** assert (fillmissing ([1 2 3], "constant", 0, "endvalues", "nearest"), [1 2 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 0, "endvalues", "nearest"), [1 0 3]) +***** assert (fillmissing ([1 2 NaN], "constant", 0, "endvalues", "nearest"), [1 2 2]) +***** assert (fillmissing ([1 NaN NaN], "constant", 0, "endvalues", "nearest"), [1 1 1]) +***** assert (fillmissing ([NaN 2 3], "constant", 0, "endvalues", "nearest"), [2 2 3]) +***** assert (fillmissing ([NaN NaN 3], "constant", 0, "endvalues", "nearest"), [3 3 3]) +***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "endvalues", "nearest"), [NaN NaN NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, "endvalues", "nearest"), [2 2 0 4 4]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 1, "endvalues", "nearest"), [NaN 2 NaN 4 NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 2, "endvalues", "nearest"), [2 2 0 4 4]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 0, 3, "endvalues", "nearest"), [NaN 2 NaN 4 NaN]) +***** test + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([1,2,5,6,8,10,13,16,18,22])=[3 3 4 4 0 11 14 17 17 23]; + assert (fillmissing (x, "constant", 0, "endvalues", "nearest"), y); + assert (fillmissing (x, "constant", 0, 1, "endvalues", "nearest"), y); + y = x; + y([1,2,5,6,8,10,18,20,21])=[4 11 11 0 11 7 0 0 0]; + assert (fillmissing (x, "constant", 0, 2, "endvalues", "nearest"), y); + y = x; + y([2,5,16,19,21])=[14 17 4 7 9]; + assert (fillmissing (x, "constant", 0, 3, "endvalues", "nearest"), y); + assert (fillmissing (x, "constant", 0, 99, "endvalues", "nearest"), x); +***** assert (fillmissing ([1 2 3], "linear"), [1 2 3]) +***** assert (fillmissing ([1 2 3]', "linear"), [1 2 3]') +***** assert (fillmissing ([1 2 NaN], "linear"), [1 2 3]) +***** assert (fillmissing ([NaN 2 NaN], "linear"), [NaN 2 NaN]) +***** assert (fillmissing ([1 NaN 3], "linear"), [1 2 3]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 1), [1 2 NaN; 4 NaN 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 2), [1 2 3; 4 5 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "linear", 3), [1 2 NaN; 4 NaN 6]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "linear"), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "linear", "samplepoints", [0 1 2 3 4]), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "linear", "samplepoints", [0 1.5 2 5 14]), [1 2.5 3 3.5 5], eps) +***** test + x = reshape([1:24],4,3,2); + x([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; + assert (fillmissing (x, "linear", 1), reshape([1:24],4,3,2)); + y = reshape([1:24],4,3,2); + y([1 9 14 19 22 23]) = NaN; + assert (fillmissing (x, "linear", 2), y); + y = reshape([1:24],4,3,2); + y([1, 6, 7, 9, 12, 14, 16, 19, 22, 23]) = NaN; + assert (fillmissing (x, "linear", 3), y); + assert (fillmissing (x, "linear", 99), x); +***** assert (fillmissing ([1 2 3], "linear", "endvalues", 0), [1 2 3]) +***** assert (fillmissing ([1 NaN 3], "linear", "endvalues", 0), [1 2 3]) +***** assert (fillmissing ([1 2 NaN], "linear", "endvalues", 0), [1 2 0]) +***** assert (fillmissing ([1 NaN NaN], "linear", "endvalues", 0), [1 0 0]) +***** assert (fillmissing ([NaN 2 3], "linear", "endvalues", 0), [0 2 3]) +***** assert (fillmissing ([NaN NaN 3], "linear", "endvalues", 0), [0 0 3]) +***** assert (fillmissing ([NaN NaN NaN], "linear", "endvalues", 0), [0 0 0]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", "endvalues", 0), [0 2 3 4 0]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 1, "endvalues", 0), [0 2 0 4 0]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 2, "endvalues", 0), [0 2 3 4 0]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "linear", 3, "endvalues", 0), [0 2 0 4 0]) +***** test + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([1,2,5,6,10,13,16,18,19,20,21,22])=0; y(8)=8; + assert (fillmissing (x, "linear", "endvalues", 0), y); + assert (fillmissing (x, "linear", 1, "endvalues", 0), y); + y = x; + y([1,2,5,8,10,13,16,19,22])=0; y([6,18,20,21])=[6,18,20,21]; + assert (fillmissing (x, "linear", 2, "endvalues", 0), y); + y = x; + y(isnan(y))=0; + assert (fillmissing (x, "linear", 3, "endvalues", 0), y); + assert (fillmissing (x, "linear", 99, "endvalues", 0), y); +***** assert (fillmissing ([1 2 3], "constant", 99, "endvalues", "linear"), [1 2 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", "linear"), [1 99 3]) +***** assert (fillmissing ([1 NaN 3 NaN], "constant", 99, "endvalues", "linear"), [1 99 3 4]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear"), [1 2 99 4 5]) +***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 99, "endvalues", "linear"), [NaN 2 NaN NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear", "samplepoints", [1 2 3 4 5]), [1 2 99 4 5]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "linear", "samplepoints", [0 2 3 4 10]), [0 2 99 4 10]) + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([1,6,10,18,20,21]) = [2.5, 5, 8.5, 17.25, 21, 21.75]; + assert (fillmissing (x, "linear", 2, "samplepoints", [2 4 8 10]), y, eps); + y([1,6,10,18,20,21]) = [2.5, 4.5, 8.5, 17.25, 21.5, 21.75]; + assert (fillmissing (x, "spline", 2, "samplepoints", [2 4 8 10]), y, eps); + y([1,6,10,18,20,21]) = [2.5, 4.559386973180077, 8.5, 17.25, 21.440613026819925, 21.75]; + assert (fillmissing (x, "pchip", 2, "samplepoints", [2 4 8 10]), y, 10*eps); +***** test <60965> + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([1,6,10,18,20,21]) = [2.5, 4.609523809523809, 8.5, 17.25, 21.390476190476186, 21.75]; + assert (fillmissing (x, "makima", 2, "samplepoints", [2 4 8 10]), y, 10*eps); +!!!!! known bug: https://octave.org/testfailure/?60965 +interp1: invalid METHOD 'makima' +***** assert (fillmissing ([1 2 3], "constant", 99, "endvalues", "spline"), [1 2 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 99, "endvalues", "spline"), [1 99 3]) +***** assert (fillmissing ([1 NaN 3 NaN], "constant", 99, "endvalues", "spline"), [1 99 3 4]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline"), [1 2 99 4 5]) +***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 99, "endvalues", "spline"), [NaN 2 NaN NaN]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline", "samplepoints", [1 2 3 4 5]), [1 2 99 4 5]) +***** assert (fillmissing ([NaN 2 NaN 4 NaN], "constant", 99, "endvalues", "spline", "samplepoints", [0 2 3 4 10]), [0 2 99 4 10]) +***** assert (fillmissing ([1 2 3], "movmean", 1), [1 2 3]) +***** assert (fillmissing ([1 2 NaN], "movmean", 1), [1 2 NaN]) +***** assert (fillmissing ([1 2 3], "movmean", 2), [1 2 3]) +***** assert (fillmissing ([1 2 3], "movmean", [1 0]), [1 2 3]) +***** assert (fillmissing ([1 2 3]', "movmean", 2), [1 2 3]') +***** assert (fillmissing ([1 2 NaN], "movmean", 2), [1 2 2]) +***** assert (fillmissing ([1 2 NaN], "movmean", [1 0]), [1 2 2]) +***** assert (fillmissing ([1 2 NaN], "movmean", [1 0]'), [1 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "movmean", 2), [NaN 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "movmean", [1 0]), [NaN 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "movmean", [0 1]), [2 2 NaN]) +***** assert (fillmissing ([NaN 2 NaN], "movmean", [0 1.1]), [2 2 NaN]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", [3 0]), [1 1 3 2 5]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 1), [1 2 6; 4 2 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 2), [1 2 2; 4 5 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmean", 3, 3), [1 2 NaN; 4 NaN 6]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99), [1 3 3 3 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99, 1), [1 NaN 3 NaN 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmean", 99, 1), [1 3 3 3 5]') +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmean", 99, 2), [1 3 3 3 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmean", 99, 2), [1 NaN 3 NaN 5]') +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1 1], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 4, "samplepoints", [1 2 3 4 5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [2 2], "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 4.0001, "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1 2 3 4 4.5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", 3, "samplepoints", [1.5 2 3 4 4.5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1 2 3 4 4.5]), [1 1 5 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmean", [1.5 1.5], "samplepoints", [1.5 2 3 4 4.5]), [1 1 3 5 5]) +***** test + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([2,5,8,10,13,16,18,22]) = [3,4,8,11,14,17,17,23]; + assert (fillmissing (x, "movmean", 3), y); + assert (fillmissing (x, "movmean", [1 1]), y); + assert (fillmissing (x, "movmean", 3, "endvalues", "extrap"), y); + assert (fillmissing (x, "movmean", 3, "samplepoints", [1 2 3]), y); + y = x; + y([1,6,8,10,18,20,21]) = [4,6,11,7,15,20,24]; + assert (fillmissing (x, "movmean", 3, 2), y); + assert (fillmissing (x, "movmean", [1 1], 2), y); + assert (fillmissing (x, "movmean", 3, 2, "endvalues", "extrap"), y); + assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [1 2 3 4]), y); + y([1,18]) = NaN; y(6) = 9; + assert (fillmissing (x, "movmean", 3, 2, "samplepoints", [0 2 3 4]), y); + y = x; + y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = 8; + assert (fillmissing (x, "movmean", 3, "endvalues", 99), y); + y = x; + y([1,2,5,8,10,13,16,19,22]) = 99; y([6,18,20,21]) = [6,15,20,24]; + assert (fillmissing (x, "movmean", 3, 2, "endvalues", 99), y); +***** assert (fillmissing ([1 2 3], "movmedian", 1), [1 2 3]) +***** assert (fillmissing ([1 2 NaN], "movmedian", 1), [1 2 NaN]) +***** assert (fillmissing ([1 2 3], "movmedian", 2), [1 2 3]) +***** assert (fillmissing ([1 2 3], "movmedian", [1 0]), [1 2 3]) +***** assert (fillmissing ([1 2 3]', "movmedian", 2), [1 2 3]') +***** assert (fillmissing ([1 2 NaN], "movmedian", 2), [1 2 2]) +***** assert (fillmissing ([1 2 NaN], "movmedian", [1 0]), [1 2 2]) +***** assert (fillmissing ([1 2 NaN], "movmedian", [1 0]'), [1 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "movmedian", 2), [NaN 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "movmedian", [1 0]), [NaN 2 2]) +***** assert (fillmissing ([NaN 2 NaN], "movmedian", [0 1]), [2 2 NaN]) +***** assert (fillmissing ([NaN 2 NaN], "movmedian", [0 1.1]), [2 2 NaN]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", [3 0]), [1 1 3 2 5]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 1), [1 2 6; 4 2 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 2), [1 2 2; 4 5 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], "movmedian", 3, 3), [1 2 NaN; 4 NaN 6]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99), [1 3 3 3 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99, 1), [1 NaN 3 NaN 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmedian", 99, 1), [1 3 3 3 5]') +***** assert (fillmissing ([1 NaN 3 NaN 5], "movmedian", 99, 2), [1 3 3 3 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5]', "movmedian", 99, 2), [1 NaN 3 NaN 5]') +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1 1], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 4, "samplepoints", [1 2 3 4 5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [2 2], "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 4.0001, "samplepoints", [1 2 3 4 5]), [1 1 3 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1 2 3 4 4.5]), [1 1 NaN 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", 3, "samplepoints", [1.5 2 3 4 4.5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1.5 2 3 4 5]), [1 1 1 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1 2 3 4 4.5]), [1 1 5 5 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], "movmedian", [1.5 1.5], "samplepoints", [1.5 2 3 4 4.5]), [1 1 3 5 5]) +***** test + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([2 5 8 10 13 16 18 22]) = [3 4 8 11 14 17 17 23]; + assert (fillmissing (x, "movmedian", 3), y); + assert (fillmissing (x, "movmedian", [1 1]), y); + assert (fillmissing (x, "movmedian", 3, "endvalues", "extrap"), y); + assert (fillmissing (x, "movmedian", 3, "samplepoints", [1 2 3]), y); + y = x; + y([1 6 8 10 18 20 21]) = [4 6 11 7 15 20 24]; + assert (fillmissing (x, "movmedian", 3, 2), y); + assert (fillmissing (x, "movmedian", [1 1], 2), y); + assert (fillmissing (x, "movmedian", 3, 2, "endvalues", "extrap"), y); + assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [1 2 3 4]), y); + y([1,18]) = NaN; y(6) = 9; + assert (fillmissing (x, "movmedian", 3, 2, "samplepoints", [0 2 3 4]), y); + y = x; + y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = 8; + assert (fillmissing (x, "movmedian", 3, "endvalues", 99), y); + y = x; + y([1,2,5,8,10,13,16,19,22]) = 99; y([6,18,20,21]) = [6,15,20,24]; + assert (fillmissing (x, "movmedian", 3, 2, "endvalues", 99), y); +***** assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, 2), [1 2 3]) +***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, 1), [1 2 NaN]) +***** assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, 2), [1 2 3]) +***** assert (fillmissing ([1 2 3], @(x,y,z) x+y+z, [1 0]), [1 2 3]) +***** assert (fillmissing ([1 2 3]', @(x,y,z) x+y+z, 2), [1 2 3]') +***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, 2), [1 2 7]) +***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, [1 0]), [1 2 7]) +***** assert (fillmissing ([1 2 NaN], @(x,y,z) x+y+z, [1 0]'), [1 2 7]) +***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, 2), [5 2 7]) +***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [1 0]), [NaN 2 7]) +***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [0 1]), [5 2 NaN]) +***** assert (fillmissing ([NaN 2 NaN], @(x,y,z) x+y+z, [0 1.1]), [5 2 NaN]) +***** assert (fillmissing ([1 2 NaN NaN 3 4], @(x,y,z) x+y+z, 2),[1 2 7 12 3 4]) +***** assert (fillmissing ([1 2 NaN NaN 3 4], @(x,y,z) x+y+z, 0.5),[1 2 NaN NaN 3 4]) +***** function A = testfcn (x,y,z) + if isempty (y) + A = z; + elseif (numel (y) == 1) + A = repelem (x(1), numel(z)); + else + A = interp1 (y, x, z, "linear","extrap"); + endif +***** endfunction +***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, [3 0]), [1 1 3 NaN 5]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 1), [1 2 6; 4 2 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 2), [1 2 2; 4 5 6]) +***** assert (fillmissing ([1 2 NaN; 4 NaN 6], @testfcn, 3, 3), [1 2 NaN; 4 NaN 6]) +***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 1), [1 NaN 3 NaN 5]) ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5] +***** assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 1), [1 2 3 4 5]') +***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 2), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 2), [1 NaN 3 NaN 5]') ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5]' +***** assert (fillmissing ([1 NaN 3 NaN 5], @testfcn, 99, 3), [1 NaN 3 NaN 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5]', @testfcn, 99, 3), [1 NaN 3 NaN 5]') +***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 3, "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [1 1], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [1.5 1.5], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 4, "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, [2 2], "samplepoints", [1 2 3 4 5]), [1 2 3 4 5]) +***** assert (fillmissing ([1 NaN NaN NaN 5], @testfcn, 3, "samplepoints", [1 2 2.5 3 3.5]), [1 2.6 3.4 4.2 5], 10*eps) +***** assert (fillmissing ([NaN NaN 3 NaN 5], @testfcn, 99, 1), [NaN NaN 3 NaN 5]) ##known not-compatible. matlab bug ML2022a: [1 1 3 1 5] +***** test +***** function A = testfcn (x,y,z) + if isempty (y) + A = z; + elseif (numel (y) == 1) + A = repelem (x(1), numel(z)); + else + A = interp1 (y, x, z, "linear","extrap"); + endif +***** endfunction + x = reshape ([1:24], 3, 4, 2); + x([1,2,5,6,8,10,13,16,18,19,20,21,22]) = NaN; + y = x; + y([1,2,5,6,8,10,13,16,18,22]) = [3,3,4,4,8,11,14,17,17,23]; + assert (fillmissing (x, @testfcn, 3), y); + assert (fillmissing (x, @testfcn, [1 1]), y); + assert (fillmissing (x, @testfcn, 3, "endvalues", "extrap"), y); + assert (fillmissing (x, @testfcn, 3, "samplepoints", [1 2 3]), y); + y= x; + y(isnan(x)) = 99; y(8) = 8; + assert (fillmissing (x, @testfcn, 3, "endvalues", 99), y) + y = x; + y([1,2,5,6,8,10,18,20,21]) = [4,11,11,6,11,7,18,20,21]; + assert (fillmissing (x, @testfcn, 3, 2), y); + assert (fillmissing (x, @testfcn, [1 1], 2), y); + assert (fillmissing (x, @testfcn, 3, 2, "endvalues", "extrap"), y); + assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [1 2 3 4]), y); + y(1) = NaN; y([6,18,21]) = [9,24,24]; + assert (fillmissing (x, @testfcn, 3, 2, "samplepoints", [0 2 3 4]), y); + y = x; + y([1,2,5,6,10,13,16,18,19,20,21,22]) = 99; y(8) = [8]; + assert (fillmissing (x, @testfcn, 3, "endvalues", 99), y); + y([6,18,20,21]) = [6,18,20,21]; y(8)=99; + assert (fillmissing (x, @testfcn, 3, 2, "endvalues", 99), y); + y([6,18,20,21]) = 99; + assert (fillmissing (x, @testfcn, 3, 3, "endvalues", 99), y); +***** assert (fillmissing ([1 2 3], "constant", 0, "maxgap", 1), [1 2 3]) +***** assert (fillmissing ([1 2 3], "constant", 0, "maxgap", 99), [1 2 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 1), [1 NaN 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 1.999), [1 NaN 3]) +***** assert (fillmissing ([1 NaN 3], "constant", 0, "maxgap", 2), [1 0 3]) +***** assert (fillmissing ([1 NaN NaN 4], "constant", 0, "maxgap", 2), [1 NaN NaN 4]) +***** assert (fillmissing ([1 NaN NaN 4], "constant", 0, "maxgap", 3), [1 0 0 4]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2), [1 0 3 0 5]) +***** assert (fillmissing ([NaN 2 NaN], "constant", 0, "maxgap", 0.999), [NaN 2 NaN]) +***** assert (fillmissing ([NaN 2 NaN], "constant", 0, "maxgap", 1), [0 2 0]) +***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 0, "maxgap", 1), [0 2 NaN NaN]) +***** assert (fillmissing ([NaN 2 NaN NaN], "constant", 0, "maxgap", 2), [0 2 0 0]) +***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 1), [NaN NaN NaN]) +***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 3), [NaN NaN NaN]) +***** assert (fillmissing ([NaN NaN NaN], "constant", 0, "maxgap", 999), [NaN NaN NaN]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2, "samplepoints", [0 1 2 3 5]), [1 0 3 NaN 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5]', "constant", 0, "maxgap", 2, "samplepoints", [0 1 2 3 5]), [1 0 3 NaN 5]') +***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", 0, "maxgap", 2, "samplepoints", [0 2 3 4 5]), [1 NaN 3 0 5]) +***** assert (fillmissing ([1 NaN 3 NaN 5; 1 NaN 3 NaN 5], "constant", 0, 2, "maxgap", 2, "samplepoints", [0 2 3 4 5]), [1 NaN 3 0 5; 1 NaN 3 0 5]) +***** test + x = cat (3, [1, 2, NaN; 4, NaN, NaN], [NaN, 2, 3; 4, 5, NaN]); + assert (fillmissing (x, "constant", 0, "maxgap", 0.1), x); + y = x; + y([4,7,12]) = 0; + assert (fillmissing (x, "constant", 0, "maxgap", 1), y); + assert (fillmissing (x, "constant", 0, 1, "maxgap", 1), y); + y = x; + y([5,7,12]) = 0; + assert (fillmissing (x, "constant", 0, 2, "maxgap", 1), y); + y = x; + y([4,5,7]) = 0; + assert (fillmissing (x, "constant", 0, 3, "maxgap", 1), y); +***** test + x = cat (3, [1, 2, NaN; 4, NaN, NaN], [NaN, 2, 3; 4, 5, NaN]); + [~, idx] = fillmissing (x, "constant", 0, "maxgap", 1); + assert (idx, logical (cat (3, [0 0 0; 0 1 0], [1 0 0; 0 0 1]))); + [~, idx] = fillmissing (x, "constant", 0, 1, "maxgap", 1); + assert (idx, logical (cat (3, [0 0 0; 0 1 0], [1 0 0; 0 0 1]))); + [~, idx] = fillmissing (x, "constant", 0, 2, "maxgap", 1); + assert (idx, logical (cat (3, [0 0 1; 0 0 0], [1 0 0; 0 0 1]))); + [~, idx] = fillmissing (x, "constant", 0, 3, "maxgap", 1); + assert (idx, logical (cat (3, [0 0 1; 0 1 0], [1 0 0; 0 0 0]))); +***** test + x = [NaN, 2, 3]; + [~,idx] = fillmissing (x, "previous"); + assert (idx, logical ([0 0 0])); + [~,idx] = fillmissing (x, "movmean", 1); + assert (idx, logical ([0 0 0])); + x = [1:3;4:6;7:9]; + x([2,4,7,9]) = NaN; + [~,idx] = fillmissing (x, "linear"); + assert (idx, logical ([0 1 0;1 0 0;0 0 0])); + [~,idx] = fillmissing (x, "movmean", 2); + assert (idx, logical ([0 0 0;1 0 0;0 0 1])); + [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmean',2); + assert (A, [1 2 3 3 NaN]); + assert (idx, logical([0 0 0 1 0])); + [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmean',3); + assert (A, [1 2 3 3 NaN]); + assert (idx, logical([0 0 0 1 0])); + [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 2); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 2 3 NaN NaN], 'movmedian', 3); + assert (A, [1 2 3 3 NaN]); + assert (idx, logical([0 0 0 1 0])); + [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) z, 3); + assert (A, [1 2 1 4 1]); + assert (idx, logical([0 1 0 1 0])); + [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) NaN (size (z)), 3); + assert (A, [1 NaN 1 NaN 1]); + assert (idx, logical([0 0 0 0 0])); +***** assert (fillmissing ([1 2 3], "constant", 99, "missinglocations", logical([0 0 0])), [1 2 3]) +***** assert (fillmissing ([1 2 3], "constant", 99, "missinglocations", logical([1 1 1])), [99 99 99]) +***** assert (fillmissing ([1 NaN 2 3 NaN], "constant", 99, "missinglocations", logical([1 0 1 0 1])), [99 NaN 99 3 99]) +***** assert (fillmissing ([1 NaN 3 NaN 5], "constant", NaN, "missinglocations", logical([0 1 1 1 0])), [1 NaN NaN NaN 5]) +***** assert (fillmissing (["foo ";" bar"], "constant", 'X', "missinglocations", logical([0 0 0 0; 0 0 0 0])), ["foo ";" bar"]) +***** assert (fillmissing (["foo ";" bar"], "constant", 'X', "missinglocations", logical([1 0 1 0; 0 1 1 0])), ["XoX ";" XXr"]) +***** assert (fillmissing ({"foo","", "bar"}, "constant", 'X', "missinglocations", logical([0 0 0])), {"foo","", "bar"}) +***** assert (fillmissing ({"foo","", "bar"}, "constant", 'X', "missinglocations", logical([1 1 0])), {"X","X","bar"}) +***** test + [~,idx] = fillmissing ([1 NaN 3 NaN 5], "constant", NaN); + assert (idx, logical([0 0 0 0 0])); + [~,idx] = fillmissing ([1 NaN 3 NaN 5], "constant", NaN, "missinglocations", logical([0 1 1 1 0])); + assert (idx, logical([0 1 1 1 0])); + [A, idx] = fillmissing ([1 2 NaN 1 NaN], 'movmean', 3.1, 'missinglocations', logical([0 0 1 1 0])); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmean', 2, 'missinglocations', logical([0 0 1 1 0])); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 2 NaN 1 NaN], 'movmean', 3, 'missinglocations', logical([0 0 1 1 0])); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmean', 3, 'missinglocations', logical([0 0 1 1 0])); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 2, 'missinglocations', logical([0 0 1 1 0])); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 3, 'missinglocations', logical([0 0 1 1 0])); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 2 NaN NaN NaN], 'movmedian', 3.1, 'missinglocations', logical([0 0 1 1 0])); + assert (A, [1 2 2 NaN NaN]); + assert (idx, logical([0 0 1 0 0])); + [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) ones (size (z)), 3, "missinglocations", logical([0 1 0 1 1])); + assert (A, [1 1 1 1 1]); + assert (idx, logical([0 1 0 1 1])); + [A, idx] = fillmissing ([1 NaN 1 NaN 1], @(x,y,z) NaN (size (z)), 3, "missinglocations", logical([0 1 0 1 1])); + assert (A, [1 NaN 1 NaN NaN]); + assert (idx, logical([0 0 0 0 0])); +***** assert (fillmissing (' foo bar ', "constant", 'X'), 'XfooXbarX') +***** assert (fillmissing ([' foo';'bar '], "constant", 'X'), ['Xfoo';'barX']) +***** assert (fillmissing ([' foo';'bar '], "next"), ['bfoo';'bar ']) +***** assert (fillmissing ([' foo';'bar '], "next", 1), ['bfoo';'bar ']) +***** assert (fillmissing ([' foo';'bar '], "previous"), [' foo';'baro']) +***** assert (fillmissing ([' foo';'bar '], "previous", 1), [' foo';'baro']) +***** assert (fillmissing ([' foo';'bar '], "nearest"), ['bfoo';'baro']) +***** assert (fillmissing ([' foo';'bar '], "nearest", 1), ['bfoo';'baro']) +***** assert (fillmissing ([' foo';'bar '], "next", 2), ['ffoo';'bar ']) +***** assert (fillmissing ([' foo';'bar '], "previous", 2), [' foo';'barr']) +***** assert (fillmissing ([' foo';'bar '], "nearest", 2), ['ffoo';'barr']) +***** assert (fillmissing ([' foo';'bar '], "next", 3), [' foo';'bar ']) +***** assert (fillmissing ([' foo';'bar '], "previous", 3), [' foo';'bar ']) +***** assert (fillmissing ([' foo';'bar '], "nearest", 3), [' foo';'bar ']) +***** assert (fillmissing ({'foo','bar'}, "constant", 'a'), {'foo','bar'}) +***** assert (fillmissing ({'foo','bar'}, "constant", {'a'}), {'foo','bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "constant", 'a'), {'foo', 'a', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "constant", {'a'}), {'foo', 'a', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "previous"), {'foo', 'foo', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "next"), {'foo', 'bar', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "nearest"), {'foo', 'bar', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "previous", 2), {'foo', 'foo', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "next", 2), {'foo', 'bar', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "nearest", 2), {'foo', 'bar', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "previous", 1), {'foo', '', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "previous", 1), {'foo', '', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "next", 1), {'foo', '', 'bar'}) +***** assert (fillmissing ({'foo', '', 'bar'}, "nearest", 1), {'foo', '', 'bar'}) +***** assert (fillmissing ("abc ", @(x,y,z) x+y+z, 2), "abcj") +***** assert (fillmissing ({'foo', '', 'bar'}, @(x,y,z) x(1), 3), {'foo','foo','bar'}) +***** test + [A, idx] = fillmissing (" a b c", "constant", " "); + assert (A, " a b c"); + assert (idx, logical([0 0 0 0 0 0])); + [A, idx] = fillmissing ({"foo", "", "bar", ""}, "constant", ""); + assert (A, {"foo", "", "bar", ""}); + assert (idx, logical([0 0 0 0])); + [A, idx] = fillmissing ({"foo", "", "bar", ""}, "constant", {""}); + assert (A, {"foo", "", "bar", ""}); + assert (idx, logical([0 0 0 0])); + [A,idx] = fillmissing (' f o o ', @(x,y,z) repelem ("a", numel (z)), 3); + assert (A, "afaoaoa"); + assert (idx, logical([1 0 1 0 1 0 1])); + [A,idx] = fillmissing (' f o o ', @(x,y,z) repelem (" ", numel (z)), 3); + assert (A, " f o o "); + assert (idx, logical([0 0 0 0 0 0 0])); + [A,idx] = fillmissing ({'','foo',''}, @(x,y,z) repelem ({'a'}, numel (z)), 3); + assert (A, {'a','foo','a'}); + assert (idx, logical([1 0 1])); + [A,idx] = fillmissing ({'','foo',''}, @(x,y,z) repelem ({''}, numel (z)), 3); + assert (A, {'','foo',''}); + assert (idx, logical([0 0 0])); +***** assert (fillmissing (logical ([1 0 1 0 1]), "constant", true), logical ([1 0 1 0 1])) +***** assert (fillmissing (logical ([1 0 1 0 1]), "constant", false, 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) +***** assert (fillmissing (logical ([1 0 1 0 1]), "previous", 'missinglocations', logical([1 0 1 0 1])), logical ([1 0 0 0 0])) +***** assert (fillmissing (logical ([1 0 1 0 1]), "next", 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 1])) +***** assert (fillmissing (logical ([1 0 1 0 1]), "nearest", 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) +***** assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), 3), logical ([1 0 1 0 1])) +***** assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), 3, 'missinglocations', logical([1 0 1 0 1])), logical ([0 0 0 0 0])) +***** assert (fillmissing (logical ([1 0 1 0 1]), @(x,y,z) false(size(z)), [2 0], 'missinglocations', logical([1 0 1 0 1])), logical ([1 0 0 0 0])) +***** test + x = logical ([1 0 1 0 1]); + [~,idx] = fillmissing (x, "constant", true); + assert (idx, logical([0 0 0 0 0])); + [~,idx] = fillmissing (x, "constant", false, 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 1])); + [~,idx] = fillmissing (x, "constant", true, 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 1])); + [~,idx] = fillmissing (x, "previous", 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([0 0 1 0 1])); + [~,idx] = fillmissing (x, "next", 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 0])); + [~,idx] = fillmissing (x, "nearest", 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 1])); + [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), 3); + assert (idx, logical ([0 0 0 0 0])) + [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), 3, 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical ([1 0 1 0 1])) + [~,idx] = fillmissing (x, @(x,y,z) false(size(z)), [2 0], 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical ([0 0 1 0 1])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), "constant", 0), int32 ([1 2 3 4 5])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), "constant", 0,'missinglocations', logical([1 0 1 0 1])), int32 ([0 2 0 4 0])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), "previous", 'missinglocations', logical([1 0 1 0 1])), int32 ([1 2 2 4 4])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), "next", 'missinglocations', logical([1 0 1 0 1])), int32 ([2 2 4 4 5])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), "nearest", 'missinglocations', logical([1 0 1 0 1])), int32 ([2 2 4 4 4])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, 3), int32 ([1 2 3 4 5])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, 3, 'missinglocations', logical([1 0 1 0 1])), int32 ([11 2 13 4 15])) +***** assert (fillmissing (int32 ([1 2 3 4 5]), @(x,y,z) z+10, [2 0], 'missinglocations', logical([1 0 1 0 1])), int32 ([1 2 13 4 15])) +***** test + x = int32 ([1 2 3 4 5]); + [~,idx] = fillmissing (x, "constant", 0); + assert (idx, logical([0 0 0 0 0])); + [~,idx] = fillmissing (x, "constant", 0, 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 1])); + [~,idx] = fillmissing (x, "constant", 3, 'missinglocations', logical([0 0 1 0 0])); + assert (idx, logical([0 0 1 0 0])); + [~,idx] = fillmissing (x, "previous", 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([0 0 1 0 1])); + [~,idx] = fillmissing (x, "next", 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 0])); + [~,idx] = fillmissing (x, "nearest", 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 1])); + [~,idx] = fillmissing (x, @(x,y,z) z+10, 3); + assert (idx, logical([0 0 0 0 0])); + [~,idx] = fillmissing (x, @(x,y,z) z+10, 3, 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([1 0 1 0 1])); + [~,idx] = fillmissing (x, @(x,y,z) z+10, [2 0], 'missinglocations', logical([1 0 1 0 1])); + assert (idx, logical([0 0 1 0 1])); +***** test + [A, idx] = fillmissing ([struct struct], "constant", 1); + assert (A, [struct struct]) + assert (idx, [false false]) +***** error fillmissing () +***** error fillmissing (1) +***** error fillmissing (1,2,3,4,5,6,7,8,9,10,11,12,13) +***** error fillmissing (1, 2) +***** error fillmissing (1, "foo") +***** error fillmissing (1, @(x) x, 1) +***** error fillmissing (1, @(x,y) x+y, 1) +***** error fillmissing ("a b c", "linear") +***** error fillmissing ({'a','b'}, "linear") +***** error <'movmean' and 'movmedian' methods only valid for numeric> fillmissing ("a b c", "movmean", 2) +***** error <'movmean' and 'movmedian' methods only valid for numeric> fillmissing ({'a','b'}, "movmean", 2) +***** error <'constant' method must be followed by> fillmissing (1, "constant") +***** error fillmissing (1, "constant", []) +***** error fillmissing (1, "constant", "a") +***** error fillmissing ("a", "constant", 1) +***** error fillmissing ("a", "constant", {"foo"}) +***** error fillmissing ({"foo"}, "constant", 1) +***** error fillmissing (1, "movmean") +***** error fillmissing (1, "movmedian") +***** error fillmissing (1, "constant", 1, 0) +***** error fillmissing (1, "constant", 1, -1) +***** error fillmissing (1, "constant", 1, [1 2]) +***** error fillmissing (1, "constant", 1, "samplepoints") +***** error fillmissing (1, "constant", 1, "foo") +***** error fillmissing (1, "constant", 1, 1, "foo") +***** error fillmissing (1, "constant", 1, 2, {1}, 4) +***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [1 2]) +***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [3 1 2]) +***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", [1 1 2]) +***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", "abc") +***** error fillmissing ([1 2 3], "constant", 1, 2, "samplepoints", logical([1 1 1])) +***** error fillmissing ([1 2 3], "constant", 1, 1, "samplepoints", [1 2 3]) +***** error fillmissing ('foo', "next", "endvalues", 1) +***** error fillmissing (1, "constant", 1, 1, "endvalues", "foo") +***** error fillmissing ([1 2 3], "constant", 1, 2, "endvalues", [1 2 3]) +***** error fillmissing ([1 2 3], "constant", 1, 1, "endvalues", [1 2]) +***** error fillmissing (randi(5,4,3,2), "constant", 1, 3, "endvalues", [1 2]) +***** error fillmissing (1, "constant", 1, 1, "endvalues", {1}) +***** error fillmissing (1, "constant", 1, 2, "foo", 4) +***** error fillmissing (struct, "constant", 1, "missinglocations", false) +***** error fillmissing (1, "constant", 1, 2, "maxgap", 1, "missinglocations", false) +***** error fillmissing (1, "constant", 1, 2, "missinglocations", false, "maxgap", 1) +***** error fillmissing (1, "constant", 1, "replacevalues", true) +***** error fillmissing (1, "constant", 1, "datavariables", 'Varname') +***** error fillmissing (1, "constant", 1, 2, "missinglocations", 1) +***** error fillmissing (1, "constant", 1, 2, "missinglocations", 'a') +***** error fillmissing (1, "constant", 1, 2, "missinglocations", [true false]) +***** error fillmissing (true, "linear", "missinglocations", true) +***** error fillmissing (int8(1), "linear", "missinglocations", true) +***** error fillmissing (true, "next", "missinglocations", true, "EndValues", "linear") +***** error fillmissing (true, "next", "EndValues", "linear", "missinglocations", true) +***** error fillmissing (int8(1), "next", "missinglocations", true, "EndValues", "linear") +***** error fillmissing (int8(1), "next", "EndValues", "linear", "missinglocations", true) +***** error fillmissing (1, "constant", 1, 2, "maxgap", true) +***** error fillmissing (1, "constant", 1, 2, "maxgap", 'a') +***** error fillmissing (1, "constant", 1, 2, "maxgap", [1 2]) +***** error fillmissing (1, "constant", 1, 2, "maxgap", 0) +***** error fillmissing (1, "constant", 1, 2, "maxgap", -1) +***** error fillmissing ([1 2 3], "constant", [1 2 3]) +***** error fillmissing ([1 2 3]', "constant", [1 2 3]) +***** error fillmissing ([1 2 3]', "constant", [1 2 3], 1) +***** error fillmissing ([1 2 3], "constant", [1 2 3], 2) +***** error fillmissing (randi(5,4,3,2), "constant", [1 2], 1) +***** error fillmissing (randi(5,4,3,2), "constant", [1 2], 2) +***** error fillmissing (randi(5,4,3,2), "constant", [1 2], 3) +***** error fillmissing (1, @(x,y,z) x+y+z) +***** error fillmissing ([1 NaN 2], @(x,y,z) [1 2], 2) +378 tests, 377 passed, 0 known failure, 1 skipped [inst/explike.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/explike.m ***** test @@ -14172,6 +13434,407 @@ assert (V, expected_V, 0.001); ***** error explike (); 3 tests, 3 passed, 0 known failure, 0 skipped +[inst/x2fx.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/x2fx.m +***** test + X = [1, 10; 2, 20; 3, 10; 4, 20; 5, 15; 6, 15]; + D = x2fx(X,'quadratic'); + assert (D(1,:) , [1, 1, 10, 10, 1, 100]); + assert (D(2,:) , [1, 2, 20, 40, 4, 400]); +***** test + X = [1, 10; 2, 20; 3, 10; 4, 20; 5, 15; 6, 15]; + model = [0, 0; 1, 0; 0, 1; 1, 1; 2, 0]; + D = x2fx(X,model); + assert (D(1,:) , [1, 1, 10, 10, 1]); + assert (D(2,:) , [1, 2, 20, 40, 4]); + assert (D(4,:) , [1, 4, 20, 80, 16]); +***** error x2fx ([1, 10; 2, 20; 3, 10], [0; 1]); +***** error x2fx ([1, 10, 15; 2, 20, 40; 3, 10, 25], [0, 0; 1, 0; 0, 1; 1, 1; 2, 0]); +***** error x2fx ([1, 10; 2, 20; 3, 10], "whatever"); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/mahal.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/jackknife.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/optimalleaforder.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/optimalleaforder.m +***** error optimalleaforder () +***** error optimalleaforder (1) +***** error optimalleaforder (ones (2, 2), 1) +***** error optimalleaforder ([1 2 3], [1 2; 3 4], "criteria", 5) +***** error optimalleaforder ([1 2 1], [1 2 3]) +***** error optimalleaforder ([1 2 1], 1, "xxx", "xxx") +***** error optimalleaforder ([1 2 1], 1, "Transformation", "xxx") +***** demo + X = randn (10, 2); + D = pdist (X); + tree = linkage(D, 'average'); + optimalleaforder (tree, D, 'Transformation', 'linear') +7 tests, 7 passed, 0 known failure, 0 skipped +[inst/betastat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/betastat.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); +***** 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); +***** 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/evalclusters.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/evalclusters.m +***** error evalclusters () +***** error evalclusters ([1 1;0 1]) +***** error evalclusters ([1 1;0 1], "kmeans") +***** error <'x' must be a numeric*> evalclusters ("abc", "kmeans", "gap") +***** error evalclusters ([1 1;0 1], "xxx", "gap") +***** error evalclusters ([1 1;0 1], [1 2], "gap") +***** error evalclusters ([1 1;0 1], 1.2, "gap") +***** error evalclusters ([1 1;0 1], [1; 2], 123) +***** error evalclusters ([1 1;0 1], [1; 2], "xxx") +***** error <'KList' can be empty*> evalclusters ([1 1;0 1], "kmeans", "gap") +***** error evalclusters ([1 1;0 1], [1; 2], "gap", 1) +***** error evalclusters ([1 1;0 1], [1; 2], "gap", 1, 1) +***** error evalclusters ([1 1;0 1], [1; 2], "gap", "xxx", 1) +***** error <'KList'*> evalclusters ([1 1;0 1], [1; 2], "gap", "KList", [-1 0]) +***** error <'KList'*> evalclusters ([1 1;0 1], [1; 2], "gap", "KList", [1 .5]) +***** error <'KList'*> evalclusters ([1 1;0 1], [1; 2], "gap", "KList", [1 1; 1 1]) +***** error evalclusters ([1 1;0 1], [1; 2], "gap", ... + "distance", "a") +***** error evalclusters ([1 1;0 1], [1; 2], "daviesbouldin", ... + "distance", "a") +***** error evalclusters ([1 1;0 1], [1; 2], "gap", ... + "clusterpriors", "equal") +***** error evalclusters ([1 1;0 1], [1; 2], ... + "silhouette", "clusterpriors", "xxx") +***** error <'clust' must be a clustering*> evalclusters ([1 1;0 1], [1; 2], "gap") +***** demo + load fisheriris; + eva = evalclusters(meas, "kmeans", "calinskiharabasz", "KList", [1:6]) +21 tests, 21 passed, 0 known failure, 0 skipped +[inst/probit.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/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/gamlike.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gamlike.m +***** error gamlike (1); +***** error gamlike (1, 2, 3); +***** test + [nLogL] = gamlike([2, 3], [2, 3, 4, 5, 6, 7, 8, 9]); + assert (nLogL, 19.4426, 1e-4); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/cl_multinom.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cl_multinom.m +***** error cl_multinom (); +***** error cl_multinom (1, 2, 3, 4, 5); +***** error ... + cl_multinom (1, 2, 3, 4); +***** error ... + cl_multinom (1, 2, 3, "some string"); +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/unidstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/regression_ftest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/regression_ftest.m +***** error regression_ftest (); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]'); +***** error ... + regression_ftest ([1 2 NaN]', [2 3 4; 3 4 5]', [1 0.5]); +***** error ... + regression_ftest ([1 2 Inf]', [2 3 4; 3 4 5]', [1 0.5]); +***** error ... + regression_ftest ([1 2 3+i]', [2 3 4; 3 4 5]', [1 0.5]); +***** error ... + regression_ftest ([1 2 3]', [2 3 NaN; 3 4 5]', [1 0.5]); +***** error ... + regression_ftest ([1 2 3]', [2 3 Inf; 3 4 5]', [1 0.5]); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 3+i]', [1 0.5]); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", 0); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", 1.2); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", [.02 .1]); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "alpha", "a"); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [], "some", 0.05); +***** error ... + regression_ftest ([1 2 3]', [2 3; 3 4]', [1 0.5]); +***** error ... + regression_ftest ([1 2; 3 4]', [2 3; 3 4]', [1 0.5]); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], ones (2)); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], "alpha"); +***** error ... + regression_ftest ([1 2 3]', [2 3 4; 3 4 5]', [1 0.5], [1 2]); +18 tests, 18 passed, 0 known failure, 0 skipped +[inst/kstest2.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/kstest2.m +***** error kstest2 ([1,2,3,4,5,5]) +***** error kstest2 (ones(2,4), [1,2,3,4,5,5]) +***** error kstest2 ([2,3,5,7,3+3i], [1,2,3,4,5,5]) +***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"tail") +***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"tail", "whatever") +***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"badoption", 0.51) +***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"tail", 0) +***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"alpha", 0) +***** error kstest2 ([2,3,4,5,6],[3;5;7;8;7;6;5],"alpha", NaN) +***** error kstest2 ([NaN,NaN,NaN,NaN,NaN],[3;5;7;8;7;6;5],"tail", "unequal") +***** test + load examgrades + [h, p] = kstest2 (grades(:,1), grades(:,2)); + assert (h, false); + assert (p, 0.1222791870137312, 1e-14); +***** test + load examgrades + [h, p] = kstest2 (grades(:,1), grades(:,2), "tail", "larger"); + assert (h, false); + assert (p, 0.1844421391011258, 1e-14); +***** test + load examgrades + [h, p] = kstest2 (grades(:,1), grades(:,2), "tail", "smaller"); + assert (h, false); + assert (p, 0.06115357930171663, 1e-14); +***** test + load examgrades + [h, p] = kstest2 (grades(:,1), grades(:,2), "tail", "smaller", "alpha", 0.1); + assert (h, true); + assert (p, 0.06115357930171663, 1e-14); +14 tests, 14 passed, 0 known failure, 0 skipped +[inst/anova1.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/anova1.m +***** demo + x = meshgrid (1:6); + x = x + normrnd (0, 1, 6, 6); + anova1 (x, [], 'off'); +***** demo + x = meshgrid (1:6); + x = x + normrnd (0, 1, 6, 6); + [p, atab] = anova1(x); +***** demo + x = ones (50, 4) .* [-2, 0, 1, 5]; + x = x + normrnd (0, 2, 50, 4); + groups = {"A", "B", "C", "D"}; + anova1 (x, groups); +***** demo + y = [54 87 45; 23 98 39; 45 64 51; 54 77 49; 45 89 50; 47 NaN 55]; + g = [1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ]; + anova1 (y(:), g(:), "on", "unequal"); +***** test + data = [1.006, 0.996, 0.998, 1.000, 0.992, 0.993, 1.002, 0.999, 0.994, 1.000, ... + 0.998, 1.006, 1.000, 1.002, 0.997, 0.998, 0.996, 1.000, 1.006, 0.988, ... + 0.991, 0.987, 0.997, 0.999, 0.995, 0.994, 1.000, 0.999, 0.996, 0.996, ... + 1.005, 1.002, 0.994, 1.000, 0.995, 0.994, 0.998, 0.996, 1.002, 0.996, ... + 0.998, 0.998, 0.982, 0.990, 1.002, 0.984, 0.996, 0.993, 0.980, 0.996, ... + 1.009, 1.013, 1.009, 0.997, 0.988, 1.002, 0.995, 0.998, 0.981, 0.996, ... + 0.990, 1.004, 0.996, 1.001, 0.998, 1.000, 1.018, 1.010, 0.996, 1.002, ... + 0.998, 1.000, 1.006, 1.000, 1.002, 0.996, 0.998, 0.996, 1.002, 1.006, ... + 1.002, 0.998, 0.996, 0.995, 0.996, 1.004, 1.004, 0.998, 0.999, 0.991, ... + 0.991, 0.995, 0.984, 0.994, 0.997, 0.997, 0.991, 0.998, 1.004, 0.997]; + group = [1:10] .* ones (10,10); + group = group(:); + [p, tbl] = anova1 (data, group, "off"); + assert (p, 0.022661, 1e-6); + assert (tbl{2,5}, 2.2969, 1e-4); + assert (tbl{2,3}, 9, 0); + assert (tbl{4,2}, 0.003903, 1e-6); + data = reshape (data, 10, 10); + [p, tbl, stats] = anova1 (data, [], "off"); + assert (p, 0.022661, 1e-6); + assert (tbl{2,5}, 2.2969, 1e-4); + assert (tbl{2,3}, 9, 0); + assert (tbl{4,2}, 0.003903, 1e-6); + means = [0.998, 0.9991, 0.9954, 0.9982, 0.9919, 0.9988, 1.0015, 1.0004, 0.9983, 0.9948]; + N = 10 * ones (1, 10); + assert (stats.means, means, 1e-6); + assert (length (stats.gnames), 10, 0); + assert (stats.n, N, 0); +***** test + y = [54 87 45; 23 98 39; 45 64 51; 54 77 49; 45 89 50; 47 NaN 55]; + g = [1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ; 1 2 3 ]; + [p, tbl] = anova1 (y(:), g(:), "off", "equal"); + assert (p, 0.00004163, 1e-6); + assert (tbl{2,5}, 22.573418, 1e-6); + assert (tbl{2,3}, 2, 0); + assert (tbl{3,3}, 14, 0); + [p, tbl] = anova1 (y(:), g(:), "off", "unequal"); + assert (p, 0.00208877, 1e-8); + assert (tbl{2,5}, 15.523192, 1e-6); + assert (tbl{2,3}, 2, 0); + assert (tbl{2,4}, 7.5786897, 1e-6); +2 tests, 2 passed, 0 known failure, 0 skipped +[inst/gevfit_lmom.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/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/qqplot.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/qqplot.m +***** error qqplot () +***** error qqplot ({1}) +***** error qqplot (ones (2,2)) +***** error qqplot (1, "foobar") +***** error qqplot ([1 2 3], "foobar") +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); +***** test + set (0, "DefaultFigureVisible", "off"); + qqplot ([2 3 3 4 4 5 6 5 6 7 8 9 8 7 8 9 0 8 7 6 5 4 6 13 8 15 9 9]); + set (0, "DefaultFigureVisible", visibility_setting); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/levene_test.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/levene_test.m +***** error levene_test () +***** error ... + levene_test (1, 2, 3, 4, 5); +***** error levene_test (randn (50, 2), 0); +***** error ... + levene_test (randn (50, 2), [1, 2, 3]); +***** error ... + levene_test (randn (50, 1), ones (55, 1)); +***** error ... + levene_test (randn (50, 1), ones (50, 2)); +***** error ... + levene_test (randn (50, 2), [], 1.2); +***** error ... + levene_test (randn (50, 2), "some_string"); +***** error ... + levene_test (randn (50, 2), [], "alpha"); +***** error ... + levene_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], 1.2); +***** error ... + levene_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], "err"); +***** error ... + levene_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], 0.05, "type"); +***** warning ... + levene_test (randn (50, 1), [ones(24, 1); 2*ones(25, 1); 3]); +***** test + load examgrades + [h, pval, W, df] = levene_test (grades); + assert (h, 1); + assert (pval, 9.523239714592791e-07, 1e-14); + assert (W, 8.59529, 1e-5); + assert (df, [4, 595]); +***** test + load examgrades + [h, pval, W, df] = levene_test (grades, [], "quadratic"); + assert (h, 1); + assert (pval, 9.523239714592791e-07, 1e-14); + assert (W, 8.59529, 1e-5); + assert (df, [4, 595]); +***** test + load examgrades + [h, pval, W, df] = levene_test (grades, [], "median"); + assert (h, 1); + assert (pval, 1.312093241723211e-06, 1e-14); + assert (W, 8.415969, 1e-6); + assert (df, [4, 595]); +***** test + load examgrades + [h, pval, W, df] = levene_test (grades(:,[1:3])); + assert (h, 1); + assert (pval, 0.004349390980463497, 1e-14); + assert (W, 5.52139, 1e-5); + assert (df, [2, 357]); +***** test + load examgrades + [h, pval, W, df] = levene_test (grades(:,[1:3]), "median"); + assert (h, 1); + assert (pval, 0.004355216763951453, 1e-14); + assert (W, 5.52001, 1e-5); + assert (df, [2, 357]); +***** test + load examgrades + [h, pval, W, df] = levene_test (grades(:,[3,4]), "quadratic"); + assert (h, 0); + assert (pval, 0.1807494957440653, 2e-14); + assert (W, 1.80200, 1e-5); + assert (df, [1, 238]); +***** test + load examgrades + [h, pval, W, df] = levene_test (grades(:,[3,4]), "median"); + assert (h, 0); + assert (pval, 0.1978225622063785, 2e-14); + assert (W, 1.66768, 1e-5); + assert (df, [1, 238]); +20 tests, 20 passed, 0 known failure, 0 skipped [inst/ncx2stat.m] >>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ncx2stat.m ***** error p = ncx2stat (); @@ -14189,41 +13852,436 @@ ***** assert (ncx2stat (1, [d1(1), d1(3:5)]), [2, 4, NaN, 3]); ***** assert (ncx2stat (4, [d1(1), d1(3:5)]), [5, 7, NaN, 6]); 11 tests, 11 passed, 0 known failure, 0 skipped -[inst/ncfstat.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/ncfstat.m -***** error p = ncfstat (); -***** error p = ncfstat (1); -***** error p = ncfstat (1, 2); -***** error p = ncfstat (5, [4, 3], [3, 4, 5]); -***** shared df1, df2, delta - df1 = [2, 0, -1, 1, 4, 5]; - df2 = [2, 4, -1, 5, 6, 7]; - delta = [1, NaN, 3, 0, 2, -1]; -***** assert (ncfstat (df1, df2, delta), [NaN, NaN, NaN, 1.6667, 2.25, 1.12], 1e-4); -***** assert (ncfstat (df1(4:6), df2(4:6), 1), [3.3333, 1.8750, 1.6800], 1e-4); -***** assert (ncfstat (df1(4:6), df2(4:6), 2), [5.0000, 2.2500, 1.9600], 1e-4); -***** assert (ncfstat (df1(4:6), df2(4:6), 3), [6.6667, 2.6250, 2.2400], 1e-4); -***** assert (ncfstat (2, [df2(1), df2(4:6)], 5), [NaN,5.8333,5.2500,4.9000], 1e-4); -***** assert (ncfstat (0, [df2(1), df2(4:6)], 5), [NaN, Inf, Inf, Inf]); -***** assert (ncfstat (1, [df2(1), df2(4:6)], 5), [NaN, 10, 9, 8.4], 1e-14); -***** assert (ncfstat (4, [df2(1), df2(4:6)], 5), [NaN, 3.75, 3.375, 3.15], 1e-14); -12 tests, 12 passed, 0 known failure, 0 skipped -[inst/cmdscale.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/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/nanmax.m] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/nanmax.m -***** assert (nanmax ([2 4 NaN 7]), 7) -***** assert (nanmax ([2 4 NaN Inf]), Inf) -***** assert (nanmax ([1 NaN 3; NaN 5 6; 7 8 NaN]), [7, 8, 6]) -***** assert (nanmax ([1 NaN 3; NaN 5 6; 7 8 NaN]'), [3, 6, 8]) -***** assert (nanmax (single ([1 NaN 3; NaN 5 6; 7 8 NaN])), single ([7 8 6])) +[inst/anova2.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/anova2.m +***** demo + + # Factorial (Crossed) Two-way ANOVA with Interaction + + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + + [p, atab, stats] = anova2(popcorn, 3, "on"); +***** demo + + # One-way Repeated Measures ANOVA (Rows are a crossed random factor) + + data = [54, 43, 78, 111; + 23, 34, 37, 41; + 45, 65, 99, 78; + 31, 33, 36, 35; + 15, 25, 30, 26]; + + [p, atab, stats] = anova2 (data, 1, "on", "linear"); +***** demo + + # Balanced Nested One-way ANOVA (Rows are a nested random factor) + + data = [4.5924 7.3809 21.322; -0.5488 9.2085 25.0426; ... + 6.1605 13.1147 22.66; 2.3374 15.2654 24.1283; ... + 5.1873 12.4188 16.5927; 3.3579 14.3951 10.2129; ... + 6.3092 8.5986 9.8934; 3.2831 3.4945 10.0203]; + + [p, atab, stats] = anova2 (data, 4, "on", "nested"); +***** test + ## Test for anova2 ("interaction") + ## comparison with results from Matlab for column effect + popcorn = [5.5, 4.5, 3.5; 5.5, 4.5, 4.0; 6.0, 4.0, 3.0; ... + 6.5, 5.0, 4.0; 7.0, 5.5, 5.0; 7.0, 5.0, 4.5]; + [p, atab, stats] = anova2 (popcorn, 3, "off"); + assert (p(1), 7.678957383294716e-07, 1e-14); + assert (p(2), 0.0001003738963050171, 1e-14); + assert (p(3), 0.7462153966366274, 1e-14); + assert (atab{2,5}, 56.700, 1e-14); + assert (atab{2,3}, 2, 0); + assert (atab{4,2}, 0.08333333333333348, 1e-14); + assert (atab{5,4}, 0.1388888888888889, 1e-14); + assert (atab{5,2}, 1.666666666666667, 1e-14); + assert (atab{6,2}, 22); + assert (stats.source, "anova2"); + assert (stats.colmeans, [6.25, 4.75, 4]); + assert (stats.inter, 1, 0); + assert (stats.pval, 0.7462153966366274, 1e-14); + assert (stats.df, 12); +***** test + ## Test for anova2 ("linear") - comparison with results from GraphPad Prism 8 + data = [54, 43, 78, 111; + 23, 34, 37, 41; + 45, 65, 99, 78; + 31, 33, 36, 35; + 15, 25, 30, 26]; + [p, atab, stats] = anova2 (data, 1, "off", "linear"); + assert (atab{2,2}, 2174.95, 1e-10); + assert (atab{3,2}, 8371.7, 1e-10); + assert (atab{4,2}, 2404.3, 1e-10); + assert (atab{5,2}, 12950.95, 1e-10); + assert (atab{2,4}, 724.983333333333, 1e-10); + assert (atab{3,4}, 2092.925, 1e-10); + assert (atab{4,4}, 200.358333333333, 1e-10); + assert (atab{2,5}, 3.61843363972882, 1e-10); + assert (atab{3,5}, 10.445909412303, 1e-10); + assert (atab{2,6}, 0.087266112738617, 1e-10); + assert (atab{3,6}, 0.000698397753556, 1e-10); +***** test + ## Test for anova2 ("nested") - comparison with results from GraphPad Prism 8 + data = [4.5924 7.3809 21.322; -0.5488 9.2085 25.0426; ... + 6.1605 13.1147 22.66; 2.3374 15.2654 24.1283; ... + 5.1873 12.4188 16.5927; 3.3579 14.3951 10.2129; ... + 6.3092 8.5986 9.8934; 3.2831 3.4945 10.0203]; + [p, atab, stats] = anova2 (data, 4, "off", "nested"); + assert (atab{2,2}, 745.360306290833, 1e-10); + assert (atab{3,2}, 278.01854140125, 1e-10); + assert (atab{4,2}, 180.180377467501, 1e-10); + assert (atab{5,2}, 1203.55922515958, 1e-10); + assert (atab{2,4}, 372.680153145417, 1e-10); + assert (atab{3,4}, 92.67284713375, 1e-10); + assert (atab{4,4}, 10.0100209704167, 1e-10); + assert (atab{2,5}, 4.02146005730833, 1e-10); + assert (atab{3,5}, 9.25800729165627, 1e-10); + assert (atab{2,6}, 0.141597630656771, 1e-10); + assert (atab{3,6}, 0.000636643812875719, 1e-10); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/nctstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/nctstat.m +***** error p = nctstat (); +***** error p = nctstat (1); +***** error p = nctstat ([4, 3], [3, 4, 5]); +***** shared df, d1 + df = [2, 0, -1, 1, 4]; + d1 = [1, NaN, 3, -1, 2]; +***** assert (nctstat (df, d1), [1.7725, NaN, NaN, NaN, 2.5066], 1e-4); +***** assert (nctstat ([df(1:2), df(4:5)], 1), [1.7725, NaN, NaN, 1.2533], 1e-4); +***** assert (nctstat ([df(1:2), df(4:5)], 3), [5.3174, NaN, NaN, 3.7599], 1e-4); +***** assert (nctstat ([df(1:2), df(4:5)], 2), [3.5449, NaN, NaN, 2.5066], 1e-4); +***** assert (nctstat (2, [d1(1), d1(3:5)]), [1.7725,5.3174,-1.7725,3.5449], 1e-4); +***** assert (nctstat (0, [d1(1), d1(3:5)]), [NaN, NaN, NaN, NaN]); +***** assert (nctstat (1, [d1(1), d1(3:5)]), [NaN, NaN, NaN, NaN]); +***** assert (nctstat (4, [d1(1), d1(3:5)]), [1.2533,3.7599,-1.2533,2.5066], 1e-4); +11 tests, 11 passed, 0 known failure, 0 skipped +[inst/cdfcalc.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cdfcalc.m +***** test + x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4]; + [yCDF, xCDF, n, emsg, eid] = cdfcalc (x); + assert (yCDF, [0, 0.3, 0.5, 0.8, 0.9, 1]'); + assert (xCDF, [2, 3, 4, 5, 6]'); + assert (n, 10); +***** shared x + x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4]; +***** error yCDF = cdfcalc (x); +***** error [yCDF, xCDF] = cdfcalc (); +***** error [yCDF, xCDF] = cdfcalc (x, x); +***** warning [yCDF, xCDF] = cdfcalc (ones(10,2)); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/cdf.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cdf.m +***** test + assert (cdf ("norm", 1, 0, 1), normcdf (1, 0, 1)) +***** test + x = [0.2:0.2:0.6; 0.2:0.2:0.6]; + theta = [1; 2]; + assert (cdf ("copula", x, "Clayton", theta), copulacdf ("Clayton", x, theta)) +***** test + x = [-1, 0, 1, 2, Inf]; + assert (cdf ("bbs", x, ones (1,5), ones (1,5), zeros (1,5)), ... + bbscdf (x, ones (1,5), ones (1,5), zeros (1,5))) +***** test + x = [1 2]; + mu = [0.5 1.5]; + sigma = [1.0 0.5; 0.5 1.0]; + assert (cdf ("multivariate normal", x, mu, sigma), ... + mvncdf (x, mu, sigma), 0.01) + a = [-inf 0]; + assert (cdf ("mvn", x, a, mu, sigma), ... + mvncdf (a, x, mu, sigma), 0.01) +4 tests, 4 passed, 0 known failure, 0 skipped +[inst/bartlett_test.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/bartlett_test.m +***** error bartlett_test () +***** error ... + bartlett_test (1, 2, 3, 4); +***** error bartlett_test (randn (50, 2), 0); +***** error ... + bartlett_test (randn (50, 2), [1, 2, 3]); +***** error ... + bartlett_test (randn (50, 1), ones (55, 1)); +***** error ... + bartlett_test (randn (50, 1), ones (50, 2)); +***** error ... + bartlett_test (randn (50, 2), [], 1.2); +***** error ... + bartlett_test (randn (50, 2), [], "alpha"); +***** error ... + bartlett_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], 1.2); +***** error ... + bartlett_test (randn (50, 1), [ones(25, 1); 2*ones(25, 1)], "err"); +***** warning ... + bartlett_test (randn (50, 1), [ones(24, 1); 2*ones(25, 1); 3]); +***** test + load examgrades + [h, pval, chisq, df] = bartlett_test (grades); + assert (h, 1); + assert (pval, 7.908647337018238e-08, 1e-14); + assert (chisq, 38.73324, 1e-5); + assert (df, 4); +***** test + load examgrades + [h, pval, chisq, df] = bartlett_test (grades(:,[2:4])); + assert (h, 1); + assert (pval, 0.01172, 1e-5); + assert (chisq, 8.89274, 1e-5); + assert (df, 2); +***** test + load examgrades + [h, pval, chisq, df] = bartlett_test (grades(:,[1,4])); + assert (h, 0); + assert (pval, 0.88118, 1e-5); + assert (chisq, 0.02234, 1e-5); + assert (df, 1); +***** test + load examgrades + grades = [grades; nan(10, 5)]; + [h, pval, chisq, df] = bartlett_test (grades(:,[1,4])); + assert (h, 0); + assert (pval, 0.88118, 1e-5); + assert (chisq, 0.02234, 1e-5); + assert (df, 1); +***** test + load examgrades + [h, pval, chisq, df] = bartlett_test (grades(:,[2,5]), 0.01); + assert (h, 0); + assert (pval, 0.01791, 1e-5); + assert (chisq, 5.60486, 1e-5); + assert (df, 1); +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/vartestn.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/vartestn.m +***** demo + ## Test the null hypothesis that the variances are equal across the five + ## columns of data in the students’ exam grades matrix, grades. + + load examgrades + vartestn (grades) +***** demo + ## Test the null hypothesis that the variances in miles per gallon (MPG) are + ## equal across different model years. + + load carsmall + vartestn (MPG, Model_Year) +***** demo + ## Use Levene’s test to test the null hypothesis that the variances in miles + ## per gallon (MPG) are equal across different model years. + + load carsmall + p = vartestn (MPG, Model_Year, "TestType", "LeveneAbsolute") +***** demo + ## Test the null hypothesis that the variances are equal across the five + ## columns of data in the students’ exam grades matrix, grades, using the + ## Brown-Forsythe test. Suppress the display of the summary table of + ## statistics and the box plot. + + load examgrades + [p, stats] = vartestn (grades, "TestType", "BrownForsythe", "Display", "off") +***** error vartestn (); +***** error vartestn (1); +***** error ... + vartestn ([1, 2, 3, 4, 5, 6, 7]); +***** error ... + vartestn ([1, 2, 3, 4, 5, 6, 7], []); +***** error ... + vartestn ([1, 2, 3, 4, 5, 6, 7], "TestType", "LeveneAbsolute"); +***** error ... + vartestn ([1, 2, 3, 4, 5, 6, 7], [], "TestType", "LeveneAbsolute"); +***** error ... + vartestn ([1, 2, 3, 4, 5, 6, 7], [1, 1, 1, 2, 2, 2, 2], "Display", "some"); +***** error ... + vartestn (ones (50,3), "Display", "some"); +***** error ... + vartestn (ones (50,3), "Display", "off", "testtype", "some"); +***** error ... + vartestn (ones (50,3), [], "som"); +***** error ... + vartestn (ones (50,3), [], "some", "some"); +***** error ... + vartestn (ones (50,3), [1, 2], "Display", "off"); +***** test + load examgrades + [p, stat] = vartestn (grades, "Display", "off"); + assert (p, 7.908647337018238e-08, 1e-14); + assert (stat.chisqstat, 38.7332, 1e-4); + assert (stat.df, 4); +***** test + load examgrades + [p, stat] = vartestn (grades, "Display", "off", "TestType", "LeveneAbsolute"); + assert (p, 9.523239714592791e-07, 1e-14); + assert (stat.fstat, 8.5953, 1e-4); + assert (stat.df, [4, 595]); +***** test + load examgrades + [p, stat] = vartestn (grades, "Display", "off", "TestType", "LeveneQuadratic"); + assert (p, 7.219514351897161e-07, 1e-14); + assert (stat.fstat, 8.7503, 1e-4); + assert (stat.df, [4, 595]); +***** test + load examgrades + [p, stat] = vartestn (grades, "Display", "off", "TestType", "BrownForsythe"); + assert (p, 1.312093241723211e-06, 1e-14); + assert (stat.fstat, 8.4160, 1e-4); + assert (stat.df, [4, 595]); +***** test + load examgrades + [p, stat] = vartestn (grades, "Display", "off", "TestType", "OBrien"); + assert (p, 8.235660885480556e-07, 1e-14); + assert (stat.fstat, 8.6766, 1e-4); + assert (stat.df, [4, 595]); +17 tests, 17 passed, 0 known failure, 0 skipped +[inst/harmmean.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/harmmean.m +***** test + x = [0:10]; + y = [x;x+5;x+10]; + assert (harmmean (x), 0); + m = [0 8.907635160795225 14.30854471766802]; + assert (harmmean (y, 2), m', 4e-14); + assert (harmmean (y, "all"), 0); + y(2,4) = NaN; + m(2) = 9.009855936313949; + assert (harmmean (y', "omitnan"), m, 4e-14); + z = y + 20; + assert (harmmean (z, "all"), NaN); + m = [24.59488458841874 NaN 34.71244385944397]; + assert (harmmean (z'), m, 4e-14); + assert (harmmean (z', "includenan"), m, 4e-14); + m = [24.59488458841874 29.84104075528276 34.71244385944397]; + assert (harmmean (z', "omitnan"), m, 4e-14); + assert (harmmean (z, 2, "omitnan"), m', 4e-14); +***** test + assert (harmmean (true, "all"), 1); + assert (harmmean (false), 0); + assert (harmmean ([true false true]), 0); + assert (harmmean ([true false true], 1), [1 0 1]); + assert (harmmean ([true false NaN], 1), [1 0 NaN]); + assert (harmmean ([true false NaN], 2), NaN); + assert (harmmean ([true false NaN], 2, "omitnan"), 0); +***** test + x = repmat ([1:20;6:25], [5 2 6 3]); + assert (size (harmmean (x, [3 2])), [10 3]); + assert (size (harmmean (x, [1 2])), [6 3]); + assert (size (harmmean (x, [1 2 4])), [1 6]); + assert (size (harmmean (x, [1 4 3])), [1 40]); + assert (size (harmmean (x, [1 2 3 4])), [1 1]); +***** test + x = repmat ([1:20;6:25], [5 2 6 3]); + m = repmat ([5.559045930488016;13.04950789021461], [5,3]); + assert (harmmean (x, [3 2]), m, 4e-14); + x(2,5,6,3) = NaN; + m(2,3) = NaN; + assert (harmmean (x, [3 2]), m, 4e-14); + m(2,3) = 13.06617961315406; + assert (harmmean (x, [3 2], "omitnan"), m, 4e-14); +***** error harmmean ("char") +***** error harmmean ... + (repmat ([1:20;6:25], [5 2 6 3 5]), [1 2]) +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/cdfplot.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/cdfplot.m +***** demo + x = randn(100,1); + cdfplot (x); +***** shared visibility_setting + visibility_setting = get (0, "DefaultFigureVisible"); +***** test + set (0, "DefaultFigureVisible", "off"); + x = [2, 4, 3, 2, 4, 3, 2, 5, 6, 4]; + [hCDF, stats] = cdfplot (x); + assert (stats.min, 2); + assert (stats.max, 6); + assert (stats.median, 3.5); + assert (stats.std, 1.35400640077266, 1e-14); + set (0, "DefaultFigureVisible", visibility_setting); +***** test + set (0, "DefaultFigureVisible", "off"); + x = randn(100,1); + cdfplot (x); + set (0, "DefaultFigureVisible", visibility_setting); +***** error cdfplot (); +***** error cdfplot ([x',x']); +***** error cdfplot ([NaN, NaN, NaN, NaN]); 5 tests, 5 passed, 0 known failure, 0 skipped +[inst/gpstat.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/gpstat.m +***** shared x, y + x = [-Inf, -1, 0, 1/2, 1, Inf]; + y = [0, 0.5, 1, 2, Inf, Inf]; +***** assert (gpstat (x, ones (1,6), zeros (1,6)), y, eps) +***** assert (gpstat (single (x), 1, 0), single (y), eps("single")) +***** assert (gpstat (x, single (1), 0), single (y), eps("single")) +***** assert (gpstat (x, single (1)), single (y), eps("single")) +***** assert (gpstat (x, 1, single (0)), single (y), eps("single")) +***** assert (gpstat (single ([x, NaN]), 1, 0), single ([y, NaN]), eps("single")) +***** assert (gpstat ([x, NaN], single (1), 0), single ([y, NaN]), eps("single")) +***** assert (gpstat ([x, NaN], single (1)), single ([y, NaN]), eps("single")) +***** assert (gpstat ([x, NaN], 1, single (0)), single ([y, NaN]), eps("single")) +***** error gpstat () +***** error gpstat (1) +***** error ... + gpstat (1, ones (2), ones (3)) +***** error ... + gpstat (rand (3), ones (2), ones (3)) +***** error gpstat (i, 2, 2) +***** error gpstat (2, i, 2) +***** error gpstat (2, 2, i) +16 tests, 16 passed, 0 known failure, 0 skipped +[inst/signtest.m] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/inst/signtest.m +***** error signtest (); +***** error signtest ([]); +***** error signtest (ones(1,10), ones(1,8)); +***** error signtest (ones(1,10), ones(2,10)); +***** error signtest (ones(2,10), 0); +***** error signtest (ones(1,10), zeros(1,10), "alpha", 1.4) +***** error signtest (ones(1,10), zeros(1,10), "tail", "<") +***** error signtest (ones(1,10), zeros(1,10), "method", "some") +***** test + [pval, h, stats] = signtest ([-ones(1, 1000) 1], 0, "tail", "left"); + assert (pval, 1.091701889420221e-218, 1e-14); + assert (h, 1); + assert (stats.zval, -31.5437631079266, 1e-14); +***** test + [pval, h, stats] = signtest ([-2 -1 0 2 1 3 1], 0); + assert (pval, 0.6875000000000006, 1e-14); + assert (h, 0); + assert (stats.zval, NaN); + assert (stats.sign, 4); +***** test + [pval, h, stats] = signtest ([-2 -1 0 2 1 3 1], 0, "method", "approximate"); + assert (pval, 0.6830913983096086, 1e-14); + assert (h, 0); + assert (stats.zval, 0.4082482904638631, 1e-14); + assert (stats.sign, 4); +11 tests, 11 passed, 0 known failure, 0 skipped Checking C++ files ... +[src/svmpredict.cc] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/src/svmpredict.cc +***** test + [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat")); + model = svmtrain (L, D, '-c 1 -g 0.07'); + [predict_label, accuracy, dec_values] = svmpredict (L, D, model); + assert (size (predict_label), size (dec_values)); + assert (accuracy, [86.666, 0.533, 0.533]', [1e-3, 1e-3, 1e-3]'); + assert (dec_values(1), 1.225836001973273, 1e-14); + assert (dec_values(2), -0.3212992933043805, 1e-14); + assert (predict_label(1), 1); +***** shared L, D, model + [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat")); + model = svmtrain (L, D, '-c 1 -g 0.07'); +***** error ... + [p, a] = svmpredict (L, D, model); +***** error p = svmpredict (L, D); +***** error ... + p = svmpredict (single (L), D, model); +***** error p = svmpredict (L, D, 123); +5 tests, 5 passed, 0 known failure, 0 skipped [src/libsvmread.cc] >>>>> /build/reproducible-path/octave-statistics-1.5.3/src/libsvmread.cc ***** error [L, D] = libsvmread (24); @@ -14238,25 +14296,6 @@ assert (issparse (L), false); assert (issparse (D), true); 4 tests, 4 passed, 0 known failure, 0 skipped -[src/svmtrain.cc] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/src/svmtrain.cc -***** test - [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat")); - model = svmtrain(L, D, '-c 1 -g 0.07'); - [predict_label, accuracy, dec_values] = svmpredict(L, D, model); - assert (isstruct (model), true); - assert (isfield (model, "Parameters"), true); - assert (model.totalSV, 130); - assert (model.nr_class, 2); - assert (size (model.Label), [2, 1]); -***** shared L, D - [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat")); -***** error [L, D] = svmtrain (L, D); -***** error ... - model = svmtrain (single (L), D); -***** error ... - model = svmtrain (L, D, "", ""); -4 tests, 4 passed, 0 known failure, 0 skipped [src/libsvmwrite.cc] >>>>> /build/reproducible-path/octave-statistics-1.5.3/src/libsvmwrite.cc ***** shared L, D @@ -14274,27 +14313,25 @@ ***** error ... libsvmwrite (tempname (), L, D, D); 7 tests, 7 passed, 0 known failure, 0 skipped -[src/svmpredict.cc] ->>>>> /build/reproducible-path/octave-statistics-1.5.3/src/svmpredict.cc +[src/svmtrain.cc] +>>>>> /build/reproducible-path/octave-statistics-1.5.3/src/svmtrain.cc ***** test [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat")); - model = svmtrain (L, D, '-c 1 -g 0.07'); - [predict_label, accuracy, dec_values] = svmpredict (L, D, model); - assert (size (predict_label), size (dec_values)); - assert (accuracy, [86.666, 0.533, 0.533]', [1e-3, 1e-3, 1e-3]'); - assert (dec_values(1), 1.225836001973273, 1e-14); - assert (dec_values(2), -0.3212992933043805, 1e-14); - assert (predict_label(1), 1); -***** shared L, D, model + model = svmtrain(L, D, '-c 1 -g 0.07'); + [predict_label, accuracy, dec_values] = svmpredict(L, D, model); + assert (isstruct (model), true); + assert (isfield (model, "Parameters"), true); + assert (model.totalSV, 130); + assert (model.nr_class, 2); + assert (size (model.Label), [2, 1]); +***** shared L, D [L, D] = libsvmread (file_in_loadpath ("heart_scale.dat")); - model = svmtrain (L, D, '-c 1 -g 0.07'); -***** error ... - [p, a] = svmpredict (L, D, model); -***** error p = svmpredict (L, D); -***** error ... - p = svmpredict (single (L), D, model); -***** error p = svmpredict (L, D, 123); -5 tests, 5 passed, 0 known failure, 0 skipped +***** error [L, D] = svmtrain (L, D); +***** error ... + model = svmtrain (single (L), D); +***** error ... + model = svmtrain (L, D, "", ""); +4 tests, 4 passed, 0 known failure, 0 skipped Summary: 4712 tests, 4710 passed, 1 known failures, 1 skipped dh_installdocs -O--buildsystem=octave dh_installchangelogs -O--buildsystem=octave @@ -14318,8 +14355,8 @@ dpkg-gencontrol: warning: package octave-statistics: substitution variable ${octave:Upstream-Description} unused, but is defined dh_md5sums -O--buildsystem=octave dh_builddeb -O--buildsystem=octave -dpkg-deb: building package 'octave-statistics' in '../octave-statistics_1.5.3-2_armhf.deb'. dpkg-deb: building package 'octave-statistics-dbgsym' in '../octave-statistics-dbgsym_1.5.3-2_armhf.deb'. +dpkg-deb: building package 'octave-statistics' in '../octave-statistics_1.5.3-2_armhf.deb'. dpkg-genbuildinfo --build=binary -O../octave-statistics_1.5.3-2_armhf.buildinfo dpkg-genchanges --build=binary -O../octave-statistics_1.5.3-2_armhf.changes dpkg-genchanges: info: binary-only upload (no source code included) @@ -14327,12 +14364,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/27275/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/27275/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/17228 and its subdirectories -I: Current time: Fri Nov 3 03:51:44 -12 2023 -I: pbuilder-time-stamp: 1699026704 +I: removing directory /srv/workspace/pbuilder/27275 and its subdirectories +I: Current time: Sat Nov 4 06:16:08 +14 2023 +I: pbuilder-time-stamp: 1699028168