0s autopkgtest [17:49:57]: starting date and time: 2025-03-15 17:49:57+0000 0s autopkgtest [17:49:57]: git checkout: 325255d2 Merge branch 'pin-any-arch' into 'ubuntu/production' 0s autopkgtest [17:49:57]: host juju-7f2275-prod-proposed-migration-environment-20; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.hiswjkp1/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:glibc --apt-upgrade r-cran-actuar --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=glibc/2.41-1ubuntu2 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-s390x --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-20@bos03-s390x-24.secgroup --name adt-plucky-s390x-r-cran-actuar-20250315-174957-juju-7f2275-prod-proposed-migration-environment-20-0515cf08-991c-4fc3-a74a-df865a733ae3 --image adt/ubuntu-plucky-s390x-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-20 --net-id=net_prod-proposed-migration-s390x -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 111s autopkgtest [17:51:48]: testbed dpkg architecture: s390x 111s autopkgtest [17:51:48]: testbed apt version: 2.9.33 111s autopkgtest [17:51:48]: @@@@@@@@@@@@@@@@@@@@ test bed setup 111s autopkgtest [17:51:48]: testbed release detected to be: None 112s autopkgtest [17:51:49]: updating testbed package index (apt update) 112s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [126 kB] 113s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 113s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 113s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 113s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.8 kB] 113s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [99.7 kB] 113s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [379 kB] 113s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x Packages [113 kB] 113s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x c-n-f Metadata [1824 B] 113s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/restricted s390x c-n-f Metadata [116 B] 113s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/universe s390x Packages [320 kB] 114s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/universe s390x c-n-f Metadata [13.4 kB] 114s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse s390x Packages [3776 B] 114s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse s390x c-n-f Metadata [240 B] 114s Fetched 1073 kB in 2s (701 kB/s) 114s Reading package lists... 115s Reading package lists... 115s Building dependency tree... 115s Reading state information... 115s Calculating upgrade... 115s Calculating upgrade... 115s The following packages were automatically installed and are no longer required: 115s libnsl2 libpython3.12-minimal libpython3.12-stdlib libpython3.12t64 115s linux-headers-6.11.0-8 linux-headers-6.11.0-8-generic 115s linux-modules-6.11.0-8-generic linux-tools-6.11.0-8 115s linux-tools-6.11.0-8-generic 115s Use 'sudo apt autoremove' to remove them. 115s The following packages will be upgraded: 115s pinentry-curses python3-jinja2 strace 116s 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 116s Need to get 652 kB of archives. 116s After this operation, 27.6 kB of additional disk space will be used. 116s Get:1 http://ftpmaster.internal/ubuntu plucky/main s390x strace s390x 6.13+ds-1ubuntu1 [500 kB] 116s Get:2 http://ftpmaster.internal/ubuntu plucky/main s390x pinentry-curses s390x 1.3.1-2ubuntu3 [42.9 kB] 116s Get:3 http://ftpmaster.internal/ubuntu plucky/main s390x python3-jinja2 all 3.1.5-2ubuntu1 [109 kB] 117s Fetched 652 kB in 1s (702 kB/s) 117s (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 ... 81428 files and directories currently installed.) 117s Preparing to unpack .../strace_6.13+ds-1ubuntu1_s390x.deb ... 117s Unpacking strace (6.13+ds-1ubuntu1) over (6.11-0ubuntu1) ... 117s Preparing to unpack .../pinentry-curses_1.3.1-2ubuntu3_s390x.deb ... 117s Unpacking pinentry-curses (1.3.1-2ubuntu3) over (1.3.1-2ubuntu2) ... 117s Preparing to unpack .../python3-jinja2_3.1.5-2ubuntu1_all.deb ... 117s Unpacking python3-jinja2 (3.1.5-2ubuntu1) over (3.1.5-2) ... 117s Setting up pinentry-curses (1.3.1-2ubuntu3) ... 117s Setting up python3-jinja2 (3.1.5-2ubuntu1) ... 117s Setting up strace (6.13+ds-1ubuntu1) ... 117s Processing triggers for man-db (2.13.0-1) ... 118s Reading package lists... 118s Building dependency tree... 118s Reading state information... 118s Solving dependencies... 118s The following packages will be REMOVED: 118s libnsl2* libpython3.12-minimal* libpython3.12-stdlib* libpython3.12t64* 118s linux-headers-6.11.0-8* linux-headers-6.11.0-8-generic* 118s linux-modules-6.11.0-8-generic* linux-tools-6.11.0-8* 118s linux-tools-6.11.0-8-generic* 118s 0 upgraded, 0 newly installed, 9 to remove and 5 not upgraded. 118s After this operation, 167 MB disk space will be freed. 118s (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 ... 81428 files and directories currently installed.) 118s Removing linux-tools-6.11.0-8-generic (6.11.0-8.8) ... 118s Removing linux-tools-6.11.0-8 (6.11.0-8.8) ... 118s Removing libpython3.12t64:s390x (3.12.9-1) ... 118s Removing libpython3.12-stdlib:s390x (3.12.9-1) ... 118s Removing libnsl2:s390x (1.3.0-3build3) ... 118s Removing libpython3.12-minimal:s390x (3.12.9-1) ... 118s Removing linux-headers-6.11.0-8-generic (6.11.0-8.8) ... 118s Removing linux-headers-6.11.0-8 (6.11.0-8.8) ... 119s Removing linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 119s Processing triggers for libc-bin (2.41-1ubuntu1) ... 119s (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 ... 56328 files and directories currently installed.) 119s Purging configuration files for libpython3.12-minimal:s390x (3.12.9-1) ... 119s Purging configuration files for linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 120s autopkgtest [17:51:57]: upgrading testbed (apt dist-upgrade and autopurge) 120s Reading package lists... 120s Building dependency tree... 120s Reading state information... 120s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 120s Starting 2 pkgProblemResolver with broken count: 0 120s Done 120s Entering ResolveByKeep 120s 121s Calculating upgrade... 121s The following packages will be upgraded: 121s libc-bin libc-dev-bin libc6 libc6-dev locales 121s 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 121s Need to get 9512 kB of archives. 121s After this operation, 8192 B of additional disk space will be used. 121s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x libc6-dev s390x 2.41-1ubuntu2 [1678 kB] 122s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x libc-dev-bin s390x 2.41-1ubuntu2 [24.3 kB] 123s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x libc6 s390x 2.41-1ubuntu2 [2892 kB] 125s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x libc-bin s390x 2.41-1ubuntu2 [671 kB] 126s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x locales all 2.41-1ubuntu2 [4246 kB] 130s Preconfiguring packages ... 130s Fetched 9512 kB in 9s (1040 kB/s) 130s (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 ... 56326 files and directories currently installed.) 130s Preparing to unpack .../libc6-dev_2.41-1ubuntu2_s390x.deb ... 130s Unpacking libc6-dev:s390x (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 130s Preparing to unpack .../libc-dev-bin_2.41-1ubuntu2_s390x.deb ... 130s Unpacking libc-dev-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 130s Preparing to unpack .../libc6_2.41-1ubuntu2_s390x.deb ... 130s Unpacking libc6:s390x (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 130s Setting up libc6:s390x (2.41-1ubuntu2) ... 130s (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 ... 56326 files and directories currently installed.) 130s Preparing to unpack .../libc-bin_2.41-1ubuntu2_s390x.deb ... 130s Unpacking libc-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 130s Setting up libc-bin (2.41-1ubuntu2) ... 131s (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 ... 56326 files and directories currently installed.) 131s Preparing to unpack .../locales_2.41-1ubuntu2_all.deb ... 131s Unpacking locales (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 131s Setting up locales (2.41-1ubuntu2) ... 131s Generating locales (this might take a while)... 132s en_US.UTF-8... done 132s Generation complete. 132s Setting up libc-dev-bin (2.41-1ubuntu2) ... 132s Setting up libc6-dev:s390x (2.41-1ubuntu2) ... 132s Processing triggers for man-db (2.13.0-1) ... 133s Processing triggers for systemd (257.3-1ubuntu3) ... 134s Reading package lists... 134s Building dependency tree... 134s Reading state information... 134s Starting pkgProblemResolver with broken count: 0 134s Starting 2 pkgProblemResolver with broken count: 0 134s Done 134s Solving dependencies... 134s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 134s autopkgtest [17:52:11]: rebooting testbed after setup commands that affected boot 154s autopkgtest [17:52:31]: testbed running kernel: Linux 6.14.0-10-generic #10-Ubuntu SMP Wed Mar 12 14:53:49 UTC 2025 156s autopkgtest [17:52:33]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-actuar 158s Get:1 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (dsc) [2135 B] 158s Get:2 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (tar) [984 kB] 158s Get:3 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (diff) [3424 B] 158s gpgv: Signature made Wed Jan 22 07:35:04 2025 UTC 158s gpgv: using RSA key 73471499CC60ED9EEE805946C5BD6C8F2295D502 158s gpgv: issuer "plessy@debian.org" 158s gpgv: Can't check signature: No public key 158s dpkg-source: warning: cannot verify inline signature for ./r-cran-actuar_3.3-5-1.dsc: no acceptable signature found 158s autopkgtest [17:52:35]: testing package r-cran-actuar version 3.3-5-1 159s autopkgtest [17:52:36]: build not needed 161s autopkgtest [17:52:38]: test run-unit-test: preparing testbed 162s Reading package lists... 163s Building dependency tree... 163s Reading state information... 163s Starting pkgProblemResolver with broken count: 0 163s Starting 2 pkgProblemResolver with broken count: 0 163s Done 163s The following NEW packages will be installed: 163s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono libblas3 163s libcairo2 libdatrie1 libdeflate0 libfontconfig1 libfreetype6 libgfortran5 163s libgomp1 libgraphite2-3 libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 163s libjpeg8 liblapack3 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 163s libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 libtcl8.6 163s libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 163s libxft2 libxrender1 libxss1 libxt6t64 r-base-core r-cran-actuar 163s r-cran-expint r-cran-mass unzip x11-common xdg-utils zip 163s 0 upgraded, 47 newly installed, 0 to remove and 0 not upgraded. 163s Need to get 42.8 MB of archives. 163s After this operation, 84.9 MB of additional disk space will be used. 163s Get:1 http://ftpmaster.internal/ubuntu plucky/main s390x libfreetype6 s390x 2.13.3+dfsg-1 [431 kB] 164s Get:2 http://ftpmaster.internal/ubuntu plucky/main s390x fonts-dejavu-mono all 2.37-8 [502 kB] 164s Get:3 http://ftpmaster.internal/ubuntu plucky/main s390x fonts-dejavu-core all 2.37-8 [835 kB] 165s Get:4 http://ftpmaster.internal/ubuntu plucky/main s390x fontconfig-config s390x 2.15.0-2ubuntu1 [37.5 kB] 165s Get:5 http://ftpmaster.internal/ubuntu plucky/main s390x libfontconfig1 s390x 2.15.0-2ubuntu1 [150 kB] 165s Get:6 http://ftpmaster.internal/ubuntu plucky/main s390x fontconfig s390x 2.15.0-2ubuntu1 [191 kB] 165s Get:7 http://ftpmaster.internal/ubuntu plucky/main s390x libblas3 s390x 3.12.1-2 [252 kB] 166s Get:8 http://ftpmaster.internal/ubuntu plucky/main s390x libpixman-1-0 s390x 0.44.0-3 [201 kB] 166s Get:9 http://ftpmaster.internal/ubuntu plucky/main s390x libxcb-render0 s390x 1.17.0-2 [17.0 kB] 166s Get:10 http://ftpmaster.internal/ubuntu plucky/main s390x libxcb-shm0 s390x 1.17.0-2 [5862 B] 166s Get:11 http://ftpmaster.internal/ubuntu plucky/main s390x libxrender1 s390x 1:0.9.10-1.1build1 [20.4 kB] 166s Get:12 http://ftpmaster.internal/ubuntu plucky/main s390x libcairo2 s390x 1.18.2-2 [580 kB] 166s Get:13 http://ftpmaster.internal/ubuntu plucky/main s390x libdatrie1 s390x 0.2.13-3build1 [20.6 kB] 166s Get:14 http://ftpmaster.internal/ubuntu plucky/main s390x libdeflate0 s390x 1.23-1 [46.1 kB] 167s Get:15 http://ftpmaster.internal/ubuntu plucky/main s390x libgfortran5 s390x 15-20250222-0ubuntu1 [620 kB] 167s Get:16 http://ftpmaster.internal/ubuntu plucky/main s390x libgomp1 s390x 15-20250222-0ubuntu1 [152 kB] 167s Get:17 http://ftpmaster.internal/ubuntu plucky/main s390x libgraphite2-3 s390x 1.3.14-2ubuntu1 [79.8 kB] 167s Get:18 http://ftpmaster.internal/ubuntu plucky/main s390x libharfbuzz0b s390x 10.2.0-1 [538 kB] 168s Get:19 http://ftpmaster.internal/ubuntu plucky/main s390x x11-common all 1:7.7+23ubuntu3 [21.7 kB] 168s Get:20 http://ftpmaster.internal/ubuntu plucky/main s390x libice6 s390x 2:1.1.1-1 [45.4 kB] 168s Get:21 http://ftpmaster.internal/ubuntu plucky/main s390x libjpeg-turbo8 s390x 2.1.5-3ubuntu2 [147 kB] 168s Get:22 http://ftpmaster.internal/ubuntu plucky/main s390x libjpeg8 s390x 8c-2ubuntu11 [2146 B] 168s Get:23 http://ftpmaster.internal/ubuntu plucky/main s390x liblapack3 s390x 3.12.1-2 [2971 kB] 171s Get:24 http://ftpmaster.internal/ubuntu plucky/main s390x libthai-data all 0.1.29-2build1 [158 kB] 171s Get:25 http://ftpmaster.internal/ubuntu plucky/main s390x libthai0 s390x 0.1.29-2build1 [20.7 kB] 171s Get:26 http://ftpmaster.internal/ubuntu plucky/main s390x libpango-1.0-0 s390x 1.56.2-1 [253 kB] 171s Get:27 http://ftpmaster.internal/ubuntu plucky/main s390x libpangoft2-1.0-0 s390x 1.56.2-1 [50.2 kB] 171s Get:28 http://ftpmaster.internal/ubuntu plucky/main s390x libpangocairo-1.0-0 s390x 1.56.2-1 [28.2 kB] 171s Get:29 http://ftpmaster.internal/ubuntu plucky/main s390x libpaper2 s390x 2.2.5-0.3 [17.2 kB] 171s Get:30 http://ftpmaster.internal/ubuntu plucky/main s390x libpaper-utils s390x 2.2.5-0.3 [15.3 kB] 172s Get:31 http://ftpmaster.internal/ubuntu plucky/main s390x libsharpyuv0 s390x 1.5.0-0.1 [16.7 kB] 172s Get:32 http://ftpmaster.internal/ubuntu plucky/main s390x libsm6 s390x 2:1.2.4-1 [18.4 kB] 172s Get:33 http://ftpmaster.internal/ubuntu plucky/main s390x libtcl8.6 s390x 8.6.16+dfsg-1 [1034 kB] 173s Get:34 http://ftpmaster.internal/ubuntu plucky/main s390x libjbig0 s390x 2.1-6.1ubuntu2 [33.1 kB] 173s Get:35 http://ftpmaster.internal/ubuntu plucky/main s390x libwebp7 s390x 1.5.0-0.1 [210 kB] 173s Get:36 http://ftpmaster.internal/ubuntu plucky/main s390x libtiff6 s390x 4.5.1+git230720-4ubuntu4 [217 kB] 173s Get:37 http://ftpmaster.internal/ubuntu plucky/main s390x libxft2 s390x 2.3.6-1build1 [49.6 kB] 173s Get:38 http://ftpmaster.internal/ubuntu plucky/main s390x libxss1 s390x 1:1.2.3-1build3 [7396 B] 173s Get:39 http://ftpmaster.internal/ubuntu plucky/main s390x libtk8.6 s390x 8.6.16-1 [830 kB] 174s Get:40 http://ftpmaster.internal/ubuntu plucky/main s390x libxt6t64 s390x 1:1.2.1-1.2build1 [184 kB] 174s Get:41 http://ftpmaster.internal/ubuntu plucky/main s390x zip s390x 3.0-14ubuntu2 [187 kB] 174s Get:42 http://ftpmaster.internal/ubuntu plucky/main s390x unzip s390x 6.0-28ubuntu6 [186 kB] 175s Get:43 http://ftpmaster.internal/ubuntu plucky/main s390x xdg-utils all 1.2.1-2ubuntu1 [66.0 kB] 175s Get:44 http://ftpmaster.internal/ubuntu plucky/universe s390x r-base-core s390x 4.4.3-1 [28.6 MB] 205s Get:45 http://ftpmaster.internal/ubuntu plucky/universe s390x r-cran-expint s390x 0.1-8-1 [208 kB] 205s Get:46 http://ftpmaster.internal/ubuntu plucky/universe s390x r-cran-actuar s390x 3.3-5-1 [1424 kB] 206s Get:47 http://ftpmaster.internal/ubuntu plucky/universe s390x r-cran-mass s390x 7.3-64-1 [1113 kB] 208s Preconfiguring packages ... 208s Fetched 42.8 MB in 45s (958 kB/s) 208s Selecting previously unselected package libfreetype6:s390x. 208s (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 ... 56326 files and directories currently installed.) 208s Preparing to unpack .../00-libfreetype6_2.13.3+dfsg-1_s390x.deb ... 208s Unpacking libfreetype6:s390x (2.13.3+dfsg-1) ... 208s Selecting previously unselected package fonts-dejavu-mono. 208s Preparing to unpack .../01-fonts-dejavu-mono_2.37-8_all.deb ... 208s Unpacking fonts-dejavu-mono (2.37-8) ... 208s Selecting previously unselected package fonts-dejavu-core. 208s Preparing to unpack .../02-fonts-dejavu-core_2.37-8_all.deb ... 208s Unpacking fonts-dejavu-core (2.37-8) ... 208s Selecting previously unselected package fontconfig-config. 208s Preparing to unpack .../03-fontconfig-config_2.15.0-2ubuntu1_s390x.deb ... 208s Unpacking fontconfig-config (2.15.0-2ubuntu1) ... 208s Selecting previously unselected package libfontconfig1:s390x. 208s Preparing to unpack .../04-libfontconfig1_2.15.0-2ubuntu1_s390x.deb ... 208s Unpacking libfontconfig1:s390x (2.15.0-2ubuntu1) ... 208s Selecting previously unselected package fontconfig. 208s Preparing to unpack .../05-fontconfig_2.15.0-2ubuntu1_s390x.deb ... 208s Unpacking fontconfig (2.15.0-2ubuntu1) ... 208s Selecting previously unselected package libblas3:s390x. 208s Preparing to unpack .../06-libblas3_3.12.1-2_s390x.deb ... 208s Unpacking libblas3:s390x (3.12.1-2) ... 208s Selecting previously unselected package libpixman-1-0:s390x. 208s Preparing to unpack .../07-libpixman-1-0_0.44.0-3_s390x.deb ... 208s Unpacking libpixman-1-0:s390x (0.44.0-3) ... 208s Selecting previously unselected package libxcb-render0:s390x. 208s Preparing to unpack .../08-libxcb-render0_1.17.0-2_s390x.deb ... 208s Unpacking libxcb-render0:s390x (1.17.0-2) ... 208s Selecting previously unselected package libxcb-shm0:s390x. 208s Preparing to unpack .../09-libxcb-shm0_1.17.0-2_s390x.deb ... 208s Unpacking libxcb-shm0:s390x (1.17.0-2) ... 208s Selecting previously unselected package libxrender1:s390x. 208s Preparing to unpack .../10-libxrender1_1%3a0.9.10-1.1build1_s390x.deb ... 208s Unpacking libxrender1:s390x (1:0.9.10-1.1build1) ... 208s Selecting previously unselected package libcairo2:s390x. 208s Preparing to unpack .../11-libcairo2_1.18.2-2_s390x.deb ... 208s Unpacking libcairo2:s390x (1.18.2-2) ... 208s Selecting previously unselected package libdatrie1:s390x. 208s Preparing to unpack .../12-libdatrie1_0.2.13-3build1_s390x.deb ... 208s Unpacking libdatrie1:s390x (0.2.13-3build1) ... 209s Selecting previously unselected package libdeflate0:s390x. 209s Preparing to unpack .../13-libdeflate0_1.23-1_s390x.deb ... 209s Unpacking libdeflate0:s390x (1.23-1) ... 209s Selecting previously unselected package libgfortran5:s390x. 209s Preparing to unpack .../14-libgfortran5_15-20250222-0ubuntu1_s390x.deb ... 209s Unpacking libgfortran5:s390x (15-20250222-0ubuntu1) ... 209s Selecting previously unselected package libgomp1:s390x. 209s Preparing to unpack .../15-libgomp1_15-20250222-0ubuntu1_s390x.deb ... 209s Unpacking libgomp1:s390x (15-20250222-0ubuntu1) ... 209s Selecting previously unselected package libgraphite2-3:s390x. 209s Preparing to unpack .../16-libgraphite2-3_1.3.14-2ubuntu1_s390x.deb ... 209s Unpacking libgraphite2-3:s390x (1.3.14-2ubuntu1) ... 209s Selecting previously unselected package libharfbuzz0b:s390x. 209s Preparing to unpack .../17-libharfbuzz0b_10.2.0-1_s390x.deb ... 209s Unpacking libharfbuzz0b:s390x (10.2.0-1) ... 209s Selecting previously unselected package x11-common. 209s Preparing to unpack .../18-x11-common_1%3a7.7+23ubuntu3_all.deb ... 209s Unpacking x11-common (1:7.7+23ubuntu3) ... 209s Selecting previously unselected package libice6:s390x. 209s Preparing to unpack .../19-libice6_2%3a1.1.1-1_s390x.deb ... 209s Unpacking libice6:s390x (2:1.1.1-1) ... 209s Selecting previously unselected package libjpeg-turbo8:s390x. 209s Preparing to unpack .../20-libjpeg-turbo8_2.1.5-3ubuntu2_s390x.deb ... 209s Unpacking libjpeg-turbo8:s390x (2.1.5-3ubuntu2) ... 209s Selecting previously unselected package libjpeg8:s390x. 209s Preparing to unpack .../21-libjpeg8_8c-2ubuntu11_s390x.deb ... 209s Unpacking libjpeg8:s390x (8c-2ubuntu11) ... 209s Selecting previously unselected package liblapack3:s390x. 209s Preparing to unpack .../22-liblapack3_3.12.1-2_s390x.deb ... 209s Unpacking liblapack3:s390x (3.12.1-2) ... 209s Selecting previously unselected package libthai-data. 209s Preparing to unpack .../23-libthai-data_0.1.29-2build1_all.deb ... 209s Unpacking libthai-data (0.1.29-2build1) ... 209s Selecting previously unselected package libthai0:s390x. 209s Preparing to unpack .../24-libthai0_0.1.29-2build1_s390x.deb ... 209s Unpacking libthai0:s390x (0.1.29-2build1) ... 209s Selecting previously unselected package libpango-1.0-0:s390x. 209s Preparing to unpack .../25-libpango-1.0-0_1.56.2-1_s390x.deb ... 209s Unpacking libpango-1.0-0:s390x (1.56.2-1) ... 209s Selecting previously unselected package libpangoft2-1.0-0:s390x. 209s Preparing to unpack .../26-libpangoft2-1.0-0_1.56.2-1_s390x.deb ... 209s Unpacking libpangoft2-1.0-0:s390x (1.56.2-1) ... 209s Selecting previously unselected package libpangocairo-1.0-0:s390x. 209s Preparing to unpack .../27-libpangocairo-1.0-0_1.56.2-1_s390x.deb ... 209s Unpacking libpangocairo-1.0-0:s390x (1.56.2-1) ... 209s Selecting previously unselected package libpaper2:s390x. 209s Preparing to unpack .../28-libpaper2_2.2.5-0.3_s390x.deb ... 209s Unpacking libpaper2:s390x (2.2.5-0.3) ... 209s Selecting previously unselected package libpaper-utils. 209s Preparing to unpack .../29-libpaper-utils_2.2.5-0.3_s390x.deb ... 209s Unpacking libpaper-utils (2.2.5-0.3) ... 209s Selecting previously unselected package libsharpyuv0:s390x. 209s Preparing to unpack .../30-libsharpyuv0_1.5.0-0.1_s390x.deb ... 209s Unpacking libsharpyuv0:s390x (1.5.0-0.1) ... 209s Selecting previously unselected package libsm6:s390x. 209s Preparing to unpack .../31-libsm6_2%3a1.2.4-1_s390x.deb ... 209s Unpacking libsm6:s390x (2:1.2.4-1) ... 209s Selecting previously unselected package libtcl8.6:s390x. 209s Preparing to unpack .../32-libtcl8.6_8.6.16+dfsg-1_s390x.deb ... 209s Unpacking libtcl8.6:s390x (8.6.16+dfsg-1) ... 209s Selecting previously unselected package libjbig0:s390x. 209s Preparing to unpack .../33-libjbig0_2.1-6.1ubuntu2_s390x.deb ... 209s Unpacking libjbig0:s390x (2.1-6.1ubuntu2) ... 209s Selecting previously unselected package libwebp7:s390x. 209s Preparing to unpack .../34-libwebp7_1.5.0-0.1_s390x.deb ... 209s Unpacking libwebp7:s390x (1.5.0-0.1) ... 209s Selecting previously unselected package libtiff6:s390x. 209s Preparing to unpack .../35-libtiff6_4.5.1+git230720-4ubuntu4_s390x.deb ... 209s Unpacking libtiff6:s390x (4.5.1+git230720-4ubuntu4) ... 209s Selecting previously unselected package libxft2:s390x. 209s Preparing to unpack .../36-libxft2_2.3.6-1build1_s390x.deb ... 209s Unpacking libxft2:s390x (2.3.6-1build1) ... 209s Selecting previously unselected package libxss1:s390x. 209s Preparing to unpack .../37-libxss1_1%3a1.2.3-1build3_s390x.deb ... 209s Unpacking libxss1:s390x (1:1.2.3-1build3) ... 209s Selecting previously unselected package libtk8.6:s390x. 209s Preparing to unpack .../38-libtk8.6_8.6.16-1_s390x.deb ... 209s Unpacking libtk8.6:s390x (8.6.16-1) ... 209s Selecting previously unselected package libxt6t64:s390x. 209s Preparing to unpack .../39-libxt6t64_1%3a1.2.1-1.2build1_s390x.deb ... 209s Unpacking libxt6t64:s390x (1:1.2.1-1.2build1) ... 209s Selecting previously unselected package zip. 209s Preparing to unpack .../40-zip_3.0-14ubuntu2_s390x.deb ... 209s Unpacking zip (3.0-14ubuntu2) ... 209s Selecting previously unselected package unzip. 209s Preparing to unpack .../41-unzip_6.0-28ubuntu6_s390x.deb ... 209s Unpacking unzip (6.0-28ubuntu6) ... 209s Selecting previously unselected package xdg-utils. 209s Preparing to unpack .../42-xdg-utils_1.2.1-2ubuntu1_all.deb ... 209s Unpacking xdg-utils (1.2.1-2ubuntu1) ... 209s Selecting previously unselected package r-base-core. 209s Preparing to unpack .../43-r-base-core_4.4.3-1_s390x.deb ... 209s Unpacking r-base-core (4.4.3-1) ... 209s Selecting previously unselected package r-cran-expint. 209s Preparing to unpack .../44-r-cran-expint_0.1-8-1_s390x.deb ... 209s Unpacking r-cran-expint (0.1-8-1) ... 209s Selecting previously unselected package r-cran-actuar. 209s Preparing to unpack .../45-r-cran-actuar_3.3-5-1_s390x.deb ... 209s Unpacking r-cran-actuar (3.3-5-1) ... 209s Selecting previously unselected package r-cran-mass. 209s Preparing to unpack .../46-r-cran-mass_7.3-64-1_s390x.deb ... 209s Unpacking r-cran-mass (7.3-64-1) ... 209s Setting up libgraphite2-3:s390x (1.3.14-2ubuntu1) ... 209s Setting up libpixman-1-0:s390x (0.44.0-3) ... 209s Setting up libsharpyuv0:s390x (1.5.0-0.1) ... 209s Setting up libxrender1:s390x (1:0.9.10-1.1build1) ... 209s Setting up libdatrie1:s390x (0.2.13-3build1) ... 209s Setting up libxcb-render0:s390x (1.17.0-2) ... 209s Setting up unzip (6.0-28ubuntu6) ... 209s Setting up x11-common (1:7.7+23ubuntu3) ... 210s Setting up libdeflate0:s390x (1.23-1) ... 210s Setting up libxcb-shm0:s390x (1.17.0-2) ... 210s Setting up libgomp1:s390x (15-20250222-0ubuntu1) ... 210s Setting up libjbig0:s390x (2.1-6.1ubuntu2) ... 210s Setting up zip (3.0-14ubuntu2) ... 210s Setting up libblas3:s390x (3.12.1-2) ... 210s update-alternatives: using /usr/lib/s390x-linux-gnu/blas/libblas.so.3 to provide /usr/lib/s390x-linux-gnu/libblas.so.3 (libblas.so.3-s390x-linux-gnu) in auto mode 210s Setting up libfreetype6:s390x (2.13.3+dfsg-1) ... 210s Setting up fonts-dejavu-mono (2.37-8) ... 210s Setting up libtcl8.6:s390x (8.6.16+dfsg-1) ... 210s Setting up fonts-dejavu-core (2.37-8) ... 210s Setting up libjpeg-turbo8:s390x (2.1.5-3ubuntu2) ... 210s Setting up libgfortran5:s390x (15-20250222-0ubuntu1) ... 210s Setting up libwebp7:s390x (1.5.0-0.1) ... 210s Setting up libharfbuzz0b:s390x (10.2.0-1) ... 210s Setting up libthai-data (0.1.29-2build1) ... 210s Setting up libxss1:s390x (1:1.2.3-1build3) ... 210s Setting up libpaper2:s390x (2.2.5-0.3) ... 210s Setting up xdg-utils (1.2.1-2ubuntu1) ... 210s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 210s Setting up libjpeg8:s390x (8c-2ubuntu11) ... 210s Setting up libice6:s390x (2:1.1.1-1) ... 210s Setting up liblapack3:s390x (3.12.1-2) ... 210s update-alternatives: using /usr/lib/s390x-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/s390x-linux-gnu/liblapack.so.3 (liblapack.so.3-s390x-linux-gnu) in auto mode 210s Setting up fontconfig-config (2.15.0-2ubuntu1) ... 210s Setting up libpaper-utils (2.2.5-0.3) ... 210s Setting up libthai0:s390x (0.1.29-2build1) ... 210s Setting up libtiff6:s390x (4.5.1+git230720-4ubuntu4) ... 210s Setting up libfontconfig1:s390x (2.15.0-2ubuntu1) ... 210s Setting up libsm6:s390x (2:1.2.4-1) ... 210s Setting up fontconfig (2.15.0-2ubuntu1) ... 212s Regenerating fonts cache... done. 212s Setting up libxft2:s390x (2.3.6-1build1) ... 212s Setting up libtk8.6:s390x (8.6.16-1) ... 212s Setting up libpango-1.0-0:s390x (1.56.2-1) ... 212s Setting up libcairo2:s390x (1.18.2-2) ... 212s Setting up libxt6t64:s390x (1:1.2.1-1.2build1) ... 212s Setting up libpangoft2-1.0-0:s390x (1.56.2-1) ... 212s Setting up libpangocairo-1.0-0:s390x (1.56.2-1) ... 212s Setting up r-base-core (4.4.3-1) ... 212s Creating config file /etc/R/Renviron with new version 212s Setting up r-cran-mass (7.3-64-1) ... 212s Setting up r-cran-expint (0.1-8-1) ... 212s Setting up r-cran-actuar (3.3-5-1) ... 212s Processing triggers for man-db (2.13.0-1) ... 213s Processing triggers for install-info (7.1.1-1) ... 213s Processing triggers for libc-bin (2.41-1ubuntu2) ... 214s autopkgtest [17:53:31]: test run-unit-test: [----------------------- 214s BEGIN TEST betaint-tests.R 214s 214s R version 4.4.3 (2025-02-28) -- "Trophy Case" 214s Copyright (C) 2025 The R Foundation for Statistical Computing 214s Platform: s390x-ibm-linux-gnu 214s 214s R is free software and comes with ABSOLUTELY NO WARRANTY. 214s You are welcome to redistribute it under certain conditions. 214s Type 'license()' or 'licence()' for distribution details. 214s 214s R is a collaborative project with many contributors. 214s Type 'contributors()' for more information and 214s 'citation()' on how to cite R or R packages in publications. 214s 214s Type 'demo()' for some demos, 'help()' for on-line help, or 214s 'help.start()' for an HTML browser interface to help. 214s Type 'q()' to quit R. 214s 214s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 214s > ### 214s > ### Tests for the "beta integral" 214s > ### 214s > ### B(a, b; x) = Gamma(a + b) int_0^x t^(a-1) (1 - t)^(b-1) dt 214s > ### 214s > ### Inspired by (and some parts taken from) `tests/d-p-q-r-tests.R` in 214s > ### R sources. 214s > ### 214s > ### AUTHOR: Vincent Goulet with 214s > ### indirect help from the R Core Team 214s > 214s > ## Load the package 214s > library(actuar) 214s 214s Attaching package: ‘actuar’ 214s 214s The following objects are masked from ‘package:stats’: 214s 214s sd, var 214s 214s The following object is masked from ‘package:grDevices’: 214s 214s cm 214s 214s > 214s > ## Define a "local" version of the otherwise non-exported function 214s > ## 'betaint'. 214s > betaint <- actuar:::betaint 214s > 214s > ## Special values and utilities. Taken from `tests/d-p-q-r-tests.R`. 214s > xMax <- 1 - .Machine$double.eps 214s > xMin <- .Machine$double.xmin 214s > All.eq <- function(x, y) 214s + { 214s + all.equal.numeric(x, y, tolerance = 64 * .Machine$double.eps, 214s + scale = max(0, mean(abs(x), na.rm = TRUE))) 214s + } 214s > 214s > if(!interactive()) 214s + set.seed(123) 214s > 214s > ## Limiting cases 214s > stopifnot(exprs = { 214s + !is.finite(betaint(0.3, Inf, 2)) 214s + !is.finite(betaint(0.3, Inf, -2.2)) 214s + is.nan (betaint(0.3, 0, 2)) 214s + !is.finite(betaint(0.3, 2, Inf)) 214s + is.nan (betaint(0.3, 2, -2.2)) # a <= 1 + floor(-b) 214s + is.nan (betaint(0.3, 2, 0)) 214s + }) 214s Warning messages: 214s > 214s > ## Tests for cases with b > 0 214s > x <- c(xMin, runif(10), xMax) 214s > b <- 2 214s > for (a in rlnorm(5, 2)) 214s + stopifnot(exprs = { 214s 1: In betaint(0.3, 0, 2) : NaNs produced 214s 2: In betaint(0.3, 2, -2.2) : NaNs produced 214s 3: In betaint(0.3, 2, 0) : NaNs produced 214s + All.eq(betaint(x, a, b), 214s + gamma(a) * gamma(b) * pbeta(x, a, b)) 214s + }) 214s > 214s > ## Tests for cases with b < 0 214s > b <- -2.2 214s > r <- floor(-b) # r = 2 214s > for (a in 1 + r + rlnorm(5, 2)) 214s + { 214s + s <- (x^(a-1) * (1-x)^b)/b + 214s + ((a-1) * x^(a-2) * (1-x)^(b+1))/(b * (b+1)) + 214s + ((a-1) * (a-2) * x^(a-3) * (1-x)^(b+2))/(b * (b+1) * (b+2)) 214s + stopifnot(exprs = { 214s + all.equal(betaint(x, a, b), 214s + -gamma(a+b) * s + 214s + (a-1)*(a-2)*(a-3) * gamma(a-r-1)/(b*(b+1)*(b+2)) * 214s + gamma(b+r+1)*pbeta(x, a-r-1, b+r+1)) 214s + }) 214s + } 214s > 214s BEGIN TEST dpqr-tests.R 214s 214s R version 4.4.3 (2025-02-28) -- "Trophy Case" 214s Copyright (C) 2025 The R Foundation for Statistical Computing 214s Platform: s390x-ibm-linux-gnu 214s 214s R is free software and comes with ABSOLUTELY NO WARRANTY. 214s You are welcome to redistribute it under certain conditions. 214s Type 'license()' or 'licence()' for distribution details. 214s 214s R is a collaborative project with many contributors. 214s Type 'contributors()' for more information and 214s 'citation()' on how to cite R or R packages in publications. 214s 214s Type 'demo()' for some demos, 'help()' for on-line help, or 214s 'help.start()' for an HTML browser interface to help. 214s Type 'q()' to quit R. 214s 214s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 214s > ### 214s > ### Tests of functions for continuous and discrete probability 214s > ### distributions. 214s > ### 214s > ### Despite the name of the file, the tests are for [dpqrm,lev] 214s > ### functions (for continuous distributions): 214s > ### 214s > ### d: density or probability mass 214s > ### p: cumulative distribution 214s > ### q: quantile 214s > ### r: random number generation 214s > ### m: moment 214s > ### lev: limited moment 214s > ### 214s > ### Distributions are classified and sorted as in appendix A and 214s > ### appendix B of the 'distributions' package vignette. 214s > ### 214s > ### Inspired by (and some parts taken from) `tests/d-p-q-r-tests.R` in 214s > ### R sources. 214s > ### 214s > ### AUTHOR: Vincent Goulet with 214s > ### indirect help from the R Core Team 214s > 214s > ## Load the package 214s > library(actuar) 214s 214s Attaching package: ‘actuar’ 214s 214s The following objects are masked from ‘package:stats’: 214s 214s sd, var 214s 214s The following object is masked from ‘package:grDevices’: 214s 214s cm 214s 214s > library(expint) # for gammainc 214s > 214s > ## Define a "local" version of the otherwise non-exported function 214s > ## 'betaint'. 214s > betaint <- actuar:::betaint 214s > 214s > ## No warnings, unless explicitly asserted via tools::assertWarning. 214s > options(warn = 2) 214s > assertWarning <- tools::assertWarning 214s > 214s > ## Special values and utilities. Taken from `tests/d-p-q-r-tests.R`. 214s > Meps <- .Machine$double.eps 214s > xMax <- .Machine$double.xmax 214s > xMin <- .Machine$double.xmin 214s > All.eq <- function(x, y) 214s + { 214s + all.equal.numeric(x, y, tolerance = 64 * .Machine$double.eps, 214s + scale = max(0, mean(abs(x), na.rm = TRUE))) 214s + } 214s > 214s > if(!interactive()) 214s + set.seed(123) 214s > 214s > ### 214s > ### CONTINUOUS DISTRIBUTIONS 214s > ### 214s > 214s > ## 214s > ## FELLER-PARETO AND PARETO II, III, IV DISTRIBUTIONS 214s > ## 214s > 214s > ## When reasonable, we also test consistency with the special cases 214s > ## min = 0: 214s > ## 214s > ## Feller-Pareto -> Transformated beta 214s > ## Pareto IV -> Burr 214s > ## Pareto III -> Loglogistic 214s > ## Pareto II -> Pareto 214s > 214s > ## Density: first check that functions return 0 when scale = Inf, and 214s > ## when x = scale = Inf. 214s > stopifnot(exprs = { 214s + dfpareto(c(42, Inf), min = 1, shape1 = 2, shape2 = 3, shape3 = 4, scale = Inf) == c(0, 0) 214s + dpareto4(c(42, Inf), min = 1, shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 214s + dpareto3(c(42, Inf), min = 1, shape = 3, scale = Inf) == c(0, 0) 214s + dpareto2(c(42, Inf), min = 1, shape = 2, scale = Inf) == c(0, 0) 214s + }) 214s > 214s > ## Next test density functions for an array of standard values. 214s > nshpar <- 3 # (maximum) number of shape parameters 214s > min <- round(rnorm(30, 2), 2) 214s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 214s > scpar <- rlnorm(30, 2) # scale parameters 214s > for (i in seq_along(min)) 214s + { 214s + m <- min[i] 214s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 214s + Be <- beta(a, t) 214s + for (s in scpar) 214s + { 214s + x <- rfpareto(100, min = m, shape1 = a, shape2 = g, shape3 = t, scale = s) 214s + y <- (x - m)/s 214s + u <- 1/(1 + y^(-g)) 214s + stopifnot(exprs = { 214s + all.equal(d1 <- dfpareto(x, min = m, 214s + shape1 = a, shape2 = g, shape3 = t, 214s + scale = s), 214s + d2 <- dfpareto(y, min = 0, 214s + shape1 = a, shape2 = g, shape3 = t, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d2, 214s + dtrbeta(y, 214s + shape1 = a, shape2 = g, shape3 = t, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + g * y^(g*t - 1)/(s * Be * (1 + y^g)^(a + t)), 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + g * u^t * (1 - u)^a/((x - m) * Be), 214s + tolerance = 1e-10) 214s + }) 214s + x <- rpareto4(100, min = m, shape1 = a, shape2 = g, scale = s) 214s + y <- (x - m)/s 214s + u <- 1/(1 + y^g) 214s + stopifnot(exprs = { 214s + all.equal(d1 <- dpareto4(x, min = m, 214s + shape1 = a, shape2 = g, 214s + scale = s), 214s + d2 <- dpareto4(y, min = 0, 214s + shape1 = a, shape2 = g, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d2, 214s + dburr(y, 214s + shape1 = a, shape2 = g, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + a * g * y^(g - 1)/(s * (1 + y^g)^(a + 1)), 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + a * g * u^a * (1 - u)/(x - m), 214s + tolerance = 1e-10) 214s + }) 214s + x <- rpareto3(100, min = m, shape = g, scale = s) 214s + y <- (x - m)/s 214s + u <- 1/(1 + y^(-g)) 214s + stopifnot(exprs = { 214s + all.equal(d1 <- dpareto3(x, min = m, 214s + shape = g, 214s + scale = s), 214s + d2 <- dpareto3(y, min = 0, 214s + shape = g, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d2, 214s + dllogis(y, 214s + shape = g, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + g * y^(g - 1)/(s * (1 + y^g)^2), 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + g * u * (1 - u)/(x - m), 214s + tolerance = 1e-10) 214s + }) 214s + x <- rpareto2(100, min = m, shape = a, scale = s) 214s + y <- (x - m)/s 214s + u <- 1/(1 + y) 214s + stopifnot(exprs = { 214s + all.equal(d1 <- dpareto2(x, min = m, 214s + shape = a, 214s + scale = s), 214s + d2 <- dpareto2(y, min = 0, 214s + shape = a, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d2, 214s + dpareto(y, 214s + shape = a, 214s + scale = 1)/s, 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + a/(s * (1 + y)^(a + 1)), 214s + tolerance = 1e-10) 214s + all.equal(d1, 214s + a * u^a * (1 - u)/(x - m), 214s + tolerance = 1e-10) 214s + }) 214s + } 214s + } 215s > 215s > ## Tests on the cumulative distribution function. 215s > ## 215s > ## Note: when shape1 = shape3 = 1, the underlying beta distribution is 215s > ## a uniform. Therefore, pfpareto(x, min, 1, shape2, 1, scale) should 215s > ## return the value of u = v/(1 + v), v = ((x - min)/scale)^shape2. 215s > ## 215s > ## x = 2/Meps = 2^53 (with min = 0, shape2 = scale = 1) is the value 215s > ## where the cdf would jump to 1 if we weren't using the trick to 215s > ## compute the cdf with pbeta(1 - u, ..., lower = FALSE). 215s > scLrg <- 1e300 * c(0.5, 1, 2) 215s > m <- rnorm(1) 215s > stopifnot(exprs = { 215s + pfpareto(Inf, min = 10, 1, 2, 3, scale = xMax) == 1 215s + pfpareto(2^53, min = 0, 1, 1, 1, scale = 1) != 1 215s + pfpareto(2^53 + xMax, min = xMax, 1, 1, 1, scale = 1) != 1 215s + all.equal(pfpareto(xMin + m, min = m, 1, 1, 1, scale = 1), xMin) 215s + all.equal(y <- pfpareto(1e300 + m, min = m, 215s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 215s + shape3 = 1, 215s + scale = scLrg, log = TRUE), 215s + ptrbeta(1e300, 215s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 215s + shape3 = 1, 215s + scale = scLrg, log = TRUE)) 215s + all.equal(y, 215s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 215s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE), 215s + pbeta(c(4/5, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 215s + pbeta(4/5, 3, 1, lower.tail = FALSE, log = TRUE))) 215s + }) 215s > stopifnot(exprs = { 215s + ppareto4(Inf, min = 10, 1, 3, scale = xMax) == 1 215s + ppareto4(2^53, min = 0, 1, 1, scale = 1) != 1 215s + ppareto4(2^53 + xMax, min = xMax, 1, 1, scale = 1) != 1 215s + all.equal(ppareto4(xMin + m, min = m, 1, 1, scale = 1), xMin) 215s + all.equal(y <- ppareto4(1e300 + m, min = m, 215s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 215s + scale = scLrg, log = TRUE), 215s + pburr(1e300, 215s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 215s + scale = scLrg, log = TRUE)) 215s + all.equal(y, 215s + c(log(1 - c(1/3, 1/2, 2/3)^3), 215s + log(1 - c(1/5, 1/2, 4/5)^3))) 215s + }) 215s > stopifnot(exprs = { 215s + ppareto3(Inf, min = 10, 3, scale = xMax) == 1 215s + ppareto3(2^53, min = 0, 1, scale = 1) != 1 215s + ppareto3(2^53 + xMax, min = xMax, 1, scale = 1) != 1 215s + all.equal(ppareto3(xMin + m, min = m, 1, scale = 1), xMin) 215s + all.equal(y <- ppareto3(1e300 + m, min = m, 215s + shape = rep(c(1, 2), each = length(scLrg)), 215s + scale = scLrg, log = TRUE), 215s + pllogis (1e300, 215s + shape = rep(c(1, 2), each = length(scLrg)), 215s + scale = scLrg, log = TRUE)) 215s + all.equal(y, 215s + c(log(c(2/3, 1/2, 1/3)), 215s + log(c(4/5, 1/2, 1/5)))) 215s + }) 215s > stopifnot(exprs = { 215s + ppareto2(Inf, min = 10, 3, scale = xMax) == 1 215s + ppareto2(2^53, min = 0, 1, scale = 1) != 1 215s + ppareto2(2^53 + xMax, min = xMax, 1, scale = 1) != 1 215s + all.equal(ppareto2(xMin + m, min = m, 1, scale = 1), xMin) 215s + all.equal(y <- ppareto2(1e300 + m, min = m, 215s + shape = 3, 215s + scale = scLrg, log = TRUE), 215s + ppareto (1e300, 215s + shape = 3, 215s + scale = scLrg, log = TRUE)) 215s + all.equal(y, 215s + c(log(1 - c(1/3, 1/2, 2/3)^3))) 215s + }) 215s > 215s > ## Also check that distribution functions return 0 when scale = Inf. 215s > stopifnot(exprs = { 215s + pfpareto(x, min = m, shape1 = a, shape2 = g, shape3 = t, scale = Inf) == 0 215s + ppareto4(x, min = m, shape1 = a, shape2 = g, scale = Inf) == 0 215s + ppareto3(x, min = m, shape = g, scale = Inf) == 0 215s + ppareto2(x, min = m, shape = a, scale = Inf) == 0 215s + }) 215s > 215s > ## Tests for first three (positive) moments 215s > ## 215s > ## Simulation of new parameters ensuring that the first three moments 215s > ## exist. 215s > set.seed(123) # reset the seed 215s > nshpar <- 3 # (maximum) number of shape parameters 215s > min <- round(rnorm(30, 2), 2) 215s > shpar <- replicate(30, c(3, 3, 0) + rlnorm(nshpar, 2), simplify = FALSE) 215s > scpar <- rlnorm(30, 2) # scale parameters 215s > for (i in seq_along(min)) 215s + { 215s + m <- min[i] 215s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 215s + Be <- beta(a, t) 215s + Ga <- gamma(a) 215s + for (s in scpar) 215s + { 215s + stopifnot(exprs = { 215s + All.eq(mfpareto(1, min = m, 215s + shape1 = a, shape2 = g, shape3 = t, 215s + scale = s), 215s + m * (Be + (s/m) * beta(t + 1/g, a - 1/g))/Be) 215s + All.eq(mfpareto(2, min = m, 215s + shape1 = a, shape2 = g, shape3 = t, 215s + scale = s), 215s + m^2 * (Be + 2 * (s/m) * beta(t + 1/g, a - 1/g) 215s + + (s/m)^2 * beta(t + 2/g, a - 2/g))/Be) 215s + All.eq(mfpareto(3, min = m, 215s + shape1 = a, shape2 = g, shape3 = t, 215s + scale = s), 215s + m^3 * (Be + 3 * (s/m) * beta(t + 1/g, a - 1/g) 215s + + 3 * (s/m)^2 * beta(t + 2/g, a - 2/g) 215s + + (s/m)^3 * beta(t + 3/g, a - 3/g))/Be) 215s + }) 215s + stopifnot(exprs = { 215s + All.eq(mpareto4(1, min = m, 215s + shape1 = a, shape2 = g, 215s + scale = s), 215s + m * (Ga + (s/m) * gamma(1 + 1/g) * gamma(a - 1/g))/Ga) 215s + All.eq(mpareto4(2, min = m, 215s + shape1 = a, shape2 = g, 215s + scale = s), 215s + m^2 * (Ga + 2 * (s/m) * gamma(1 + 1/g) * gamma(a - 1/g) 215s + + (s/m)^2 * gamma(1 + 2/g) * gamma(a - 2/g))/Ga) 215s + All.eq(mpareto4(3, min = m, 215s + shape1 = a, shape2 = g, 215s + scale = s), 215s + m^3 * (Ga + 3 * (s/m) * gamma(1 + 1/g) * gamma(a - 1/g) 215s + + 3 * (s/m)^2 * gamma(1 + 2/g) * gamma(a - 2/g) 215s + + (s/m)^3 * gamma(1 + 3/g) * gamma(a - 3/g))/Ga) 215s + }) 215s + stopifnot(exprs = { 215s + All.eq(mpareto3(1, min = m, 215s + shape = g, 215s + scale = s), 215s + m * (1 + (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g))) 215s + All.eq(mpareto3(2, min = m, 215s + shape = g, 215s + scale = s), 215s + m^2 * (1 + 2 * (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g) 215s + + (s/m)^2 * gamma(1 + 2/g) * gamma(1 - 2/g))) 215s + All.eq(mpareto3(3, min = m, 215s + shape = g, 215s + scale = s), 215s + m^3 * (1 + 3 * (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g) 215s + + 3 * (s/m)^2 * gamma(1 + 2/g) * gamma(1 - 2/g) 215s + + (s/m)^3 * gamma(1 + 3/g) * gamma(1 - 3/g))) 215s + }) 215s + stopifnot(exprs = { 215s + All.eq(mpareto2(1, min = m, 215s + shape = a, 215s + scale = s), 215s + m * (Ga + (s/m) * gamma(1 + 1) * gamma(a - 1))/Ga) 215s + All.eq(mpareto2(2, min = m, 215s + shape = a, 215s + scale = s), 215s + m^2 * (Ga + 2 * (s/m) * gamma(1 + 1) * gamma(a - 1) 215s + + (s/m)^2 * gamma(1 + 2) * gamma(a - 2))/Ga) 215s + All.eq(mpareto2(3, min = m, 215s + shape = a, 215s + scale = s), 215s + m^3 * (Ga + 3 * (s/m) * gamma(1 + 1) * gamma(a - 1) 215s + + 3 * (s/m)^2 * gamma(1 + 2) * gamma(a - 2) 215s + + (s/m)^3 * gamma(1 + 3) * gamma(a - 3))/Ga) 215s + }) 215s + } 215s + } 216s > 216s > ## Tests for first three limited moments 216s > ## 216s > ## Limits are taken from quantiles of each distribution. 216s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) 216s > for (i in seq_along(min)) 216s + { 216s + m <- min[i] 216s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 216s + Ga <- gamma(a) 216s + Gt <- gamma(t) 216s + for (s in scpar) 216s + { 216s + limit <- qfpareto(q, min = m, 216s + shape1 = a, shape2 = g, shape3 = t, 216s + scale = s) 216s + y <- (limit - m)/s 216s + u <- 1/(1 + y^(-g)) 216s + stopifnot(exprs = { 216s + All.eq(levfpareto(limit, order = 1, min = m, 216s + shape1 = a, shape2 = g, shape3 = t, 216s + scale = s), 216s + m * (betaint(u, t, a) + (s/m) * betaint(u, t + 1/g, a - 1/g))/(Ga * Gt) + 216s + limit * pbeta(u, t, a, lower = FALSE)) 216s + All.eq(levfpareto(limit, order = 2, min = m, 216s + shape1 = a, shape2 = g, shape3 = t, 216s + scale = s), 216s + m^2 * (betaint(u, t, a) + 2 * (s/m) * betaint(u, t + 1/g, a - 1/g) 216s + + (s/m)^2 * betaint(u, t + 2/g, a - 2/g))/(Ga * Gt) + 216s + limit^2 * pbeta(u, t, a, lower = FALSE)) 216s + All.eq(levfpareto(limit, order = 3, min = m, 216s + shape1 = a, shape2 = g, shape3 = t, 216s + scale = s), 216s + m^3 * (betaint(u, t, a) + 3 * (s/m) * betaint(u, t + 1/g, a - 1/g) 216s + + 3 * (s/m)^2 * betaint(u, t + 2/g, a - 2/g) 216s + + (s/m)^3 * betaint(u, t + 3/g, a - 3/g))/(Ga * Gt) + 216s + limit^3 * pbeta(u, t, a, lower = FALSE)) 216s + }) 216s + limit <- qpareto4(q, min = m, 216s + shape1 = a, shape2 = g, 216s + scale = s) 216s + y <- (limit - m)/s 216s + u <- 1/(1 + y^g) 216s + u1m <- 1/(1 + y^(-g)) 216s + stopifnot(exprs = { 216s + All.eq(levpareto4(limit, order = 1, min = m, 216s + shape1 = a, shape2 = g, 216s + scale = s), 216s + m * (betaint(u1m, 1, a) + (s/m) * betaint(u1m, 1 + 1/g, a - 1/g))/Ga + 216s + limit * u^a) 216s + All.eq(levpareto4(limit, order = 2, min = m, 216s + shape1 = a, shape2 = g, 216s + scale = s), 216s + m^2 * (betaint(u1m, 1, a) + 2 * (s/m) * betaint(u1m, 1 + 1/g, a - 1/g) 216s + + (s/m)^2 * betaint(u1m, 1 + 2/g, a - 2/g))/Ga + 216s + limit^2 * u^a) 216s + All.eq(levpareto4(limit, order = 3, min = m, 216s + shape1 = a, shape2 = g, 216s + scale = s), 216s + m^3 * (betaint(u1m, 1, a) + 3 * (s/m) * betaint(u1m, 1 + 1/g, a - 1/g) 216s + + 3 * (s/m)^2 * betaint(u1m, 1 + 2/g, a - 2/g) 216s + + (s/m)^3 * betaint(u1m, 1 + 3/g, a - 3/g))/Ga + 216s + limit^3 * u^a) 216s + }) 216s + limit <- qpareto3(q, min = m, 216s + shape = g, 216s + scale = s) 216s + y <- (limit - m)/s 216s + u <- 1/(1 + y^(-g)) 216s + u1m <- 1/(1 + y^g) 216s + stopifnot(exprs = { 216s + All.eq(levpareto3(limit, order = 1, min = m, 216s + shape = g, 216s + scale = s), 216s + m * (u + (s/m) * betaint(u, 1 + 1/g, 1 - 1/g)) + 216s + limit * u1m) 216s + All.eq(levpareto3(limit, order = 2, min = m, 216s + shape = g, 216s + scale = s), 216s + m^2 * (u + 2 * (s/m) * betaint(u, 1 + 1/g, 1 - 1/g) 216s + + (s/m)^2 * betaint(u, 1 + 2/g, 1 - 2/g)) + 216s + limit^2 * u1m) 216s + All.eq(levpareto3(limit, order = 3, min = m, 216s + shape = g, 216s + scale = s), 216s + m^3 * (u + 3 * (s/m) * betaint(u, 1 + 1/g, 1 - 1/g) 216s + + 3 * (s/m)^2 * betaint(u, 1 + 2/g, 1 - 2/g) 216s + + (s/m)^3 * betaint(u, 1 + 3/g, 1 - 3/g)) + 216s + limit^3 * u1m) 216s + }) 216s + limit <- qpareto2(q, min = m, 216s + shape = a, 216s + scale = s) 216s + y <- (limit - m)/s 216s + u <- 1/(1 + y) 216s + u1m <- 1/(1 + y^(-1)) 216s + stopifnot(exprs = { 216s + All.eq(levpareto2(limit, order = 1, min = m, 216s + shape = a, 216s + scale = s), 216s + m * (betaint(u1m, 1, a) + (s/m) * betaint(u1m, 1 + 1, a - 1))/Ga + 216s + limit * u^a) 216s + All.eq(levpareto2(limit, order = 2, min = m, 216s + shape = a, 216s + scale = s), 216s + m^2 * (betaint(u1m, 1, a) + 2 * (s/m) * betaint(u1m, 1 + 1, a - 1) 216s + + (s/m)^2 * betaint(u1m, 1 + 2, a - 2))/Ga + 216s + limit^2 * u^a) 216s + All.eq(levpareto2(limit, order = 3, min = m, 216s + shape = a, 216s + scale = s), 216s + m^3 * (betaint(u1m, 1, a) + 3 * (s/m) * betaint(u1m, 1 + 1, a - 1) 216s + + 3 * (s/m)^2 * betaint(u1m, 1 + 2, a - 2) 216s + + (s/m)^3 * betaint(u1m, 1 + 3, a - 3))/Ga + 216s + limit^3 * u^a) 216s + }) 216s + } 216s + } 217s > 217s > ## 217s > ## TRANSFORMED BETA FAMILY 217s > ## 217s > 217s > ## Density: first check that functions return 0 when scale = Inf, and 217s > ## when x = scale = Inf. 217s > stopifnot(exprs = { 217s + dtrbeta (c(42, Inf), shape1 = 2, shape2 = 3, shape3 = 4, scale = Inf) == c(0, 0) 217s + dburr (c(42, Inf), shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 217s + dllogis (c(42, Inf), shape = 3, scale = Inf) == c(0, 0) 217s + dparalogis (c(42, Inf), shape = 2, scale = Inf) == c(0, 0) 217s + dgenpareto (c(42, Inf), shape1 = 2, shape2 = 4, scale = Inf) == c(0, 0) 217s + dpareto (c(42, Inf), shape = 2, scale = Inf) == c(0, 0) 217s + dinvburr (c(42, Inf), shape1 = 4, shape2 = 3, scale = Inf) == c(0, 0) 217s + dinvpareto (c(42, Inf), shape = 4, scale = Inf) == c(0, 0) 217s + dinvparalogis(c(42, Inf), shape = 4, scale = Inf) == c(0, 0) 217s + }) 217s > 217s > ## Next test density functions for an array of standard values. 217s > set.seed(123) # reset the seed 217s > nshpar <- 3 # (maximum) number of shape parameters 217s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 217s > scpar <- rlnorm(30, 2) # scale parameters 217s > for (i in seq_along(shpar)) 217s + { 217s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 217s + Be <- beta(a, t) 217s + for (s in scpar) 217s + { 217s + x <- rtrbeta(100, shape1 = a, shape2 = g, shape3 = t, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^(-g)) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dtrbeta(x, shape1 = a, shape2 = g, shape3 = t, 217s + scale = s), 217s + d2 <- dtrbeta(y, shape1 = a, shape2 = g, shape3 = t, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + g * y^(g*t - 1)/(s * Be * (1 + y^g)^(a + t)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + g * u^t * (1 - u)^a/(x * Be), 217s + tolerance = 1e-10) 217s + }) 217s + x <- rburr(100, shape1 = a, shape2 = g, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^g) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dburr(x, shape1 = a, shape2 = g, 217s + scale = s), 217s + d2 <- dburr(y, shape1 = a, shape2 = g, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + a * g * y^(g - 1)/(s * (1 + y^g)^(a + 1)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + a * g * u^a * (1 - u)/x, 217s + tolerance = 1e-10) 217s + }) 217s + x <- rllogis(100, shape = g, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^(-g)) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dllogis(x, shape = g, 217s + scale = s), 217s + d2 <- dllogis(y, shape = g, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + g * y^(g - 1)/(s * (1 + y^g)^2), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + g * u * (1 - u)/x, 217s + tolerance = 1e-10) 217s + }) 217s + x <- rparalogis(100, shape = a, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^a) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dparalogis(x, shape = a, 217s + scale = s), 217s + d2 <- dparalogis(y, shape = a, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + a^2 * y^(a - 1)/(s * (1 + y^a)^(a + 1)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + a^2 * u^a * (1 - u)/x, 217s + tolerance = 1e-10) 217s + }) 217s + x <- rgenpareto(100, shape1 = a, shape2 = t, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^(-1)) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dgenpareto(x, shape1 = a, shape2 = t, 217s + scale = s), 217s + d2 <- dgenpareto(y, shape1 = a, shape2 = t, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + y^(t - 1)/(s * Be * (1 + y)^(a + t)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + u^t * (1 - u)^a/(x * Be), 217s + tolerance = 1e-10) 217s + }) 217s + x <- rpareto(100, shape = a, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dpareto(x, shape = a, 217s + scale = s), 217s + d2 <- dpareto(y, shape = a, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + a/(s * (1 + y)^(a + 1)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + a * u^a * (1 - u)/x, 217s + tolerance = 1e-10) 217s + }) 217s + x <- rpareto1(100, min = s, shape = a) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dpareto1(x, min = s, shape = a), 217s + a * s^a/(x^(a + 1)), 217s + tolerance = 1e-10) 217s + }) 217s + x <- rinvburr(100, shape1 = t, shape2 = g, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^(-g)) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dinvburr(x, shape1 = t, shape2 = g, 217s + scale = s), 217s + d2 <- dinvburr(y, shape1 = t, shape2 = g, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + t * g * y^(g*t - 1)/(s * (1 + y^g)^(t + 1)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + t * g * u^t * (1 - u)/x, 217s + tolerance = 1e-10) 217s + }) 217s + x <- rinvpareto(100, shape = t, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^(-1)) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dinvpareto(x, shape = t, 217s + scale = s), 217s + d2 <- dinvpareto(y, shape = t, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + t * y^(t - 1)/(s * (1 + y)^(t + 1)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + t * u^t * (1 - u)/x, 217s + tolerance = 1e-10) 217s + }) 217s + x <- rinvparalogis(100, shape = t, scale = s) 217s + y <- x/s 217s + u <- 1/(1 + y^(-t)) 217s + stopifnot(exprs = { 217s + all.equal(d1 <- dinvparalogis(x, shape = t, 217s + scale = s), 217s + d2 <- dinvparalogis(y, shape = t, 217s + scale = 1)/s, 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + t^2 * y^(t^2 - 1)/(s * (1 + y^t)^(t + 1)), 217s + tolerance = 1e-10) 217s + all.equal(d1, 217s + t^2 * u^t * (1 - u)/x, 217s + tolerance = 1e-10) 217s + }) 217s + } 217s + } 218s > 218s > ## Tests on the cumulative distribution function. 218s > ## 218s > ## Note: when shape1 = shape3 = 1, the underlying beta distribution is 218s > ## a uniform. Therefore, ptrbeta(x, 1, shape2, 1, scale) should return 218s > ## the value of u = v/(1 + v), v = (x/scale)^shape2. 218s > ## 218s > ## x = 2/Meps = 2^53 (with, shape2 = scale = 1) is the value where the 218s > ## cdf would jump to 1 if we weren't using the trick to compute the 218s > ## cdf with pbeta(1 - u, ..., lower = FALSE). 218s > scLrg <- 1e300 * c(0.5, 1, 2) 218s > stopifnot(exprs = { 218s + ptrbeta(Inf, 1, 2, 3, scale = xMax) == 1 218s + ptrbeta(2^53, 1, 1, 1, scale = 1) != 1 218s + all.equal(ptrbeta(xMin, 1, 1, 1, scale = 1), xMin) 218s + all.equal(ptrbeta(1e300, 218s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 218s + shape3 = 1, 218s + scale = scLrg, log = TRUE), 218s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 218s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE), 218s + pbeta(c(4/5, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 218s + pbeta(4/5, 3, 1, lower.tail = FALSE, log = TRUE))) 218s + }) 218s > stopifnot(exprs = { 218s + pburr(Inf, 1, 3, scale = xMax) == 1 218s + pburr(2^53, 1, 1, scale = 1) != 1 218s + all.equal(pburr(xMin, 1, 1, scale = 1), xMin) 218s + all.equal(pburr(1e300, 218s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 218s + scale = scLrg, log = TRUE), 218s + c(log(1 - c(1/3, 1/2, 2/3)^3), 218s + log(1 - c(1/5, 1/2, 4/5)^3))) 218s + }) 218s > stopifnot(exprs = { 218s + pllogis(Inf, 3, scale = xMax) == 1 218s + pllogis(2^53, 1, scale = 1) != 1 218s + all.equal(pllogis(xMin, 1, scale = 1), xMin) 218s + all.equal(pllogis(1e300, 218s + shape = rep(c(1, 2), each = length(scLrg)), 218s + scale = scLrg, log = TRUE), 218s + c(log(c(2/3, 1/2, 1/3)), 218s + log(c(4/5, 1/2, 1/5)))) 218s + }) 218s > stopifnot(exprs = { 218s + pparalogis(Inf, 3, scale = xMax) == 1 218s + pparalogis(2^53, 1, scale = 1) != 1 218s + all.equal(pparalogis(xMin, 1, scale = 1), xMin) 218s + all.equal(pparalogis(1e300, 218s + shape = rep(c(2, 3), each = length(scLrg)), 218s + scale = scLrg, log = TRUE), 218s + c(log(1 - c(1/5, 1/2, 4/5)^2), 218s + log(1 - c(1/9, 1/2, 8/9)^3))) 218s + }) 218s > stopifnot(exprs = { 218s + pgenpareto(Inf, 1, 3, scale = xMax) == 1 218s + pgenpareto(2^53, 1, 1, scale = 1) != 1 218s + all.equal(pgenpareto(xMin, 1, 1, scale = 1), xMin) 218s + all.equal(pgenpareto(1e300, 218s + shape1 = 3, shape2 = 1, 218s + scale = scLrg, log = TRUE), 218s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 218s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE))) 218s + }) 218s > stopifnot(exprs = { 218s + ppareto(Inf, 3, scale = xMax) == 1 218s + ppareto(2^53, 1, scale = 1) != 1 218s + all.equal(ppareto(xMin, 1, scale = 1), xMin) 218s + all.equal(ppareto(1e300, 218s + shape = 3, 218s + scale = scLrg, log = TRUE), 218s + c(log(1 - c(1/3, 1/2, 2/3)^3))) 218s + }) 218s > stopifnot(exprs = { 218s + ppareto1(Inf, 3, min = xMax) == 1 218s + ppareto1(2^53, 1, min = 1) != 1 218s + all.equal(ppareto1(xMin, 1, min = 1), xMin) 218s + all.equal(ppareto1(1e300, 218s + shape = 3, 218s + min = 1e300 * c(0.001, 0.1, 0.5), log = TRUE), 218s + c(log(1 - c(0.001, 0.1, 0.5)^3))) 218s + }) 218s > stopifnot(exprs = { 218s + pinvburr(Inf, 1, 3, scale = xMax) == 1 218s + pinvburr(2^53, 1, 1, scale = 1) != 1 218s + all.equal(pinvburr(xMin, 1, 1, scale = 1), xMin) 218s + all.equal(pinvburr(1e300, 218s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 218s + scale = scLrg, log = TRUE), 218s + c(log(c(2/3, 1/2, 1/3)^3), 218s + log(c(4/5, 1/2, 1/5)^3))) 218s + }) 218s > stopifnot(exprs = { 218s + pinvpareto(Inf, 3, scale = xMax) == 1 218s + pinvpareto(2^53, 1, scale = 1) != 1 218s + all.equal(pinvpareto(xMin, 1, scale = 1), xMin) 218s + all.equal(pinvpareto(1e300, 218s + shape = 3, 218s + scale = scLrg, log = TRUE), 218s + c(log(c(2/3, 1/2, 1/3)^3))) 218s + }) 218s > stopifnot(exprs = { 218s + pinvparalogis(Inf, 3, scale = xMax) == 1 218s + pinvparalogis(2^53, 1, scale = 1) != 1 218s + all.equal(pinvparalogis(xMin, 1, scale = 1), xMin) 218s + all.equal(pinvparalogis(1e300, 218s + shape = rep(c(2, 3), each = length(scLrg)), 218s + scale = scLrg, log = TRUE), 218s + c(log(c(4/5, 1/2, 1/5)^2), 218s + log(c(8/9, 1/2, 1/9)^3))) 218s + }) 218s > 218s > ## Also check that distribution functions return 0 when scale = Inf. 218s > stopifnot(exprs = { 218s + ptrbeta (x, shape1 = a, shape2 = g, shape3 = t, scale = Inf) == 0 218s + pburr (x, shape1 = a, shape2 = g, scale = Inf) == 0 218s + pllogis (x, shape = g, scale = Inf) == 0 218s + pparalogis (x, shape = a, scale = Inf) == 0 218s + pgenpareto (x, shape1 = a, shape2 = t, scale = Inf) == 0 218s + ppareto (x, shape = a, scale = Inf) == 0 218s + pinvburr (x, shape1 = t, shape2 = g, scale = Inf) == 0 218s + pinvpareto (x, shape = t, scale = Inf) == 0 218s + pinvparalogis(x, shape = t, scale = Inf) == 0 218s + }) 218s > 218s > ## Tests for first three positive moments and first two negative 218s > ## moments. 218s > ## 218s > ## Simulation of new parameters ensuring that said moments exist. 218s > set.seed(123) # reset the seed 218s > nshpar <- 3 # (maximum) number of shape parameters 218s > shpar <- replicate(30, c(3, 3, 3) + rlnorm(nshpar, 2), simplify = FALSE) 218s > scpar <- rlnorm(30, 2) # scale parameters 218s > k <- c(-2, -1, 1, 2, 3) # orders 218s > for (i in seq_along(shpar)) 218s + { 218s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 218s + Be <- beta(a, t) 218s + Ga <- gamma(a) 218s + for (s in scpar) 218s + { 218s + stopifnot(exprs = { 218s + All.eq(mtrbeta(k, shape1 = a, shape2 = g, shape3 = t, scale = s), 218s + s^k * beta(t + k/g, a - k/g)/Be) 218s + All.eq(mburr(k, shape1 = a, shape2 = g, scale = s), 218s + s^k * gamma(1 + k/g) * gamma(a - k/g)/Ga) 218s + All.eq(mllogis(k, shape = g, scale = s), 218s + s^k * gamma(1 + k/g) * gamma(1 - k/g)) 218s + All.eq(mparalogis(k, shape = a, scale = s), 218s + s^k * gamma(1 + k/a) * gamma(a - k/a)/Ga) 218s + All.eq(mgenpareto(k, shape1 = a, shape2 = t, scale = s), 218s + s^k * beta(t + k, a - k)/Be) 218s + All.eq(mpareto(k[k > -1], shape = a, scale = s), 218s + s^k[k > -1] * gamma(1 + k[k > -1]) * gamma(a - k[k > -1])/Ga) 218s + All.eq(mpareto1(k, shape = a, min = s), 218s + s^k * a/(a - k)) 218s + All.eq(minvburr(k, shape1 = a, shape2 = g, scale = s), 218s + s^k * gamma(a + k/g) * gamma(1 - k/g)/Ga) 218s + All.eq(minvpareto(k[k < 1], shape = a, scale = s), 218s + s^k[k < 1] * gamma(a + k[k < 1]) * gamma(1 - k[k < 1])/Ga) 218s + All.eq(minvparalogis(k, shape = a, scale = s), 218s + s^k * gamma(a + k/a) * gamma(1 - k/a)/Ga) 218s + }) 218s + } 218s + } 219s > 219s > ## Tests for first three positive limited moments and first two 219s > ## negative limited moments. 219s > ## 219s > ## Limits are taken from quantiles of each distribution. 219s > order <- c(-2, -1, 1, 2, 3) # orders 219s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 219s > for (i in seq_along(shpar)) 219s + { 219s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 219s + Ga <- gamma(a) 219s + Gt <- gamma(t) 219s + for (s in scpar) 219s + { 219s + limit <- qtrbeta(q, shape1 = a, shape2 = g, shape3 = t, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^(-g)) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levtrbeta(limit, order = k, shape1 = a, shape2 = g, shape3 = t, scale = s), 219s + s^k * betaint(u, t + k/g, a - k/g)/(Ga * Gt) + 219s + limit^k * pbeta(u, t, a, lower = FALSE)) 219s + }) 219s + limit <- qburr(q, shape1 = a, shape2 = g, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^g) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levburr(limit, order = k, shape1 = a, shape2 = g, scale = s), 219s + s^k * betaint(1 - u, 1 + k/g, a - k/g)/Ga + 219s + limit^k * u^a) 219s + }) 219s + limit <- qllogis(q, shape = g, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^(-g)) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levllogis(limit, order = k, shape = g, scale = s), 219s + s^k * betaint(u, 1 + k/g, 1 - k/g) + 219s + limit^k * (1 - u)) 219s + }) 219s + limit <- qparalogis(q, shape = a, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^a) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levparalogis(limit, order = k, shape = a, scale = s), 219s + s^k * betaint(1 - u, 1 + k/a, a - k/a)/Ga + 219s + limit^k * u^a) 219s + }) 219s + limit <- qgenpareto(q, shape1 = a, shape2 = t, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^(-1)) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levgenpareto(limit, order = k, shape1 = a, shape2 = t, scale = s), 219s + s^k * betaint(u, t + k, a - k)/(Ga * Gt) + 219s + limit^k * pbeta(u, t, a, lower = FALSE)) 219s + }) 219s + limit <- qpareto(q, shape = a, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y) 219s + for (k in order[order > -1]) 219s + stopifnot(exprs = { 219s + All.eq(levpareto(limit, order = k, shape = a, scale = s), 219s + s^k * betaint(1 - u, 1 + k, a - k)/Ga + 219s + limit^k * u^a) 219s + }) 219s + limit <- qpareto1(q, shape = a, min = s) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levpareto1(limit, order = k, shape = a, min = s), 219s + s^k * a/(a - k) - k * s^a/((a - k) * limit^(a - k))) 219s + }) 219s + limit <- qinvburr(q, shape1 = a, shape2 = g, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^(-g)) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levinvburr(limit, order = k, shape1 = a, shape2 = g, scale = s), 219s + s^k * betaint(u, a + k/g, 1 - k/g)/Ga + 219s + limit^k * (1 - u^a)) 219s + }) 219s + limit <- qinvpareto(q, shape = a, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^(-1)) 219s + for (k in order[order < 1]) 219s + stopifnot(exprs = { 219s + All.eq(levinvpareto(limit, order = k, shape = a, scale = s), 219s + s^k * a * 219s + sapply(u, 219s + function(upper) 219s + integrate(function(x) x^(a+k-1) * (1-x)^(-k), 219s + lower = 0, upper = upper)$value) + 219s + limit^k * (1 - u^a)) 219s + }) 219s + limit <- qinvparalogis(q, shape = a, scale = s) 219s + y <- limit/s 219s + u <- 1/(1 + y^(-a)) 219s + for (k in order) 219s + stopifnot(exprs = { 219s + All.eq(levinvparalogis(limit, order = k, shape = a, scale = s), 219s + s^k * betaint(u, a + k/a, 1 - k/a)/Ga + 219s + limit^k * (1 - u^a)) 219s + }) 219s + } 219s + } 222s > 222s > ## 222s > ## TRANSFORMED GAMMA AND INVERSE TRANSFORMED GAMMA FAMILIES 222s > ## 222s > 222s > ## Density: first check that functions return 0 when scale = Inf, and 222s > ## when x = scale = Inf (transformed gamma), or when scale = 0 and 222s > ## when x = scale = 0 (inverse distributions). 222s > stopifnot(exprs = { 222s + dtrgamma (c(42, Inf), shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 222s + dinvtrgamma(c(42, 0), shape1 = 2, shape2 = 3, scale = 0) == c(0, 0) 222s + dinvgamma (c(42, 0), shape = 2, scale = 0) == c(0, 0) 222s + dinvweibull(c(42, 0), shape = 3, scale = 0) == c(0, 0) 222s + dinvexp (c(42, 0), scale = 0) == c(0, 0) 222s + }) 222s > 222s > ## Tests on the density 222s > set.seed(123) # reset the seed 222s > nshpar <- 2 # (maximum) number of shape parameters 222s > shpar <- replicate(30, rgamma(nshpar, 5), simplify = FALSE) 222s > scpar <- rlnorm(30, 2) # scale parameters 222s > for (i in seq_along(shpar)) 222s + { 222s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 222s + Ga <- gamma(a) 222s + for (s in scpar) 222s + { 222s + x <- rtrgamma(100, shape1 = a, shape2 = t, scale = s) 222s + y <- x/s 222s + u <- y^t 222s + stopifnot(exprs = { 222s + all.equal(d1 <- dtrgamma(x, shape1 = a, shape2 = t, 222s + scale = s), 222s + d2 <- dtrgamma(y, shape1 = a, shape2 = t, 222s + scale = 1)/s, 222s + tolerance = 1e-10) 222s + all.equal(d2, 222s + t/(Ga * s^(a * t)) * x^(a * t - 1) * exp(-u), 222s + tolerance = 1e-10) 222s + all.equal(d1, 222s + t/(Ga * x) * u^a * exp(-u), 222s + tolerance = 1e-10) 222s + }) 222s + x <- rinvtrgamma(100, shape1 = a, shape2 = t, scale = s) 222s + y <- x/s 222s + u <- y^(-t) 222s + stopifnot(exprs = { 222s + all.equal(d1 <- dinvtrgamma(x, shape1 = a, shape2 = t, 222s + scale = s), 222s + d2 <- dinvtrgamma(y, shape1 = a, shape2 = t, 222s + scale = 1)/s, 222s + tolerance = 1e-10) 222s + all.equal(d2, 222s + t * s^(a * t)/(Ga * x^(a * t + 1)) * exp(-u), 222s + tolerance = 1e-10) 222s + all.equal(d1, 222s + t/(Ga * x) * u^a * exp(-u), 222s + tolerance = 1e-10) 222s + }) 222s + x <- rinvgamma(100, shape = a, scale = s) 222s + y <- x/s 222s + u <- y^(-1) 222s + stopifnot(exprs = { 222s + all.equal(d1 <- dinvgamma(x, shape = a, scale = s), 222s + d2 <- dinvgamma(y, shape = a, scale = 1)/s, 222s + tolerance = 1e-10) 222s + all.equal(d2, 222s + s^a/(Ga * x^(a + 1)) * exp(-u), 222s + tolerance = 1e-10) 222s + all.equal(d1, 222s + 1/(Ga * x) * u^a * exp(-u), 222s + tolerance = 1e-10) 222s + }) 222s + x <- rinvweibull(100, shape = t, scale = s) 222s + y <- x/s 222s + u <- y^(-t) 222s + stopifnot(exprs = { 222s + all.equal(d1 <- dinvweibull(x, shape = t, scale = s), 222s + d2 <- dinvweibull(y, shape = t, scale = 1)/s, 222s + tolerance = 1e-10) 222s + all.equal(d2, 222s + t * s^t/x^(t + 1) * exp(-u), 222s + tolerance = 1e-10) 222s + all.equal(d1, 222s + t/x * u * exp(-u), 222s + tolerance = 1e-10) 222s + }) 222s + x <- rinvexp(100, scale = s) 222s + y <- x/s 222s + u <- y^(-1) 222s + stopifnot(exprs = { 222s + all.equal(d1 <- dinvexp(x, scale = s), 222s + d2 <- dinvexp(y, scale = 1)/s, 222s + tolerance = 1e-10) 222s + all.equal(d2, 222s + s/x^2 * exp(-u), 222s + tolerance = 1e-10) 222s + all.equal(d1, 222s + 1/x * u * exp(-u), 222s + tolerance = 1e-10) 222s + }) 222s + } 222s + } 223s > 223s > ## Tests on the cumulative distribution function. 223s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf) 223s > stopifnot(exprs = { 223s + ptrgamma(Inf, 2, 3, scale = xMax) == 1 223s + ptrgamma(xMax, 2, 3, scale = xMax) == pgamma(1, 2, 1) 223s + ptrgamma(xMin, 2, 1, scale = 1) == pgamma(xMin, 2, 1) 223s + all.equal(ptrgamma(1e300, shape1 = 2, shape2 = 1, scale = scLrg, log = TRUE), 223s + pgamma(c(5e299, 1e+298, 10, 1, 0.1, 0.01, 1e-7, 1e+300/xMax, 0), 223s + 2, 1, log = TRUE)) 223s + }) 223s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, 0) 223s > stopifnot(exprs = { 223s + pinvtrgamma(Inf, 2, 3, scale = xMax) == 1 223s + pinvtrgamma(xMax, 2, 3, scale = xMax) == pgamma(1, 2, 1, lower = FALSE) 223s + pinvtrgamma(xMin, 2, 1, scale = 1) == pgamma(1/xMin, 2, 1, lower = FALSE) 223s + all.equal(pinvtrgamma(1e300, shape1 = 2, shape2 = 1, scale = scLrg, log = TRUE), 223s + pgamma(c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0), 223s + 2, 1, lower = FALSE, log = TRUE)) 223s + }) 223s > stopifnot(exprs = { 223s + pinvgamma(Inf, 2, scale = xMax) == 1 223s + pinvgamma(xMax, 2, scale = xMax) == pgamma(1, 2, 1, lower = FALSE) 223s + pinvgamma(xMin, 2, scale = 1) == pgamma(1/xMin, 2, 1, lower = FALSE) 223s + all.equal(pinvgamma(1e300, shape = 2, scale = scLrg, log = TRUE), 223s + pgamma(c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0), 223s + 2, 1, lower = FALSE, log = TRUE)) 223s + }) 223s > stopifnot(exprs = { 223s + pinvweibull(Inf, 3, scale = xMax) == 1 223s + pinvweibull(xMax, 3, scale = xMax) == exp(-1) 223s + pinvweibull(xMin, 1, scale = 1) == exp(-1/xMin) 223s + all.equal(pinvweibull(1e300, shape = 1, scale = scLrg, log = TRUE), 223s + -c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0)) 223s + }) 223s > stopifnot(exprs = { 223s + pinvexp(Inf, 3, scale = xMax) == 1 223s + pinvexp(xMax, 3, scale = xMax) == exp(-1) 223s + pinvexp(xMin, 1, scale = 1) == exp(-1/xMin) 223s + all.equal(pinvexp(1e300, scale = scLrg, log = TRUE), 223s + -c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0)) 223s + }) 223s > 223s > ## Tests for first three positive moments and first two negative 223s > ## moments. (Including for the Gamma, Weibull and Exponential 223s > ## distributions of base R.) 223s > ## 223s > ## Simulation of new parameters ensuring that said moments exist. 223s > set.seed(123) # reset the seed 223s > nshpar <- 2 # (maximum) number of shape parameters 223s > shpar <- replicate(30, c(3, 3) + rlnorm(nshpar, 2), simplify = FALSE) 223s > scpar <- rlnorm(30, 2) # scale parameters 223s > k <- c(-2, -1, 1, 2, 3) # orders 223s > for (i in seq_along(shpar)) 223s + { 223s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 223s + Ga <- gamma(a) 223s + for (s in scpar) 223s + { 223s + stopifnot(exprs = { 223s + All.eq(mtrgamma(k, shape1 = a, shape2 = t, scale = s), 223s + s^k * gamma(a + k/t)/Ga) 223s + All.eq(mgamma(k, shape = a, scale = s), 223s + s^k * gamma(a + k)/Ga) 223s + All.eq(mweibull(k, shape = t, scale = s), 223s + s^k * gamma(1 + k/t)) 223s + All.eq(mexp(k[k > -1], rate = 1/s), 223s + s^k[k > -1] * gamma(1 + k[k > -1])) 223s + All.eq(minvtrgamma(k, shape1 = a, shape2 = t, scale = s), 223s + s^k * gamma(a - k/t)/Ga) 223s + All.eq(minvgamma(k, shape = a, scale = s), 223s + s^k * gamma(a - k)/Ga) 223s + All.eq(minvweibull(k, shape = t, scale = s), 223s + s^k * gamma(1 - k/t)) 223s + All.eq(minvexp(k[k < 1], scale = s), 223s + s^k[k < 1] * gamma(1 - k[k < 1])) 223s + }) 223s + } 223s + } 223s > 223s > ## Tests for first three positive limited moments and first two 223s > ## negative limited moments. (Including for the Gamma, Weibull and 223s > ## Exponential distributions of base R.) 223s > ## 223s > ## Limits are taken from quantiles of each distribution. 223s > order <- c(-2, -1, 1, 2, 3) # orders 223s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 223s > for (i in seq_along(shpar)) 223s + { 223s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 223s + Ga <- gamma(a) 223s + for (s in scpar) 223s + { 223s + limit <- qtrgamma(q, shape1 = a, shape2 = t, scale = s) 223s + y <- limit/s 223s + u <- y^t 223s + for (k in order) 223s + stopifnot(exprs = { 223s + All.eq(levtrgamma(limit, order = k, shape1 = a, shape2 = t, scale = s), 223s + s^k * gamma(a + k/t)/Ga * pgamma(u, a + k/t, scale = 1) + 223s + limit^k * pgamma(u, a, scale = 1, lower = FALSE)) 223s + }) 223s + limit <- qgamma(q, shape = a, scale = s) 223s + y <- limit/s 223s + for (k in order) 223s + stopifnot(exprs = { 223s + All.eq(levgamma(limit, order = k, shape = a, scale = s), 223s + s^k * gamma(a + k)/Ga * pgamma(y, a + k, scale = 1) + 223s + limit^k * pgamma(y, a, scale = 1, lower = FALSE)) 223s + }) 223s + limit <- qweibull(q, shape = t, scale = s) 223s + y <- limit/s 223s + u <- y^t 223s + for (k in order) 223s + stopifnot(exprs = { 223s + All.eq(levweibull(limit, order = k, shape = t, scale = s), 223s + s^k * gamma(1 + k/t) * pgamma(u, 1 + k/t, scale = 1) + 223s + limit^k * pgamma(u, 1, scale = 1, lower = FALSE)) 223s + }) 223s + limit <- qexp(q, rate = 1/s) 223s + y <- limit/s 223s + for (k in order[order > -1]) 223s + stopifnot(exprs = { 223s + All.eq(levexp(limit, order = k, rate = 1/s), 223s + s^k * gamma(1 + k) * pgamma(y, 1 + k, scale = 1) + 223s + limit^k * pgamma(y, 1, scale = 1, lower = FALSE)) 223s + }) 223s + limit <- qinvtrgamma(q, shape1 = a, shape2 = t, scale = s) 223s + y <- limit/s 223s + u <- y^(-t) 223s + for (k in order) 223s + stopifnot(exprs = { 223s + All.eq(levinvtrgamma(limit, order = k, shape1 = a, shape2 = t, scale = s), 223s + s^k * (gammainc(a - k/t, u)/Ga) + 223s + limit^k * pgamma(u, a, scale = 1)) 223s + }) 223s + limit <- qinvgamma(q, shape = a, scale = s) 223s + y <- limit/s 223s + u <- y^(-1) 223s + for (k in order) 223s + stopifnot(exprs = { 223s + All.eq(levinvgamma(limit, order = k, shape = a, scale = s), 223s + s^k * (gammainc(a - k, u)/Ga) + 223s + limit^k * pgamma(u, a, scale = 1)) 223s + }) 223s + limit <- qinvweibull(q, shape = t, scale = s) 223s + y <- limit/s 223s + u <- y^(-t) 223s + for (k in order) 223s + stopifnot(exprs = { 223s + All.eq(levinvweibull(limit, order = k, shape = t, scale = s), 223s + s^k * gammainc(1 - k/t, u) + 223s + limit^k * (-expm1(-u))) 223s + }) 223s + limit <- qinvexp(q, scale = s) 223s + y <- limit/s 223s + u <- y^(-1) 223s + for (k in order) 223s + stopifnot(exprs = { 223s + All.eq(levinvexp(limit, order = k, scale = s), 223s + s^k * gammainc(1 - k, u) + 223s + limit^k * (-expm1(-u))) 223s + }) 223s + } 223s + } 225s > 225s > ## 225s > ## OTHER DISTRIBUTIONS 225s > ## 225s > 225s > ## Distributions in this category are quite different, so let's treat 225s > ## them separately. 225s > 225s > ## LOGGAMMA 225s > 225s > ## Tests on the density. 225s > stopifnot(exprs = { 225s + dlgamma(c(42, Inf), shapelog = 2, ratelog = 0) == c(0, 0) 225s + }) 225s > assertWarning(stopifnot(exprs = { 225s + is.nan(dlgamma(c(0, 42, Inf), shapelog = 2, ratelog = Inf)) 225s + })) 225s > x <- rlgamma(100, shapelog = 2, ratelog = 1) 225s > for(a in round(rlnorm(30), 2)) 225s + { 225s + Ga <- gamma(a) 225s + for(r in round(rlnorm(30), 2)) 225s + stopifnot(exprs = { 225s + All.eq(dlgamma(x, shapelog = a, ratelog = r), 225s + r^a * (log(x))^(a - 1)/(Ga * x^(r + 1))) 225s + }) 225s + } 225s > 225s > ## Tests on the cumulative distribution function. 225s > assertWarning(stopifnot(exprs = { 225s + is.nan(plgamma(Inf, 1, ratelog = Inf)) 225s + is.nan(plgamma(Inf, Inf, ratelog = Inf)) 225s + })) 225s > scLrg <- log(c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf)) 225s > stopifnot(exprs = { 225s + plgamma(Inf, 2, ratelog = xMax) == 1 225s + plgamma(xMax, 2, ratelog = 0) == 0 225s + all.equal(plgamma(1e300, 2, ratelog = 1/scLrg, log = TRUE), 225s + pgamma(log(1e300), 2, scale = scLrg, log = TRUE)) 225s + }) 225s > 225s > ## Tests for first three positive moments and first two negative 225s > ## moments. 225s > k <- c(-2, -1, 1, 2, 3) # orders 225s > for(a in round(rlnorm(30), 2)) 225s + { 225s + Ga <- gamma(a) 225s + for(r in 3 + round(rlnorm(30), 2)) 225s + stopifnot(exprs = { 225s + All.eq(mlgamma(k, shapelog = a, ratelog = r), 225s + (1 - k/r)^(-a)) 225s + }) 225s + } 225s > 225s > ## Tests for first three positive limited moments and first two 225s > ## negative limited moments. 225s > order <- c(-2, -1, 1, 2, 3) # orders 225s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 225s > for(a in round(rlnorm(30), 2)) 225s + { 225s + Ga <- gamma(a) 225s + for(r in 3 + round(rlnorm(30), 2)) 225s + { 225s + limit <- qlgamma(q, shapelog = a, ratelog = r) 225s + for (k in order) 225s + { 225s + u <- log(limit) 225s + stopifnot(exprs = { 225s + All.eq(levlgamma(limit, order = k, shapelog = a, ratelog = r), 225s + (1 - k/r)^(-a) * pgamma((r - k) * u, a, scale = 1) + 225s + limit^k * pgamma(r * u, a, scale = 1,lower = FALSE)) 225s + }) 225s + } 225s + } 225s + } 226s > 226s > ## GUMBEL 226s > 226s > ## Tests on the density. 226s > stopifnot(exprs = { 226s + dgumbel(c(1, 3, Inf), alpha = 2, scale = Inf) == c(0, 0, 0) 226s + dgumbel(c(1, 2, 3), alpha = 2, scale = 0) == c(0, Inf, 0) 226s + dgumbel(c(-Inf, Inf), alpha = 1, scale = 1) == c(0, 0) 226s + dgumbel(1, alpha = Inf, scale = 1) == 0 226s + }) 226s > assertWarning(stopifnot(exprs = { 226s + is.nan(dgumbel(Inf, alpha = Inf, scale = 1)) 226s + is.nan(dgumbel(-Inf, alpha = -Inf, scale = 1)) 226s + is.nan(dgumbel(Inf, alpha = 1, scale = -1)) 226s + is.nan(dgumbel(1, alpha = 1, scale = -1)) 226s + is.nan(dgumbel(1, alpha = Inf, scale = -1)) 226s + })) 226s > x <- rgumbel(100, alpha = 2, scale = 5) 226s > for(a in round(rlnorm(30), 2)) 226s + { 226s + Ga <- gamma(a) 226s + for(s in round(rlnorm(30), 2)) 226s + { 226s + u <- (x - a)/s 226s + stopifnot(exprs = { 226s + All.eq(dgumbel(x, alpha = a, scale = s), 226s + exp(-(u + exp(-u)))/s) 226s + }) 226s + } 226s + } 226s > 226s > ## Tests on the cumulative distribution function. 226s > assertWarning(stopifnot(exprs = { 226s + is.nan(pgumbel(Inf, alpha = Inf, scale = 1)) 226s + is.nan(pgumbel(-Inf, alpha = -Inf, scale = 1)) 226s + is.nan(pgumbel(Inf, alpha = 1, scale = -1)) 226s + is.nan(pgumbel(1, alpha = 1, scale = -1)) 226s + is.nan(pgumbel(1, alpha = Inf, scale = -1)) 226s + })) 226s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf) 226s > stopifnot(exprs = { 226s + pgumbel(c(-Inf, Inf), 2, scale = xMax) == c(0, 1) 226s + pgumbel(c(xMin, xMax), 2, scale = 0) == c(0, 1) 226s + all.equal(pgumbel(1e300, 0, scale = scLrg, log = TRUE), 226s + -exp(-c(5e299, 1e+298, 10, 1, 0.1, 0.01, 1e-7, 1e+300/xMax, 0))) 226s + }) 226s > 226s > ## Test the first two moments, the only ones implemented. 226s > assertWarning(stopifnot(exprs = { 226s + is.nan(mgumbel(c(-2, -1, 3, 4), alpha = 2, scale = 5)) 226s + })) 226s > stopifnot(exprs = { 226s + All.eq(mgumbel(1, alpha = 2, scale = 5), 226s + 2 + 5 * 0.577215664901532860606512090082) 226s + All.eq(mgumbel(2, alpha = 2, scale = 5), 226s + pi^2 * 25/6 + (2 + 5 * 0.577215664901532860606512090082)^2) 226s + }) 226s > 226s > ## INVERSE GAUSSIAN 226s > 226s > ## Tests on the density. 226s > stopifnot(exprs = { 226s + dinvgauss(c(1, 3, Inf), mean = 2, dispersion = Inf) == c(0, 0, 0) 226s + dinvgauss(c(0, 42, Inf), mean = 2, dispersion = 0) == c(Inf, 0, 0) 226s + dinvgauss(c(0, Inf), mean = 1, dispersion = 1) == c(0, 0) 226s + dinvgauss(1, mean = Inf, dispersion = 2) == dinvgamma(1, 0.5, scale = 0.25) 226s + }) 226s > assertWarning(stopifnot(exprs = { 226s + is.nan(dinvgauss(-Inf, mean = -1, dispersion = 1)) 226s + is.nan(dinvgauss(Inf, mean = 1, dispersion = -1)) 226s + is.nan(dinvgauss(1, mean = 1, dispersion = -1)) 226s + is.nan(dinvgauss(1, mean = Inf, dispersion = -1)) 226s + })) 226s > x <- rinvgauss(100, mean = 2, dispersion = 5) 226s > for(mu in round(rlnorm(30), 2)) 226s + { 226s + for(phi in round(rlnorm(30), 2)) 226s + stopifnot(exprs = { 226s + All.eq(dinvgauss(x, mean = mu, dispersion = phi), 226s + 1/sqrt(2*pi*phi*x^3) * exp(-((x/mu - 1)^2)/(2*phi*x))) 226s + }) 226s + } 226s > 226s > ## Tests on the cumulative distribution function. 226s > assertWarning(stopifnot(exprs = { 226s + is.nan(pinvgauss(-Inf, mean = -Inf, dispersion = 1)) 226s + is.nan(pinvgauss(Inf, mean = 1, dispersion = -1)) 226s + is.nan(pinvgauss(1, mean = Inf, dispersion = -1)) 226s + })) 226s > x <- c(1:50, 10^c(3:10, 20, 50, 150, 250)) 226s > sqx <- sqrt(x) 226s > stopifnot(exprs = { 226s + pinvgauss(c(0, Inf), mean = 2, dispersion = xMax) == c(0, 1) 226s + pinvgauss(c(0, xMax), mean = xMax, dispersion = 0) == c(0, 1) 226s + all.equal(pinvgauss(x, 1, dispersion = 1, log = TRUE), 226s + log(pnorm(sqx - 1/sqx) + exp(2) * pnorm(-sqx - 1/sqx))) 226s + }) 226s > 226s > ## Tests for small value of 'shape'. Added for the patch in 4294e9c. 226s > q <- runif(100) 226s > stopifnot(exprs = { 226s + all.equal(q, 226s + pinvgauss(qinvgauss(q, 0.1, 1e-2), 0.1, 1e-2)) 226s + all.equal(q, 226s + pinvgauss(qinvgauss(q, 0.1, 1e-6), 0.1, 1e-6)) 226s + }) 226s > 226s > ## Tests for first three positive, integer moments. 226s > k <- 1:3 226s > for(mu in round(rlnorm(30), 2)) 226s + { 226s + for(phi in round(rlnorm(30), 2)) 226s + stopifnot(exprs = { 226s + All.eq(minvgauss(k, mean = mu, dispersion = phi), 226s + c(mu, 226s + mu^2 * (1 + phi * mu), 226s + mu^3 * (1 + 3 * phi * mu + 3 * (phi * mu)^2))) 226s + }) 226s + } 226s > 226s > ## Tests for limited expected value. 226s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 226s > for(mu in round(rlnorm(30), 2)) 226s + { 226s + for(phi in round(rlnorm(30), 2)) 226s + { 226s + limit <- qinvgauss(q, mean = mu, dispersion = phi) 226s + stopifnot(exprs = { 226s + All.eq(levinvgauss(limit, mean = mu, dispersion = phi), 226s + mu * (pnorm((limit/mu - 1)/sqrt(phi * limit)) - 226s + exp(2/phi/mu) * pnorm(-(limit/mu + 1)/sqrt(phi * limit))) + 226s + limit * pinvgauss(limit, mean = mu, dispersion = phi, lower = FALSE)) 226s + }) 226s + } 226s + } 226s > 226s > ## GENERALIZED BETA 226s > stopifnot(exprs = { 226s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 0, shape3 = 3, scale = 5) == c(Inf, 0, Inf) 226s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 0, shape3 = 0, scale = 5) == c(Inf, 0, Inf) 226s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 2, shape3 = 0, scale = 5) == c(Inf, 0, 0) 226s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = Inf, shape3 = 3, scale = 5) == c(Inf, 0, 0) 226s + dgenbeta(c(0, 2.5, 5), shape1 = 1, shape2 = Inf, shape3 = 3, scale = 5) == c(Inf, 0, 0) 226s + dgenbeta(c(0, 2.5, 5), shape1 = Inf, shape2 = Inf, shape3 = 3, scale = 5) == c(0, Inf, 0) 226s + dgenbeta(c(0, 2.5, 5), shape1 = Inf, shape2 = Inf, shape3 = Inf, scale = 5) == c(0, 0, Inf) 226s + }) 226s > nshpar <- 3 # number of shape parameters 226s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 226s > scpar <- rlnorm(30, 2) # scale parameters 226s > for (i in seq_along(shpar)) 226s + { 226s + a <- shpar[[c(i, 1)]]; b <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 226s + Be <- beta(a, b) 226s + for (s in scpar) 226s + { 226s + u <- rbeta(100, a, b) 226s + y <- u^(1/t) 226s + x <- s * y 226s + stopifnot(exprs = { 226s + all.equal(d1 <- dgenbeta(x, shape1 = a, shape2 = b, shape3 = t, 226s + scale = s), 226s + d2 <- dgenbeta(y, shape1 = a, shape2 = b, shape3 = t, 226s + scale = 1)/s, 226s + tolerance = 1e-10) 226s + all.equal(d1, 226s + t * y^(a*t - 1) * (1 - y^t)^(b - 1)/(s * Be), 226s + tolerance = 1e-10) 226s + all.equal(d1, 226s + t * u^a * (1 - u)^(b - 1)/(x * Be), 226s + tolerance = 1e-10) 226s + }) 226s + } 226s + } 226s > 226s > ## Tests on the cumulative distribution function. 226s > scLrg <- 1e300 * c(0.5, 1, 2, 4) 226s > stopifnot(exprs = { 226s + all.equal(pgenbeta(1e300, 226s + shape1 = 3, shape2 = 1, 226s + shape3 = rep(c(1, 2), each = length(scLrg)), 226s + scale = scLrg, log = TRUE), 226s + c(0, pbeta(c(1, 1/2, 1/4), 3, 1, log = TRUE), 226s + 0, pbeta(c(1, 1/4, 1/16), 3, 1, log = TRUE))) 226s + }) 226s > 226s > ## Tests for first three positive moments and first two negative 226s > ## moments. 226s > ## 226s > ## Simulation of new parameters ensuring that said moments exist. 226s > set.seed(123) # reset the seed 226s > nshpar <- 3 # number of shape parameters 226s > shpar <- replicate(30, sqrt(c(3, 0, 3)) + rlnorm(nshpar, 2), simplify = FALSE) 226s > scpar <- rlnorm(30, 2) # scale parameters 226s > k <- c(-2, -1, 1, 2, 3) # orders 226s > for (i in seq_along(shpar)) 226s + { 226s + a <- shpar[[c(i, 1)]]; b <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 226s + Be <- beta(a, b) 226s + for (s in scpar) 226s + stopifnot(exprs = { 226s + All.eq(mgenbeta(k, shape1 = a, shape2 = b, shape3 = t, scale = s), 226s + s^k * beta(a + k/t, b)/Be) 226s + }) 226s + } 226s > 226s > ## Tests for first three positive limited moments and first two 226s > ## negative limited moments. 226s > ## 226s > ## Simulation of new parameters ensuring that said moments exist. 226s > order <- c(-2, -1, 1, 2, 3) # orders 226s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 226s > for (i in seq_along(shpar)) 226s + { 226s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 226s + Be <- beta(a, b) 226s + for (s in scpar) 226s + { 226s + limit <- qgenbeta(q, shape1 = a, shape2 = b, shape3 = t, scale = s) 226s + u <- (limit/s)^t 226s + for (k in order) 226s + stopifnot(exprs = { 226s + All.eq(levgenbeta(limit, order = k, shape1 = a, shape2 = b, shape3 = t, scale = s), 226s + s^k * beta(a + k/t, b)/Be * pbeta(u, a + k/t, b) + 226s + limit^k * pbeta(u, a, b, lower = FALSE)) 226s + }) 226s + } 226s + } 227s > 227s > ## 227s > ## RANDOM NUMBERS (all continuous distributions) 227s > ## 227s > set.seed(123) 227s > n <- 20 227s > m <- rnorm(1) 227s > 227s > ## Generate variates 227s > Rfpareto <- rfpareto(n, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > Rpareto4 <- rpareto4(n, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 227s > Rpareto3 <- rpareto3(n, min = m, shape = 1.5, scale = 2) 227s > Rpareto2 <- rpareto2(n, min = m, shape = 0.8, scale = 2) 227s > Rtrbeta <- rtrbeta (n, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > Rburr <- rburr (n, shape1 = 0.8, shape2 = 1.5, scale = 2) 227s > Rllogis <- rllogis (n, shape = 1.5, scale = 2) 227s > Rparalogis <- rparalogis (n, shape = 0.8, scale = 2) 227s > Rgenpareto <- rgenpareto (n, shape1 = 0.8, shape2 = 2, scale = 2) 227s > Rpareto <- rpareto (n, shape = 0.8, scale = 2) 227s > Rpareto1 <- rpareto1 (n, shape = 0.8, min = 2) 227s > Rinvburr <- rinvburr (n, shape1 = 1.5, shape2 = 2, scale = 2) 227s > Rinvpareto <- rinvpareto (n, shape = 2, scale = 2) 227s > Rinvparalogis <- rinvparalogis(n, shape = 2, scale = 2) 227s > Rtrgamma <- rtrgamma (n, shape1 = 2, shape2 = 3, scale = 5) 227s > Rinvtrgamma <- rinvtrgamma (n, shape1 = 2, shape2 = 3, scale = 5) 227s > Rinvgamma <- rinvgamma (n, shape = 2, scale = 5) 227s > Rinvweibull <- rinvweibull (n, shape = 3, scale = 5) 227s > Rinvexp <- rinvexp (n, scale = 5) 227s > Rlgamma <- rlgamma(n, shapelog = 1.5, ratelog = 5) 227s > Rgumbel <- rgumbel(n, alpha = 2, scale = 5) 227s > Rinvgauss <- rinvgauss(n, mean = 2, dispersion = 5) 227s > Rgenbeta <- rgenbeta(n, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > 227s > ## Compute quantiles 227s > Pfpareto <- pfpareto(Rfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > Ppareto4 <- ppareto4(Rpareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 227s > Ppareto3 <- ppareto3(Rpareto3, min = m, shape = 1.5, scale = 2) 227s > Ppareto2 <- ppareto2(Rpareto2, min = m, shape = 0.8, scale = 2) 227s > Ptrbeta <- ptrbeta (Rtrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > Pburr <- pburr (Rburr, shape1 = 0.8, shape2 = 1.5, scale = 2) 227s > Pllogis <- pllogis (Rllogis, shape = 1.5, scale = 2) 227s > Pparalogis <- pparalogis (Rparalogis, shape = 0.8, scale = 2) 227s > Pgenpareto <- pgenpareto (Rgenpareto, shape1 = 0.8, shape2 = 2, scale = 2) 227s > Ppareto <- ppareto (Rpareto, shape = 0.8, scale = 2) 227s > Ppareto1 <- ppareto1 (Rpareto1, shape = 0.8, min = 2) 227s > Pinvburr <- pinvburr (Rinvburr, shape1 = 1.5, shape2 = 2, scale = 2) 227s > Pinvpareto <- pinvpareto (Rinvpareto, shape = 2, scale = 2) 227s > Pinvparalogis <- pinvparalogis(Rinvparalogis, shape = 2, scale = 2) 227s > Ptrgamma <- ptrgamma (Rtrgamma, shape1 = 2, shape2 = 3, scale = 5) 227s > Pinvtrgamma <- pinvtrgamma (Rinvtrgamma, shape1 = 2, shape2 = 3, scale = 5) 227s > Pinvgamma <- pinvgamma (Rinvgamma, shape = 2, scale = 5) 227s > Pinvweibull <- pinvweibull (Rinvweibull, shape = 3, scale = 5) 227s > Pinvexp <- pinvexp (Rinvexp, scale = 5) 227s > Plgamma <- plgamma(Rlgamma, shapelog = 1.5, ratelog = 5) 227s > Pgumbel <- pgumbel(Rgumbel, alpha = 2, scale = 5) 227s > Pinvgauss <- pinvgauss(Rinvgauss, mean = 2, dispersion = 5) 227s > Pgenbeta <- pgenbeta(Rgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > 227s > ## Just compute pdf 227s > Dfpareto <- dfpareto(Rfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > Dpareto4 <- dpareto4(Rpareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 227s > Dpareto3 <- dpareto3(Rpareto3, min = m, shape = 1.5, scale = 2) 227s > Dpareto2 <- dpareto2(Rpareto2, min = m, shape = 0.8, scale = 2) 227s > Dtrbeta <- dtrbeta (Rtrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > Dburr <- dburr (Rburr, shape1 = 0.8, shape2 = 1.5, scale = 2) 227s > Dllogis <- dllogis (Rllogis, shape = 1.5, scale = 2) 227s > Dparalogis <- dparalogis (Rparalogis, shape = 0.8, scale = 2) 227s > Dgenpareto <- dgenpareto (Rgenpareto, shape1 = 0.8, shape2 = 2, scale = 2) 227s > Dpareto <- dpareto (Rpareto, shape = 0.8, scale = 2) 227s > Dpareto1 <- dpareto1 (Rpareto1, shape = 0.8, min = 2) 227s > Dinvburr <- dinvburr (Rinvburr, shape1 = 1.5, shape2 = 2, scale = 2) 227s > Dinvpareto <- dinvpareto (Rinvpareto, shape = 2, scale = 2) 227s > Dinvparalogis <- dinvparalogis(Rinvparalogis, shape = 2, scale = 2) 227s > Dtrgamma <- dtrgamma (Rtrgamma, shape1 = 2, shape2 = 3, scale = 5) 227s > Dinvtrgamma <- dinvtrgamma (Rinvtrgamma, shape1 = 2, shape2 = 3, scale = 5) 227s > Dinvgamma <- dinvgamma (Rinvtrgamma, shape = 2, scale = 5) 227s > Dinvweibull <- dinvweibull (Rinvweibull, shape = 3, scale = 5) 227s > Dinvexp <- dinvexp (Rinvexp, scale = 5) 227s > Dlgamma <- dlgamma(Rlgamma, shapelog = 1.5, ratelog = 5) 227s > Dgumbel <- dgumbel(Rgumbel, alpha = 2, scale = 5) 227s > Dinvgauss <- dinvgauss(Rinvgauss, mean = 2, dispersion = 5) 227s > Dgenbeta <- dgenbeta(Rgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 227s > 227s > ## Check q(p(.)) identity 227s > stopifnot(exprs = { 227s + All.eq(Rfpareto, qfpareto(Pfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 227s + All.eq(Rpareto4, qpareto4(Ppareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2)) 227s + All.eq(Rpareto3, qpareto3(Ppareto3, min = m, shape = 1.5, scale = 2)) 227s + All.eq(Rpareto2, qpareto2(Ppareto2, min = m, shape = 0.8, scale = 2)) 227s + All.eq(Rtrbeta, qtrbeta (Ptrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 227s + All.eq(Rburr, qburr (Pburr, shape1 = 0.8, shape2 = 1.5, scale = 2)) 227s + All.eq(Rllogis, qllogis (Pllogis, shape = 1.5, scale = 2)) 227s + All.eq(Rparalogis, qparalogis (Pparalogis, shape = 0.8, scale = 2)) 227s + All.eq(Rgenpareto, qgenpareto (Pgenpareto, shape1 = 0.8, shape2 = 2, scale = 2)) 227s + All.eq(Rpareto, qpareto (Ppareto, shape = 0.8, scale = 2)) 227s + All.eq(Rpareto1, qpareto1 (Ppareto1, shape = 0.8, min = 2)) 227s + All.eq(Rinvburr, qinvburr (Pinvburr, shape1 = 1.5, shape2 = 2, scale = 2)) 227s + All.eq(Rinvpareto, qinvpareto (Pinvpareto, shape = 2, scale = 2)) 227s + All.eq(Rinvparalogis, qinvparalogis(Pinvparalogis, shape = 2, scale = 2)) 227s + All.eq(Rtrgamma, qtrgamma (Ptrgamma, shape1 = 2, shape2 = 3, scale = 5)) 227s + All.eq(Rinvtrgamma, qinvtrgamma (Pinvtrgamma, shape1 = 2, shape2 = 3, scale = 5)) 227s + All.eq(Rinvgamma, qinvgamma (Pinvgamma, shape = 2, scale = 5)) 227s + All.eq(Rinvweibull, qinvweibull (Pinvweibull, shape = 3, scale = 5)) 227s + All.eq(Rinvexp, qinvexp (Pinvexp, scale = 5)) 227s + All.eq(Rlgamma, qlgamma(Plgamma, shapelog = 1.5, ratelog = 5)) 227s + All.eq(Rgumbel, qgumbel(Pgumbel, alpha = 2, scale = 5)) 227s + All.eq(Rinvgauss, qinvgauss(Pinvgauss, mean = 2, dispersion = 5)) 227s + All.eq(Rgenbeta, qgenbeta(Pgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 227s + }) 227s > 227s > ## Check q(p(.)) identity for special cases 227s > stopifnot(exprs = { 227s + All.eq(Rfpareto - m, qtrbeta(Pfpareto, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 227s + All.eq(Rpareto4 - m, qburr (Ppareto4, shape1 = 0.8, shape2 = 1.5, scale = 2)) 227s + All.eq(Rpareto3 - m, qllogis(Ppareto3, shape = 1.5, scale = 2)) 227s + All.eq(Rpareto2 - m, qpareto(Ppareto2, shape = 0.8, scale = 2)) 227s + }) 227s > 227s > ## Check q(p(.)) identity with upper tail 227s > stopifnot(exprs = { 227s + All.eq(Rfpareto, qfpareto(1 - Pfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 227s + All.eq(Rpareto4, qpareto4(1 - Ppareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE)) 227s + All.eq(Rpareto3, qpareto3(1 - Ppareto3, min = m, shape = 1.5, scale = 2, lower = FALSE)) 227s + All.eq(Rpareto2, qpareto2(1 - Ppareto2, min = m, shape = 0.8, scale = 2, lower = FALSE)) 227s + All.eq(Rtrbeta, qtrbeta (1 - Ptrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 227s + All.eq(Rburr, qburr (1 - Pburr, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE)) 227s + All.eq(Rllogis, qllogis (1 - Pllogis, shape = 1.5, scale = 2, lower = FALSE)) 227s + All.eq(Rparalogis, qparalogis (1 - Pparalogis, shape = 0.8, scale = 2, lower = FALSE)) 227s + All.eq(Rgenpareto, qgenpareto (1 - Pgenpareto, shape1 = 0.8, shape2 = 2, scale = 2, lower = FALSE)) 227s + All.eq(Rpareto, qpareto (1 - Ppareto, shape = 0.8, scale = 2, lower = FALSE)) 227s + All.eq(Rpareto1, qpareto1 (1 - Ppareto1, shape = 0.8, min = 2, lower = FALSE)) 227s + All.eq(Rinvburr, qinvburr (1 - Pinvburr, shape1 = 1.5, shape2 = 2, scale = 2, lower = FALSE)) 227s + All.eq(Rinvpareto, qinvpareto (1 - Pinvpareto, shape = 2, scale = 2, lower = FALSE)) 227s + All.eq(Rinvparalogis, qinvparalogis(1 - Pinvparalogis, shape = 2, scale = 2, lower = FALSE)) 227s + All.eq(Rtrgamma, qtrgamma (1 - Ptrgamma, shape1 = 2, shape2 = 3, scale = 5, lower = FALSE)) 227s + All.eq(Rinvtrgamma, qinvtrgamma (1 - Pinvtrgamma, shape1 = 2, shape2 = 3, scale = 5, lower = FALSE)) 227s + All.eq(Rinvgamma, qinvgamma (1 - Pinvgamma, shape = 2, scale = 5, lower = FALSE)) 227s + All.eq(Rinvweibull, qinvweibull (1 - Pinvweibull, shape = 3, scale = 5, lower = FALSE)) 227s + All.eq(Rinvexp, qinvexp (1 - Pinvexp, scale = 5, lower = FALSE)) 227s + All.eq(Rlgamma, qlgamma(1 - Plgamma, shapelog = 1.5, ratelog = 5, lower = FALSE)) 227s + All.eq(Rgumbel, qgumbel(1 - Pgumbel, alpha = 2, scale = 5, lower = FALSE)) 227s + All.eq(Rinvgauss, qinvgauss(1 - Pinvgauss, mean = 2, dispersion = 5, lower = FALSE)) 227s + All.eq(Rgenbeta, qgenbeta(1 - Pgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 227s + }) 227s > 227s > ## Check q(p(., log), log) identity 227s > stopifnot(exprs = { 227s + All.eq(Rfpareto, qfpareto(log(Pfpareto), min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 227s + All.eq(Rpareto4, qpareto4(log(Ppareto4), min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, log = TRUE)) 227s + All.eq(Rpareto3, qpareto3(log(Ppareto3), min = m, shape = 1.5, scale = 2, log = TRUE)) 227s + All.eq(Rpareto2, qpareto2(log(Ppareto2), min = m, shape = 0.8, scale = 2, log = TRUE)) 227s + All.eq(Rtrbeta, qtrbeta (log(Ptrbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 227s + All.eq(Rburr, qburr (log(Pburr), shape1 = 0.8, shape2 = 1.5, scale = 2, log = TRUE)) 227s + All.eq(Rllogis, qllogis (log(Pllogis), shape = 1.5, scale = 2, log = TRUE)) 227s + All.eq(Rparalogis, qparalogis (log(Pparalogis), shape = 0.8, scale = 2, log = TRUE)) 227s + All.eq(Rgenpareto, qgenpareto (log(Pgenpareto), shape1 = 0.8, shape2 = 2, scale = 2, log = TRUE)) 227s + All.eq(Rpareto, qpareto (log(Ppareto), shape = 0.8, scale = 2, log = TRUE)) 227s + All.eq(Rpareto1, qpareto1 (log(Ppareto1), shape = 0.8, min = 2, log = TRUE)) 227s + All.eq(Rinvburr, qinvburr (log(Pinvburr), shape1 = 1.5, shape2 = 2, scale = 2, log = TRUE)) 227s + All.eq(Rinvpareto, qinvpareto (log(Pinvpareto), shape = 2, scale = 2, log = TRUE)) 227s + All.eq(Rinvparalogis, qinvparalogis(log(Pinvparalogis), shape = 2, scale = 2, log = TRUE)) 227s + All.eq(Rtrgamma, qtrgamma (log(Ptrgamma), shape1 = 2, shape2 = 3, scale = 5, log = TRUE)) 227s + All.eq(Rinvtrgamma, qinvtrgamma (log(Pinvtrgamma), shape1 = 2, shape2 = 3, scale = 5, log = TRUE)) 227s + All.eq(Rinvgamma, qinvgamma (log(Pinvgamma), shape = 2, scale = 5, log = TRUE)) 227s + All.eq(Rinvweibull, qinvweibull (log(Pinvweibull), shape = 3, scale = 5, log = TRUE)) 227s + All.eq(Rinvexp, qinvexp (log(Pinvexp), scale = 5, log = TRUE)) 227s + All.eq(Rlgamma, qlgamma(log(Plgamma), shapelog = 1.5, ratelog = 5, log = TRUE)) 227s + All.eq(Rgumbel, qgumbel(log(Pgumbel), alpha = 2, scale = 5, log = TRUE)) 227s + All.eq(Rinvgauss, qinvgauss(log(Pinvgauss), mean = 2, dispersion = 5, log = TRUE)) 227s + All.eq(Rgenbeta, qgenbeta(log(Pgenbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 227s + }) 227s > 227s > ## Check q(p(., log), log) identity with upper tail 227s > stopifnot(exprs = { 227s + All.eq(Rfpareto, qfpareto(log1p(-Pfpareto), min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rpareto4, qpareto4(log1p(-Ppareto4), min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rpareto3, qpareto3(log1p(-Ppareto3), min = m, shape = 1.5, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rpareto2, qpareto2(log1p(-Ppareto2), min = m, shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rtrbeta, qtrbeta (log1p(-Ptrbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rburr, qburr (log1p(-Pburr), shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rllogis, qllogis (log1p(-Pllogis), shape = 1.5, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rparalogis, qparalogis (log1p(-Pparalogis), shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rgenpareto, qgenpareto (log1p(-Pgenpareto), shape1 = 0.8, shape2 = 2, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rpareto, qpareto (log1p(-Ppareto), shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rpareto1, qpareto1 (log1p(-Ppareto1), shape = 0.8, min = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvburr, qinvburr (log1p(-Pinvburr), shape1 = 1.5, shape2 = 2, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvpareto, qinvpareto (log1p(-Pinvpareto), shape = 2, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvparalogis, qinvparalogis(log1p(-Pinvparalogis), shape = 2, scale = 2, lower = FALSE, log = TRUE)) 227s + All.eq(Rtrgamma, qtrgamma (log1p(-Ptrgamma), shape1 = 2, shape2 = 3, scale = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvtrgamma, qinvtrgamma (log1p(-Pinvtrgamma), shape1 = 2, shape2 = 3, scale = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvgamma, qinvgamma (log1p(-Pinvgamma), shape = 2, scale = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvweibull, qinvweibull (log1p(-Pinvweibull), shape = 3, scale = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvexp, qinvexp (log1p(-Pinvexp), scale = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rlgamma, qlgamma(log1p(-Plgamma), shapelog = 1.5, ratelog = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rgumbel, qgumbel(log1p(-Pgumbel), alpha = 2, scale = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rinvgauss, qinvgauss(log1p(-Pinvgauss), mean = 2, dispersion = 5, lower = FALSE, log = TRUE)) 227s + All.eq(Rgenbeta, qgenbeta(log1p(-Pgenbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 227s + }) 227s > 227s > 227s > ### 227s > ### DISCRETE DISTRIBUTIONS 227s > ### 227s > 227s > ## Reset seed 227s > set.seed(123) 227s > 227s > ## Define a small function to compute probabilities for the (a, b, 1) 227s > ## family of discrete distributions using the recursive relation 227s > ## 227s > ## p[k] = (a + b/k)p[k - 1], k = 2, 3, ... 227s > ## 227s > ## for a, b and p[1] given. 227s > dab1 <- function(x, a, b, p1) 227s + { 227s + x <- floor(x) 227s + if (x < 1) 227s + stop("recursive computations possible for x >= 2 only") 227s + for (k in seq(2, length.out = x - 1)) 227s + { 227s + p2 <- (a + b/k) * p1 227s + p1 <- p2 227s + } 227s + p1 227s + } 227s > 227s > ## ZERO-TRUNCATED (a, b, 1) CLASS 227s > 227s > ## Tests on the probability mass function: 227s > ## 227s > ## 1. probability is 0 at x = 0; 227s > ## 2. pmf satisfies the recursive relation 227s > lambda <- rlnorm(30, 2) # Poisson parameters 227s > r <- lambda # size for negative binomial 227s > prob <- runif(30) # probs 227s > size <- round(lambda) # size for binomial 227s > stopifnot(exprs = { 227s + dztpois(0, lambda) == 0 227s + dztnbinom(0, r, prob) == 0 227s + dztgeom(0, prob) == 0 227s + dztbinom(0, size, prob) == 0 227s + dlogarithmic(0, prob) == 0 227s + }) 227s > 227s > x <- sapply(size, sample, size = 1) 227s > stopifnot(exprs = { 227s + All.eq(dztpois(x, lambda), 227s + mapply(dab1, x, 227s + a = 0, 227s + b = lambda, 227s + p1 = lambda/(exp(lambda) - 1))) 227s + All.eq(dztnbinom(x, r, prob), 227s + mapply(dab1, x, 227s + a = 1 - prob, 227s + b = (r - 1) * (1 - prob), 227s + p1 = r * prob^r * (1 - prob)/(1 - prob^r))) 227s + All.eq(dztgeom(x, prob), 227s + mapply(dab1, x, 227s + a = 1 - prob, 227s + b = 0, 227s + p1 = prob)) 227s + All.eq(dztbinom(x, size, prob), 227s + mapply(dab1, x, 227s + a = -prob/(1 - prob), 227s + b = (size + 1) * prob/(1 - prob), 227s + p1 = size * prob * (1 - prob)^(size - 1)/(1 - (1 - prob)^size))) 227s + All.eq(dlogarithmic(x, prob), 227s + mapply(dab1, x, 227s + a = prob, 227s + b = -prob, 227s + p1 = -prob/log1p(-prob))) 227s + }) 227s > 227s > ## Tests on cumulative distribution function. 227s > for (l in lambda) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dztpois(0:20, l)), 227s + pztpois(0:20, l), 227s + tolerance = 1e-8) 227s + }) 227s > for (i in seq_along(r)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dztnbinom(0:20, r[i], prob[i])), 227s + pztnbinom(0:20, r[i], prob[i]), 227s + tolerance = 1e-8) 227s + }) 227s > for (i in seq_along(r)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dztgeom(0:20, prob[i])), 227s + pztgeom(0:20, prob[i]), 227s + tolerance = 1e-8) 227s + }) 227s > for (i in seq_along(size)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dztbinom(0:20, size[i], prob[i])), 227s + pztbinom(0:20, size[i], prob[i]), 227s + tolerance = 1e-8) 227s + }) 227s > for (p in prob) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dlogarithmic(0:20, p)), 227s + plogarithmic(0:20, p), 227s + tolerance = 1e-8) 227s + }) 227s > 227s > ## ZERO-MODIFIED (a, b, 1) CLASS 227s > 227s > ## Tests on the probability mass function: 227s > ## 227s > ## 1. probability is p0 at x = 0 (trivial, but...); 227s > ## 2. pmf satisfies the recursive relation 227s > lambda <- rlnorm(30, 2) # Poisson parameters 227s > r <- lambda # size for negative binomial 227s > prob <- runif(30) # probs 227s > size <- round(lambda) # size for binomial 227s > p0 <- runif(30) # probs at 0 227s > stopifnot(exprs = { 227s + dzmpois(0, lambda, p0) == p0 227s + dzmnbinom(0, r, prob, p0) == p0 227s + dzmgeom(0, prob, p0) == p0 227s + dzmbinom(0, size, prob, p0) == p0 227s + dzmlogarithmic(0, prob, p0) == p0 227s + }) 227s > 227s > x <- sapply(size, sample, size = 1) 227s > stopifnot(exprs = { 227s + All.eq(dzmpois(x, lambda, p0), 227s + mapply(dab1, x, 227s + a = 0, 227s + b = lambda, 227s + p1 = (1 - p0) *lambda/(exp(lambda) - 1))) 227s + All.eq(dzmnbinom(x, r, prob, p0), 227s + mapply(dab1, x, 227s + a = 1 - prob, 227s + b = (r - 1) * (1 - prob), 227s + p1 = (1 - p0) * r * prob^r * (1 - prob)/(1 - prob^r))) 227s + All.eq(dzmgeom(x, prob, p0), 227s + mapply(dab1, x, 227s + a = 1 - prob, 227s + b = 0, 227s + p1 = (1 - p0) * prob)) 227s + All.eq(dzmbinom(x, size, prob, p0), 227s + mapply(dab1, x, 227s + a = -prob/(1 - prob), 227s + b = (size + 1) * prob/(1 - prob), 227s + p1 = (1 - p0) * size * prob * (1 - prob)^(size - 1)/(1 - (1 - prob)^size))) 227s + All.eq(dzmlogarithmic(x, prob, p0), 227s + mapply(dab1, x, 227s + a = prob, 227s + b = -prob, 227s + p1 = -(1 - p0) * prob/log1p(-prob))) 227s + }) 227s > 227s > ## Tests on cumulative distribution function. 227s > for (i in seq_along(lambda)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dzmpois(0:20, lambda[i], p0 = p0[i])), 227s + pzmpois(0:20, lambda[i], p0 = p0[i]), 227s + tolerance = 1e-8) 227s + }) 227s > for (i in seq_along(r)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dzmnbinom(0:20, r[i], prob[i], p0[i])), 227s + pzmnbinom(0:20, r[i], prob[i], p0[i]), 227s + tolerance = 1e-8) 227s + }) 227s > for (i in seq_along(r)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dzmgeom(0:20, prob[i], p0[i])), 227s + pzmgeom(0:20, prob[i], p0[i]), 227s + tolerance = 1e-8) 227s + }) 227s > for (i in seq_along(size)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dzmbinom(0:20, size[i], prob[i], p0[i])), 227s + pzmbinom(0:20, size[i], prob[i], p0[i]), 227s + tolerance = 1e-8) 227s + }) 227s > for (i in seq_along(prob)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dzmlogarithmic(0:20, prob[i], p0[i])), 227s + pzmlogarithmic(0:20, prob[i], p0[i]), 227s + tolerance = 1e-8) 227s + }) 227s > 227s > ## POISSON-INVERSE GAUSSIAN 227s > 227s > ## Reset seed 227s > set.seed(123) 227s > 227s > ## Define a small function to compute probabilities for the PIG 227s > ## directly using the Bessel function. 227s > dpigBK <- function(x, mu, phi) 227s + { 227s + M_LN2 <- 0.693147180559945309417232121458 227s + M_SQRT_2dPI <- 0.225791352644727432363097614947 227s + 227s + phimu <- phi * mu 227s + lphi <- log(phi) 227s + y <- x - 0.5 227s + 227s + logA = -lphi/2 - M_SQRT_2dPI 227s + logB = (M_LN2 + lphi + log1p(1/(2 * phimu * mu)))/2; 227s + 227s + exp(logA + 1/phimu - lfactorial(x) - y * logB) * 227s + besselK(exp(logB - lphi), y) 227s + } 227s > 227s > ## Tests on the probability mass function. 227s > mu <- rlnorm(30, 2) 227s > phi <- rlnorm(30, 2) 227s > x <- 0:100 227s > for (i in seq_along(phi)) 227s + { 227s + stopifnot(exprs = { 227s + all.equal(dpoisinvgauss(x, mean = mu[i], dispersion = phi[i]), 227s + dpigBK(x, mu[i], phi[i])) 227s + all.equal(dpoisinvgauss(x, mean = Inf, dispersion = phi[i]), 227s + dpigBK(x, Inf, phi[i])) 227s + }) 227s + } 227s > 227s > ## Tests on cumulative distribution function. 227s > for (i in seq_along(phi)) 227s + stopifnot(exprs = { 227s + all.equal(cumsum(dpoisinvgauss(0:20, mu[i], phi[i])), 227s + ppoisinvgauss(0:20, mu[i], phi[i]), 227s + tolerance = 1e-8) 227s + all.equal(cumsum(dpoisinvgauss(0:20, Inf, phi[i])), 227s + ppoisinvgauss(0:20, Inf, phi[i]), 227s + tolerance = 1e-8) 227s + }) 227s > 227s > ## 227s > ## RANDOM NUMBERS (all discrete distributions) 227s > ## 227s > set.seed(123) 227s > n <- 20 227s > 227s > ## Generate variates. 227s > ## 227s > ## For zero-modified distributions, we simulate two sets of values: 227s > ## one with p0m < p0 (suffix 'p0lt') and one with p0m > p0 (suffix 227s > ## 'p0gt'). 227s > Rztpois <- rztpois (n, lambda = 12) 227s > Rztnbinom <- rztnbinom (n, size = 7, prob = 0.01) 227s > Rztgeom <- rztgeom (n, prob = pi/16) 227s > Rztbinom <- rztbinom (n, size = 55, prob = pi/16) 227s > Rlogarithmic <- rlogarithmic(n, prob = 0.99) 227s > Rzmpoisp0lt <- rzmpois (n, lambda = 6, p0 = 0.001) 227s > Rzmpoisp0gt <- rzmpois (n, lambda = 6, p0 = 0.010) 227s > Rzmnbinomp0lt <- rzmnbinom (n, size = 7, prob = 0.8, p0 = 0.01) 227s > Rzmnbinomp0gt <- rzmnbinom (n, size = 7, prob = 0.8, p0 = 0.40) 227s > Rzmgeomp0lt <- rzmgeom (n, prob = pi/16, p0 = 0.01) 227s > Rzmgeomp0gt <- rzmgeom (n, prob = pi/16, p0 = 0.40) 227s > Rzmbinomp0lt <- rzmbinom (n, size = 12, prob = pi/16, p0 = 0.01) 227s > Rzmbinomp0gt <- rzmbinom (n, size = 12, prob = pi/16, p0 = 0.12) 227s > Rzmlogarithmicp0lt <- rzmlogarithmic(n, prob = 0.99, p0 = 0.05) 227s > Rzmlogarithmicp0gt <- rzmlogarithmic(n, prob = 0.99, p0 = 0.55) 227s > Rpoisinvgauss <- rpoisinvgauss(n, mean = 12, dispersion = 0.1) 227s > RpoisinvgaussInf <- rpoisinvgauss(n, mean = Inf, dispersion = 1.1) 227s > 227s > ## Compute quantiles 227s > Pztpois <- pztpois (Rztpois, lambda = 12) 227s > Pztnbinom <- pztnbinom (Rztnbinom, size = 7, prob = 0.01) 227s > Pztgeom <- pztgeom (Rztgeom, prob = pi/16) 227s > Pztbinom <- pztbinom (Rztbinom, size = 55, prob = pi/16) 227s > Plogarithmic <- plogarithmic(Rlogarithmic, prob = 0.99) 227s > Pzmpoisp0lt <- pzmpois (Rzmpoisp0lt, lambda = 6, p0 = 0.001) 227s > Pzmpoisp0gt <- pzmpois (Rzmpoisp0gt, lambda = 6, p0 = 0.010) 227s > Pzmnbinomp0lt <- pzmnbinom (Rzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 227s > Pzmnbinomp0gt <- pzmnbinom (Rzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 227s > Pzmgeomp0lt <- pzmgeom (Rzmgeomp0lt, prob = pi/16, p0 = 0.01) 227s > Pzmgeomp0gt <- pzmgeom (Rzmgeomp0gt, prob = pi/16, p0 = 0.40) 227s > Pzmbinomp0lt <- pzmbinom (Rzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 227s > Pzmbinomp0gt <- pzmbinom (Rzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 227s > Pzmlogarithmicp0lt <- pzmlogarithmic(Rzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 227s > Pzmlogarithmicp0gt <- pzmlogarithmic(Rzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 227s > Ppoisinvgauss <- ppoisinvgauss(Rpoisinvgauss, mean = 12, dispersion = 0.1) 227s > PpoisinvgaussInf <- ppoisinvgauss(RpoisinvgaussInf, mean = Inf, dispersion = 1.1) 227s > 227s > ## Just compute pmf 227s > Dztpois <- dztpois (Rztpois, lambda = 12) 227s > Dztnbinom <- dztnbinom (Rztnbinom, size = 7, prob = 0.01) 227s > Dztgeom <- dztgeom (Rztgeom, prob = pi/16) 227s > Dztbinom <- dztbinom (Rztbinom, size = 55, prob = pi/16) 227s > Dlogarithmic <- dlogarithmic(Rlogarithmic, prob = pi/16) 227s > Dzmpoisp0lt <- dzmpois (Rzmpoisp0lt, lambda = 6, p0 = 0.001) 227s > Dzmpoisp0gt <- dzmpois (Rzmpoisp0gt, lambda = 6, p0 = 0.010) 227s > Dzmnbinomp0lt <- dzmnbinom (Rzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 227s > Dzmnbinomp0gt <- dzmnbinom (Rzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 227s > Dzmgeomp0lt <- dzmgeom (Rzmgeomp0lt, prob = pi/16, p0 = 0.01) 227s > Dzmgeomp0gt <- dzmgeom (Rzmgeomp0gt, prob = pi/16, p0 = 0.40) 227s > Dzmbinomp0lt <- dzmbinom (Rzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 227s > Dzmbinomp0gt <- dzmbinom (Rzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 227s > Dzmlogarithmicp0lt <- dzmlogarithmic(Rzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 227s > Dzmlogarithmicp0gt <- dzmlogarithmic(Rzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 227s > Dpoisinvgauss <- dpoisinvgauss(Rpoisinvgauss, mean = 12, dispersion = 0.1) 227s > DpoisinvgaussInf <- dpoisinvgauss(RpoisinvgaussInf, mean = Inf, dispersion = 1.1) 227s > 227s > ## Check q(p(.)) identity 227s > stopifnot(exprs = { 227s + Rztpois == qztpois (Pztpois, lambda = 12) 227s + Rztnbinom == qztnbinom (Pztnbinom, size = 7, prob = 0.01) 227s + Rztgeom == qztgeom (Pztgeom, prob = pi/16) 227s + Rztbinom == qztbinom (Pztbinom, size = 55, prob = pi/16) 227s + Rlogarithmic == qlogarithmic(Plogarithmic, prob = 0.99) 227s + Rzmpoisp0lt == qzmpois (Pzmpoisp0lt, lambda = 6, p0 = 0.001) 227s + Rzmpoisp0gt == qzmpois (Pzmpoisp0gt, lambda = 6, p0 = 0.010) 227s + Rzmnbinomp0lt == qzmnbinom (Pzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 227s + Rzmnbinomp0gt == qzmnbinom (Pzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 227s + Rzmgeomp0lt == qzmgeom (Pzmgeomp0lt, prob = pi/16, p0 = 0.01) 227s + Rzmgeomp0gt == qzmgeom (Pzmgeomp0gt, prob = pi/16, p0 = 0.40) 227s + Rzmbinomp0lt == qzmbinom (Pzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 227s + Rzmbinomp0gt == qzmbinom (Pzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 227s + Rzmlogarithmicp0lt == qzmlogarithmic(Pzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 227s + Rzmlogarithmicp0gt == qzmlogarithmic(Pzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 227s + Rpoisinvgauss == qpoisinvgauss(Ppoisinvgauss, mean = 12, dispersion = 0.1) 227s + RpoisinvgaussInf == qpoisinvgauss(PpoisinvgaussInf, mean = Inf, dispersion = 1.1) 227s + }) 228s > 228s > ## Check q(p(.)) identity with upper tail 228s > stopifnot(exprs = { 228s + Rztpois == qztpois (1 - Pztpois, lambda = 12, lower = FALSE) 228s + Rztnbinom == qztnbinom (1 - Pztnbinom, size = 7, prob = 0.01, lower = FALSE) 228s + Rztgeom == qztgeom (1 - Pztgeom, prob = pi/16, lower = FALSE) 228s + Rztbinom == qztbinom (1 - Pztbinom, size = 55, prob = pi/16, lower = FALSE) 228s + Rlogarithmic == qlogarithmic(1 - Plogarithmic, prob = 0.99, lower = FALSE) 228s + Rzmpoisp0lt == qzmpois (1 - Pzmpoisp0lt, lambda = 6, p0 = 0.001, lower = FALSE) 228s + Rzmpoisp0gt == qzmpois (1 - Pzmpoisp0gt, lambda = 6, p0 = 0.010, lower = FALSE) 228s + Rzmnbinomp0lt == qzmnbinom (1 - Pzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01, lower = FALSE) 228s + Rzmnbinomp0gt == qzmnbinom (1 - Pzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40, lower = FALSE) 228s + Rzmgeomp0lt == qzmgeom (1 - Pzmgeomp0lt, prob = pi/16, p0 = 0.01, lower = FALSE) 228s + Rzmgeomp0gt == qzmgeom (1 - Pzmgeomp0gt, prob = pi/16, p0 = 0.40, lower = FALSE) 228s + Rzmbinomp0lt == qzmbinom (1 - Pzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01, lower = FALSE) 228s + Rzmbinomp0gt == qzmbinom (1 - Pzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12, lower = FALSE) 228s + Rzmlogarithmicp0lt == qzmlogarithmic(1 - Pzmlogarithmicp0lt, prob = 0.99, p0 = 0.05, lower = FALSE) 228s + Rzmlogarithmicp0gt == qzmlogarithmic(1 - Pzmlogarithmicp0gt, prob = 0.99, p0 = 0.55, lower = FALSE) 228s + Rpoisinvgauss == qpoisinvgauss(1 - Ppoisinvgauss, mean = 12, dispersion = 0.1, lower = FALSE) 228s + RpoisinvgaussInf == qpoisinvgauss(1 - PpoisinvgaussInf, mean = Inf, dispersion = 1.1, lower = FALSE) 228s + }) 230s > 230s > ## Check q(p(., log), log) identity 230s > stopifnot(exprs = { 230s + Rztpois == qztpois (log(Pztpois), lambda = 12, log = TRUE) 230s + Rztnbinom == qztnbinom (log(Pztnbinom), size = 7, prob = 0.01, log = TRUE) 230s + Rztgeom == qztgeom (log(Pztgeom), prob = pi/16, log = TRUE) 230s + Rztbinom == qztbinom (log(Pztbinom), size = 55, prob = pi/16, log = TRUE) 230s + Rlogarithmic == qlogarithmic(log(Plogarithmic), prob = 0.99, log = TRUE) 230s + Rzmpoisp0lt == qzmpois (log(Pzmpoisp0lt), lambda = 6, p0 = 0.001, log = TRUE) 230s + Rzmpoisp0gt == qzmpois (log(Pzmpoisp0gt), lambda = 6, p0 = 0.010, log = TRUE) 230s + Rzmnbinomp0lt == qzmnbinom (log(Pzmnbinomp0lt), size = 7, prob = 0.8, p0 = 0.01, log = TRUE) 230s + Rzmnbinomp0gt == qzmnbinom (log(Pzmnbinomp0gt), size = 7, prob = 0.8, p0 = 0.40, log = TRUE) 230s + Rzmgeomp0lt == qzmgeom (log(Pzmgeomp0lt), prob = pi/16, p0 = 0.01, log = TRUE) 230s + Rzmgeomp0gt == qzmgeom (log(Pzmgeomp0gt), prob = pi/16, p0 = 0.40, log = TRUE) 230s + Rzmbinomp0lt == qzmbinom (log(Pzmbinomp0lt), size = 12, prob = pi/16, p0 = 0.01, log = TRUE) 230s + Rzmbinomp0gt == qzmbinom (log(Pzmbinomp0gt), size = 12, prob = pi/16, p0 = 0.12, log = TRUE) 230s + Rzmlogarithmicp0lt == qzmlogarithmic(log(Pzmlogarithmicp0lt), prob = 0.99, p0 = 0.05, log = TRUE) 230s + Rzmlogarithmicp0gt == qzmlogarithmic(log(Pzmlogarithmicp0gt), prob = 0.99, p0 = 0.55, log = TRUE) 230s + Rpoisinvgauss == qpoisinvgauss(log(Ppoisinvgauss), mean = 12, dispersion = 0.1, log = TRUE) 230s + RpoisinvgaussInf == qpoisinvgauss(log(PpoisinvgaussInf), mean = Inf, dispersion = 1.1, log = TRUE) 230s + }) 231s > 231s > ## Check q(p(., log), log) identity with upper tail 231s > stopifnot(exprs = { 231s + Rztpois == qztpois (log1p(-Pztpois), lambda = 12, lower = FALSE, log = TRUE) 231s + Rztnbinom == qztnbinom (log1p(-Pztnbinom), size = 7, prob = 0.01, lower = FALSE, log = TRUE) 231s + Rztgeom == qztgeom (log1p(-Pztgeom), prob = pi/16, lower = FALSE, log = TRUE) 231s + Rztbinom == qztbinom (log1p(-Pztbinom), size = 55, prob = pi/16, lower = FALSE, log = TRUE) 231s + Rlogarithmic == qlogarithmic(log1p(-Plogarithmic), prob = 0.99, lower = FALSE, log = TRUE) 231s + Rzmpoisp0lt == qzmpois (log1p(-Pzmpoisp0lt), lambda = 6, p0 = 0.001, lower = FALSE, log = TRUE) 231s + Rzmpoisp0gt == qzmpois (log1p(-Pzmpoisp0gt), lambda = 6, p0 = 0.010, lower = FALSE, log = TRUE) 231s + Rzmnbinomp0lt == qzmnbinom (log1p(-Pzmnbinomp0lt), size = 7, prob = 0.8, p0 = 0.01, lower = FALSE, log = TRUE) 231s + Rzmnbinomp0gt == qzmnbinom (log1p(-Pzmnbinomp0gt), size = 7, prob = 0.8, p0 = 0.40, lower = FALSE, log = TRUE) 231s + Rzmgeomp0lt == qzmgeom (log1p(-Pzmgeomp0lt), prob = pi/16, p0 = 0.01, lower = FALSE, log = TRUE) 231s + Rzmgeomp0gt == qzmgeom (log1p(-Pzmgeomp0gt), prob = pi/16, p0 = 0.40, lower = FALSE, log = TRUE) 231s + Rzmbinomp0lt == qzmbinom (log1p(-Pzmbinomp0lt), size = 12, prob = pi/16, p0 = 0.01, lower = FALSE, log = TRUE) 231s + Rzmbinomp0gt == qzmbinom (log1p(-Pzmbinomp0gt), size = 12, prob = pi/16, p0 = 0.12, lower = FALSE, log = TRUE) 231s + Rzmlogarithmicp0lt == qzmlogarithmic(log1p(-Pzmlogarithmicp0lt), prob = 0.99, p0 = 0.05, lower = FALSE, log = TRUE) 231s + Rzmlogarithmicp0gt == qzmlogarithmic(log1p(-Pzmlogarithmicp0gt), prob = 0.99, p0 = 0.55, lower = FALSE, log = TRUE) 231s + Rpoisinvgauss == qpoisinvgauss(log1p(-Ppoisinvgauss), mean = 12, dispersion = 0.1, lower = FALSE, log = TRUE) 231s + RpoisinvgaussInf == qpoisinvgauss(log1p(-PpoisinvgaussInf), mean = Inf, dispersion = 1.1, lower = FALSE, log = TRUE) 231s + }) 233s > 233s BEGIN TEST rcompound-tests.R 233s 233s R version 4.4.3 (2025-02-28) -- "Trophy Case" 233s Copyright (C) 2025 The R Foundation for Statistical Computing 233s Platform: s390x-ibm-linux-gnu 233s 233s R is free software and comes with ABSOLUTELY NO WARRANTY. 233s You are welcome to redistribute it under certain conditions. 233s Type 'license()' or 'licence()' for distribution details. 233s 233s R is a collaborative project with many contributors. 233s Type 'contributors()' for more information and 233s 'citation()' on how to cite R or R packages in publications. 233s 233s Type 'demo()' for some demos, 'help()' for on-line help, or 233s 'help.start()' for an HTML browser interface to help. 233s Type 'q()' to quit R. 233s 233s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 233s > ### 233s > ### Tests for the simulation of compound models with 'rcompound' and 233s > ### 'rcomppois'. 233s > ### 233s > ### AUTHOR: Vincent Goulet 233s > 233s > ## Load the package 233s > library(actuar) 233s > 233s > ## Copy of tools::assertError. 233s > assertError <- tools::assertError 233s > 233s > ### 233s > ### Tests for rcompound 233s > ### 233s > 233s > ## Test the function itself with various types of arguments. 233s > n <- 20 233s > fmodel <- expression(rnbinom(2, 0.8)) 233s > smodel <- expression(rgamma(2, 1)) 233s > set.seed(123) 233s > x <- numeric(n) 233s > N <- rnbinom(n, 2, 0.8) 233s > y <- rgamma(sum(N), 2, 1) 233s > x[which(N != 0)] <- tapply(y, rep(seq_len(n), N), sum) 233s > stopifnot(exprs = { 233s + identical(x, { 233s + set.seed(123) 233s + rcompound(n, rnbinom(2, 0.8), rgamma(2, 1)) 233s + }) 233s + identical(x, { 233s + 233s Attaching package: ‘actuar’ 233s 233s The following objects are masked from ‘package:stats’: 233s 233s sd, var 233s 233s The following object is masked from ‘package:grDevices’: 233s 233s cm 233s 233s set.seed(123) 233s + rcompound(n, rnbinom(2, 0.8), expression(rgamma(2, 1))) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + rcompound(n, expression(rnbinom(2, 0.8)), rgamma(2, 1)) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + rcompound(n, fmodel, smodel) 233s + }) 233s + }) 233s > 233s > ## Test the calling environment, that is that arguments are correctly 233s > ## identified when 'rcompound' is called inside another function. 233s > n <- 20 233s > lambda <- 2 233s > smodel <- expression(rgamma(2, 1)) 233s > set.seed(123) 233s > x <- rcompound(n, rpois(2), rgamma(2, 1)) 233s > f <- function(n, p, model.sev) 233s + { 233s + ## safe way to pass down the arguments 233s + model.freq <- substitute(rpois(p), list(p = p)) 233s + model.sev <- substitute(model.sev) 233s + if (is.name(model.sev)) 233s + model.sev <- eval.parent(model.sev) 233s + rcompound(n, model.freq, model.sev) 233s + } 233s > g1 <- function(n, p, s, r) 233s + rcompound(n, rpois(p), rgamma(s, r)) 233s > g2 <- function(n, p, s, r) 233s + rcompound(n, expression(rpois(p)), expression(rgamma(s, r))) 233s > h <- function(n, p, model.sev) 233s + { 233s + ## safe way to pass down the arguments 233s + model.sev <- substitute(model.sev) 233s + if (is.name(model.sev)) 233s + model.sev <- eval.parent(model.sev) 233s + f(n, p, model.sev) 233s + } 233s > stopifnot(exprs = { 233s + identical(x, { 233s + set.seed(123) 233s + f(n, 2, rgamma(2, 1)) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + f(n, lambda, expression(rgamma(2, 1))) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + f(n, lambda, smodel) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + g1(n, lambda, 2, 1) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + g2(n, lambda, 2, 1) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + h(n, 2, rgamma(2, 1)) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + h(n, lambda, smodel) 233s + }) 233s + }) 233s > 233s > ## Test invalid arguments. 233s > assertError(rcompound(-1, rpois(2), rgamma(2, 1))) 233s > 233s > 233s > ### 233s > ### Tests for rcomppois 233s > ### 233s > 233s > ## Test the function itself with various types of arguments. 233s > n <- 20 233s > lambda <- 2 233s > smodel <- expression(rgamma(2, 1)) 233s > set.seed(123) 233s > x <- numeric(n) 233s > N <- rpois(n, 2) 233s > y <- rgamma(sum(N), 2, 1) 233s > x[which(N != 0)] <- tapply(y, rep(seq_len(n), N), sum) 233s > stopifnot(exprs = { 233s + identical(x, { 233s + set.seed(123) 233s + rcomppois(n, 2, rgamma(2, 1)) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + rcomppois(n, lambda, expression(rgamma(2, 1))) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + rcomppois(n, lambda, smodel) 233s + }) 233s + }) 233s > 233s > ## Test the calling environment, that is that arguments are correctly 233s > ## identified when 'rcomppois' is called inside another function. 233s > n <- 20 233s > lambda <- 2 233s > smodel <- expression(rgamma(2, 1)) 233s > set.seed(123) 233s > x <- rcomppois(n, lambda, smodel) 233s > f <- function(n, p, model) 233s + { 233s + ## safe way to pass down all sorts of 'model' objects 233s + model <- substitute(model) 233s + if (is.name(model)) 233s + model <- eval.parent(model) 233s + rcomppois(n, p, model) 233s + } 233s > g1 <- function(n, p, s, r) 233s + rcomppois(n, p, rgamma(s, r)) 233s > g2 <- function(n, p, s, r) 233s + rcomppois(n, p, expression(rgamma(s, r))) 233s > h <- function(n, p, model) 233s + { 233s + ## safe way to pass down all sorts of 'model' objects 233s + model <- substitute(model) 233s + if (is.name(model)) 233s + model <- eval.parent(model) 233s + f(n, p, model) 233s + } 233s > stopifnot(exprs = { 233s + identical(x, { 233s + set.seed(123) 233s + f(n, 2, rgamma(2, 1)) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + f(n, lambda, expression(rgamma(2, 1))) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + f(n, lambda, smodel) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + g1(n, 2, 2, 1) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + g2(n, 2, 2, 1) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + h(n, 2, rgamma(2, 1)) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + h(n, lambda, smodel) 233s + }) 233s + }) 233s > 233s > ## Test invalid arguments. 233s > assertError(rcomppois(-1, lambda, smodel)) 233s > assertError(rcomppois(n, -1, smodel)) 233s > assertError(rcomppois(n, c(3, -1), smodel)) 233s > 233s BEGIN TEST rmixture-tests.R 233s 233s R version 4.4.3 (2025-02-28) -- "Trophy Case" 233s Copyright (C) 2025 The R Foundation for Statistical Computing 233s Platform: s390x-ibm-linux-gnu 233s 233s R is free software and comes with ABSOLUTELY NO WARRANTY. 233s You are welcome to redistribute it under certain conditions. 233s Type 'license()' or 'licence()' for distribution details. 233s 233s R is a collaborative project with many contributors. 233s Type 'contributors()' for more information and 233s 'citation()' on how to cite R or R packages in publications. 233s 233s Type 'demo()' for some demos, 'help()' for on-line help, or 233s 'help.start()' for an HTML browser interface to help. 233s Type 'q()' to quit R. 233s 233s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 233s > ### 233s > ### Tests for the simulation of discrete mixtures with 'rmixture'. 233s > ### 233s > ### AUTHOR: Vincent Goulet 233s > 233s > ## Load the package 233s > library(actuar) 233s 233s Attaching package: ‘actuar’ 233s 233s The following objects are masked from ‘package:stats’: 233s 233s sd, var 233s 233s > 233s > ## Copy of tools::assertError. 233s > assertError <- tools::assertError 233s The following object is masked from ‘package:grDevices’: 233s 233s cm 233s 233s > 233s > ## Set common values for the tests 233s > n <- 20 233s > bmodels <- expression(rexp(1/20), 233s + rlnorm(3.6, 0.6), 233s + rpareto(shape = 4, scale = 240)) 233s > 233s > ## Function to inject the number of variates in an expression and 233s > ## evaluate it. 233s > f <- function(n, expr) 233s + { 233s + expr$n <- n 233s + eval(expr) 233s + } 233s > 233s > ## Test a "normal" case (with data that is not reshuffled). 233s > set.seed(123) 233s > probs <- c(2, 3, 5)/10 233s > nj <- rmultinom(1, n, prob = probs) 233s > x <- c(f(nj[1], bmodels[[1]]), f(nj[2], bmodels[[2]]), f(nj[3], bmodels[[3]])) 233s > set.seed(123) 233s > stopifnot(exprs = { 233s + identical(x, rmixture(n, probs, bmodels, shuffle = FALSE)) 233s + }) 233s > 233s > ## Test recycling of the probability vector. 233s > set.seed(123) 233s > probs <- 1 233s > nj <- rmultinom(1, n, prob = rep_len(probs, 3)) 233s > x <- c(f(nj[1], bmodels[[1]]), f(nj[2], bmodels[[2]]), f(nj[3], bmodels[[3]])) 233s > set.seed(123) 233s > stopifnot(exprs = { 233s + identical(x, rmixture(n, probs, bmodels, shuffle = FALSE)) 233s + }) 233s > 233s > ## Test recycling of the models vector. 233s > set.seed(123) 233s > probs <- c(2, 3, 5) 233s > nj <- rmultinom(1, n, prob = probs) 233s > x <- f(n, bmodels[[1]]) 233s > set.seed(123) 233s > stopifnot(exprs = { 233s + identical(x, rmixture(n, probs, bmodels[1], shuffle = FALSE)) 233s + }) 233s > 233s > ## Test special cases. 233s > stopifnot(exprs = { 233s + identical(numeric(0), rmixture(0, probs, bmodels)) 233s + identical(2L, length(rmixture(c(n, n), probs, bmodels))) 233s + }) 233s > 233s > ## Test the calling environment, that is that arguments are correctly 233s > ## identified when 'rmixture' is called inside another function. 233s > set.seed(123) 233s > probs <- c(2, 3, 5)/10 233s > x <- rmixture(n, probs, bmodels) 233s > f <- function(n, p, model) 233s + rmixture(n, p, model) 233s > g <- function(n, p, m, q) 233s + rmixture(n, p, expression(rexp(m[1]), rlnorm(m[2], q[2]), rpareto(m[3], q[3]))) 233s > h <- function(n, p, model) 233s + f(n, c(p[1], p[2], p[3]), 233s + c(model[1], model[2], model[3])) 233s > k <- function(n, p, m, q) 233s + { 233s + ## Pathological case where the models expression does not evaluate 233s + ## in the frame of 'rmixture' as 'm' and 'q' will not be bound. 233s + ## The fix is to substitute variables by their values. 233s + models <- substitute(expression(rexp(m[1]), rlnorm(m[2], q[2]), rpareto(m[3], q[3])), 233s + list(m = m, q = q)) 233s + 233s + f(n, p, eval(models)) 233s + } 233s > stopifnot(exprs = { 233s + identical(x, { 233s + set.seed(123) 233s + f(n, probs, bmodels) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + f(n, c(probs[1], probs[2], probs[3]), 233s + c(bmodels[1], bmodels[2], bmodels[3])) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + g(n, p = probs, 233s + m = c(eval(bmodels[[c(1, 2)]]), eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(3, 2)]])), 233s + q = c(NA, eval(bmodels[[c(2, 3)]]), eval(bmodels[[c(3, 3)]]))) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + h(n, probs, 233s + expression(rexp(eval(bmodels[[c(1, 2)]])), 233s + rlnorm(eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(2, 3)]])), 233s + rpareto(shape = eval(bmodels[[c(3, 2)]]), scale = eval(bmodels[[c(3, 3)]])))) 233s + }) 233s + identical(x, { 233s + set.seed(123) 233s + k(n, p = probs, 233s + m = c(eval(bmodels[[c(1, 2)]]), eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(3, 2)]])), 233s + q = c(NA, eval(bmodels[[c(2, 3)]]), eval(bmodels[[c(3, 3)]]))) 233s + }) 233s + }) 233s > 233s > ## Finally, test invalid arguments. 233s > assertError(rmixture(-1, probs, bmodels)) 233s > assertError(rmixture(c(3, -1), probs, bmodels)) 233s > assertError(rmixture(n, numeric(0), bmodels)) 233s > assertError(rmixture(n, 0, bmodels)) 233s > assertError(rmixture(n, c(0, 0), bmodels)) 233s > assertError(rmixture(n, probs, c(rexp(2), rexp(7)))) 233s > 233s autopkgtest [17:53:50]: test run-unit-test: -----------------------] 234s autopkgtest [17:53:51]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 234s run-unit-test PASS 234s autopkgtest [17:53:51]: test pkg-r-autopkgtest: preparing testbed 234s Reading package lists... 235s Building dependency tree... 235s Reading state information... 235s Starting pkgProblemResolver with broken count: 0 235s Starting 2 pkgProblemResolver with broken count: 0 235s Done 235s The following NEW packages will be installed: 235s build-essential cpp cpp-14 cpp-14-s390x-linux-gnu cpp-s390x-linux-gnu 235s dctrl-tools g++ g++-14 g++-14-s390x-linux-gnu g++-s390x-linux-gnu gcc gcc-14 235s gcc-14-s390x-linux-gnu gcc-s390x-linux-gnu gfortran gfortran-14 235s gfortran-14-s390x-linux-gnu gfortran-s390x-linux-gnu icu-devtools libasan8 235s libblas-dev libbz2-dev libcc1-0 libdeflate-dev libgcc-14-dev 235s libgfortran-14-dev libicu-dev libisl23 libitm1 libjpeg-dev 235s libjpeg-turbo8-dev libjpeg8-dev liblapack-dev liblzma-dev libmpc3 235s libncurses-dev libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix3 235s libpkgconf3 libpng-dev libreadline-dev libstdc++-14-dev libtirpc-dev 235s libubsan1 pkg-r-autopkgtest pkgconf pkgconf-bin r-base-dev zlib1g-dev 235s 0 upgraded, 51 newly installed, 0 to remove and 0 not upgraded. 235s Need to get 82.3 MB of archives. 235s After this operation, 279 MB of additional disk space will be used. 235s Get:1 http://ftpmaster.internal/ubuntu plucky/main s390x libisl23 s390x 0.27-1 [704 kB] 236s Get:2 http://ftpmaster.internal/ubuntu plucky/main s390x libmpc3 s390x 1.3.1-1build2 [57.8 kB] 236s Get:3 http://ftpmaster.internal/ubuntu plucky/main s390x cpp-14-s390x-linux-gnu s390x 14.2.0-17ubuntu3 [9572 kB] 247s Get:4 http://ftpmaster.internal/ubuntu plucky/main s390x cpp-14 s390x 14.2.0-17ubuntu3 [1028 B] 247s Get:5 http://ftpmaster.internal/ubuntu plucky/main s390x cpp-s390x-linux-gnu s390x 4:14.2.0-1ubuntu1 [5556 B] 247s Get:6 http://ftpmaster.internal/ubuntu plucky/main s390x cpp s390x 4:14.2.0-1ubuntu1 [22.4 kB] 247s Get:7 http://ftpmaster.internal/ubuntu plucky/main s390x libcc1-0 s390x 15-20250222-0ubuntu1 [49.2 kB] 247s Get:8 http://ftpmaster.internal/ubuntu plucky/main s390x libitm1 s390x 15-20250222-0ubuntu1 [31.2 kB] 247s Get:9 http://ftpmaster.internal/ubuntu plucky/main s390x libasan8 s390x 15-20250222-0ubuntu1 [2970 kB] 250s Get:10 http://ftpmaster.internal/ubuntu plucky/main s390x libubsan1 s390x 15-20250222-0ubuntu1 [1212 kB] 252s Get:11 http://ftpmaster.internal/ubuntu plucky/main s390x libgcc-14-dev s390x 14.2.0-17ubuntu3 [1037 kB] 253s Get:12 http://ftpmaster.internal/ubuntu plucky/main s390x gcc-14-s390x-linux-gnu s390x 14.2.0-17ubuntu3 [18.7 MB] 275s Get:13 http://ftpmaster.internal/ubuntu plucky/main s390x gcc-14 s390x 14.2.0-17ubuntu3 [526 kB] 275s Get:14 http://ftpmaster.internal/ubuntu plucky/main s390x gcc-s390x-linux-gnu s390x 4:14.2.0-1ubuntu1 [1204 B] 275s Get:15 http://ftpmaster.internal/ubuntu plucky/main s390x gcc s390x 4:14.2.0-1ubuntu1 [5004 B] 275s Get:16 http://ftpmaster.internal/ubuntu plucky/main s390x libstdc++-14-dev s390x 14.2.0-17ubuntu3 [2611 kB] 278s Get:17 http://ftpmaster.internal/ubuntu plucky/main s390x g++-14-s390x-linux-gnu s390x 14.2.0-17ubuntu3 [11.0 MB] 291s Get:18 http://ftpmaster.internal/ubuntu plucky/main s390x g++-14 s390x 14.2.0-17ubuntu3 [21.8 kB] 291s Get:19 http://ftpmaster.internal/ubuntu plucky/main s390x g++-s390x-linux-gnu s390x 4:14.2.0-1ubuntu1 [956 B] 291s Get:20 http://ftpmaster.internal/ubuntu plucky/main s390x g++ s390x 4:14.2.0-1ubuntu1 [1080 B] 291s Get:21 http://ftpmaster.internal/ubuntu plucky/main s390x build-essential s390x 12.10ubuntu1 [4930 B] 291s Get:22 http://ftpmaster.internal/ubuntu plucky/main s390x dctrl-tools s390x 2.24-3build3 [106 kB] 291s Get:23 http://ftpmaster.internal/ubuntu plucky/main s390x libgfortran-14-dev s390x 14.2.0-17ubuntu3 [654 kB] 291s Get:24 http://ftpmaster.internal/ubuntu plucky/main s390x gfortran-14-s390x-linux-gnu s390x 14.2.0-17ubuntu3 [10.3 MB] 301s Get:25 http://ftpmaster.internal/ubuntu plucky/main s390x gfortran-14 s390x 14.2.0-17ubuntu3 [13.6 kB] 301s Get:26 http://ftpmaster.internal/ubuntu plucky/main s390x gfortran-s390x-linux-gnu s390x 4:14.2.0-1ubuntu1 [1012 B] 301s Get:27 http://ftpmaster.internal/ubuntu plucky/main s390x gfortran s390x 4:14.2.0-1ubuntu1 [1160 B] 301s Get:28 http://ftpmaster.internal/ubuntu plucky/main s390x icu-devtools s390x 76.1-1ubuntu2 [225 kB] 301s Get:29 http://ftpmaster.internal/ubuntu plucky/main s390x libblas-dev s390x 3.12.1-2 [254 kB] 302s Get:30 http://ftpmaster.internal/ubuntu plucky/main s390x libbz2-dev s390x 1.0.8-6 [39.1 kB] 302s Get:31 http://ftpmaster.internal/ubuntu plucky/main s390x libdeflate-dev s390x 1.23-1 [52.2 kB] 302s Get:32 http://ftpmaster.internal/ubuntu plucky/main s390x libicu-dev s390x 76.1-1ubuntu2 [12.2 MB] 312s Get:33 http://ftpmaster.internal/ubuntu plucky/main s390x libjpeg-turbo8-dev s390x 2.1.5-3ubuntu2 [281 kB] 312s Get:34 http://ftpmaster.internal/ubuntu plucky/main s390x libjpeg8-dev s390x 8c-2ubuntu11 [1484 B] 312s Get:35 http://ftpmaster.internal/ubuntu plucky/main s390x libjpeg-dev s390x 8c-2ubuntu11 [1484 B] 312s Get:36 http://ftpmaster.internal/ubuntu plucky/main s390x liblapack-dev s390x 3.12.1-2 [5967 kB] 318s Get:37 http://ftpmaster.internal/ubuntu plucky/main s390x libncurses-dev s390x 6.5+20250216-2 [407 kB] 318s Get:38 http://ftpmaster.internal/ubuntu plucky/main s390x libpcre2-16-0 s390x 10.45-1 [259 kB] 318s Get:39 http://ftpmaster.internal/ubuntu plucky/main s390x libpcre2-32-0 s390x 10.45-1 [245 kB] 319s Get:40 http://ftpmaster.internal/ubuntu plucky/main s390x libpcre2-posix3 s390x 10.45-1 [7080 B] 319s Get:41 http://ftpmaster.internal/ubuntu plucky/main s390x libpcre2-dev s390x 10.45-1 [899 kB] 320s Get:42 http://ftpmaster.internal/ubuntu plucky/main s390x libpkgconf3 s390x 1.8.1-4 [31.2 kB] 320s Get:43 http://ftpmaster.internal/ubuntu plucky/main s390x zlib1g-dev s390x 1:1.3.dfsg+really1.3.1-1ubuntu1 [898 kB] 320s Get:44 http://ftpmaster.internal/ubuntu plucky/main s390x libpng-dev s390x 1.6.47-1 [278 kB] 321s Get:45 http://ftpmaster.internal/ubuntu plucky/main s390x libreadline-dev s390x 8.2-6 [187 kB] 321s Get:46 http://ftpmaster.internal/ubuntu plucky/main s390x liblzma-dev s390x 5.6.4-1 [183 kB] 321s Get:47 http://ftpmaster.internal/ubuntu plucky/main s390x pkgconf-bin s390x 1.8.1-4 [21.5 kB] 321s Get:48 http://ftpmaster.internal/ubuntu plucky/main s390x pkgconf s390x 1.8.1-4 [16.7 kB] 321s Get:49 http://ftpmaster.internal/ubuntu plucky/main s390x libtirpc-dev s390x 1.3.4+ds-1.3 [196 kB] 321s Get:50 http://ftpmaster.internal/ubuntu plucky/universe s390x r-base-dev all 4.4.3-1 [4176 B] 321s Get:51 http://ftpmaster.internal/ubuntu plucky/universe s390x pkg-r-autopkgtest all 20231212ubuntu1 [6448 B] 321s Fetched 82.3 MB in 1min 26s (954 kB/s) 322s Selecting previously unselected package libisl23:s390x. 322s (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 ... 58705 files and directories currently installed.) 322s Preparing to unpack .../00-libisl23_0.27-1_s390x.deb ... 322s Unpacking libisl23:s390x (0.27-1) ... 322s Selecting previously unselected package libmpc3:s390x. 322s Preparing to unpack .../01-libmpc3_1.3.1-1build2_s390x.deb ... 322s Unpacking libmpc3:s390x (1.3.1-1build2) ... 322s Selecting previously unselected package cpp-14-s390x-linux-gnu. 322s Preparing to unpack .../02-cpp-14-s390x-linux-gnu_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking cpp-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package cpp-14. 322s Preparing to unpack .../03-cpp-14_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking cpp-14 (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package cpp-s390x-linux-gnu. 322s Preparing to unpack .../04-cpp-s390x-linux-gnu_4%3a14.2.0-1ubuntu1_s390x.deb ... 322s Unpacking cpp-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 322s Selecting previously unselected package cpp. 322s Preparing to unpack .../05-cpp_4%3a14.2.0-1ubuntu1_s390x.deb ... 322s Unpacking cpp (4:14.2.0-1ubuntu1) ... 322s Selecting previously unselected package libcc1-0:s390x. 322s Preparing to unpack .../06-libcc1-0_15-20250222-0ubuntu1_s390x.deb ... 322s Unpacking libcc1-0:s390x (15-20250222-0ubuntu1) ... 322s Selecting previously unselected package libitm1:s390x. 322s Preparing to unpack .../07-libitm1_15-20250222-0ubuntu1_s390x.deb ... 322s Unpacking libitm1:s390x (15-20250222-0ubuntu1) ... 322s Selecting previously unselected package libasan8:s390x. 322s Preparing to unpack .../08-libasan8_15-20250222-0ubuntu1_s390x.deb ... 322s Unpacking libasan8:s390x (15-20250222-0ubuntu1) ... 322s Selecting previously unselected package libubsan1:s390x. 322s Preparing to unpack .../09-libubsan1_15-20250222-0ubuntu1_s390x.deb ... 322s Unpacking libubsan1:s390x (15-20250222-0ubuntu1) ... 322s Selecting previously unselected package libgcc-14-dev:s390x. 322s Preparing to unpack .../10-libgcc-14-dev_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking libgcc-14-dev:s390x (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package gcc-14-s390x-linux-gnu. 322s Preparing to unpack .../11-gcc-14-s390x-linux-gnu_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking gcc-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package gcc-14. 322s Preparing to unpack .../12-gcc-14_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking gcc-14 (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package gcc-s390x-linux-gnu. 322s Preparing to unpack .../13-gcc-s390x-linux-gnu_4%3a14.2.0-1ubuntu1_s390x.deb ... 322s Unpacking gcc-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 322s Selecting previously unselected package gcc. 322s Preparing to unpack .../14-gcc_4%3a14.2.0-1ubuntu1_s390x.deb ... 322s Unpacking gcc (4:14.2.0-1ubuntu1) ... 322s Selecting previously unselected package libstdc++-14-dev:s390x. 322s Preparing to unpack .../15-libstdc++-14-dev_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking libstdc++-14-dev:s390x (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package g++-14-s390x-linux-gnu. 322s Preparing to unpack .../16-g++-14-s390x-linux-gnu_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking g++-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package g++-14. 322s Preparing to unpack .../17-g++-14_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking g++-14 (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package g++-s390x-linux-gnu. 322s Preparing to unpack .../18-g++-s390x-linux-gnu_4%3a14.2.0-1ubuntu1_s390x.deb ... 322s Unpacking g++-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 322s Selecting previously unselected package g++. 322s Preparing to unpack .../19-g++_4%3a14.2.0-1ubuntu1_s390x.deb ... 322s Unpacking g++ (4:14.2.0-1ubuntu1) ... 322s Selecting previously unselected package build-essential. 322s Preparing to unpack .../20-build-essential_12.10ubuntu1_s390x.deb ... 322s Unpacking build-essential (12.10ubuntu1) ... 322s Selecting previously unselected package dctrl-tools. 322s Preparing to unpack .../21-dctrl-tools_2.24-3build3_s390x.deb ... 322s Unpacking dctrl-tools (2.24-3build3) ... 322s Selecting previously unselected package libgfortran-14-dev:s390x. 322s Preparing to unpack .../22-libgfortran-14-dev_14.2.0-17ubuntu3_s390x.deb ... 322s Unpacking libgfortran-14-dev:s390x (14.2.0-17ubuntu3) ... 322s Selecting previously unselected package gfortran-14-s390x-linux-gnu. 323s Preparing to unpack .../23-gfortran-14-s390x-linux-gnu_14.2.0-17ubuntu3_s390x.deb ... 323s Unpacking gfortran-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 323s Selecting previously unselected package gfortran-14. 323s Preparing to unpack .../24-gfortran-14_14.2.0-17ubuntu3_s390x.deb ... 323s Unpacking gfortran-14 (14.2.0-17ubuntu3) ... 323s Selecting previously unselected package gfortran-s390x-linux-gnu. 323s Preparing to unpack .../25-gfortran-s390x-linux-gnu_4%3a14.2.0-1ubuntu1_s390x.deb ... 323s Unpacking gfortran-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 323s Selecting previously unselected package gfortran. 323s Preparing to unpack .../26-gfortran_4%3a14.2.0-1ubuntu1_s390x.deb ... 323s Unpacking gfortran (4:14.2.0-1ubuntu1) ... 323s Selecting previously unselected package icu-devtools. 323s Preparing to unpack .../27-icu-devtools_76.1-1ubuntu2_s390x.deb ... 323s Unpacking icu-devtools (76.1-1ubuntu2) ... 323s Selecting previously unselected package libblas-dev:s390x. 323s Preparing to unpack .../28-libblas-dev_3.12.1-2_s390x.deb ... 323s Unpacking libblas-dev:s390x (3.12.1-2) ... 323s Selecting previously unselected package libbz2-dev:s390x. 323s Preparing to unpack .../29-libbz2-dev_1.0.8-6_s390x.deb ... 323s Unpacking libbz2-dev:s390x (1.0.8-6) ... 323s Selecting previously unselected package libdeflate-dev:s390x. 323s Preparing to unpack .../30-libdeflate-dev_1.23-1_s390x.deb ... 323s Unpacking libdeflate-dev:s390x (1.23-1) ... 323s Selecting previously unselected package libicu-dev:s390x. 323s Preparing to unpack .../31-libicu-dev_76.1-1ubuntu2_s390x.deb ... 323s Unpacking libicu-dev:s390x (76.1-1ubuntu2) ... 323s Selecting previously unselected package libjpeg-turbo8-dev:s390x. 323s Preparing to unpack .../32-libjpeg-turbo8-dev_2.1.5-3ubuntu2_s390x.deb ... 323s Unpacking libjpeg-turbo8-dev:s390x (2.1.5-3ubuntu2) ... 323s Selecting previously unselected package libjpeg8-dev:s390x. 323s Preparing to unpack .../33-libjpeg8-dev_8c-2ubuntu11_s390x.deb ... 323s Unpacking libjpeg8-dev:s390x (8c-2ubuntu11) ... 323s Selecting previously unselected package libjpeg-dev:s390x. 323s Preparing to unpack .../34-libjpeg-dev_8c-2ubuntu11_s390x.deb ... 323s Unpacking libjpeg-dev:s390x (8c-2ubuntu11) ... 323s Selecting previously unselected package liblapack-dev:s390x. 323s Preparing to unpack .../35-liblapack-dev_3.12.1-2_s390x.deb ... 323s Unpacking liblapack-dev:s390x (3.12.1-2) ... 323s Selecting previously unselected package libncurses-dev:s390x. 323s Preparing to unpack .../36-libncurses-dev_6.5+20250216-2_s390x.deb ... 323s Unpacking libncurses-dev:s390x (6.5+20250216-2) ... 323s Selecting previously unselected package libpcre2-16-0:s390x. 323s Preparing to unpack .../37-libpcre2-16-0_10.45-1_s390x.deb ... 323s Unpacking libpcre2-16-0:s390x (10.45-1) ... 323s Selecting previously unselected package libpcre2-32-0:s390x. 323s Preparing to unpack .../38-libpcre2-32-0_10.45-1_s390x.deb ... 323s Unpacking libpcre2-32-0:s390x (10.45-1) ... 323s Selecting previously unselected package libpcre2-posix3:s390x. 323s Preparing to unpack .../39-libpcre2-posix3_10.45-1_s390x.deb ... 323s Unpacking libpcre2-posix3:s390x (10.45-1) ... 323s Selecting previously unselected package libpcre2-dev:s390x. 323s Preparing to unpack .../40-libpcre2-dev_10.45-1_s390x.deb ... 323s Unpacking libpcre2-dev:s390x (10.45-1) ... 323s Selecting previously unselected package libpkgconf3:s390x. 323s Preparing to unpack .../41-libpkgconf3_1.8.1-4_s390x.deb ... 323s Unpacking libpkgconf3:s390x (1.8.1-4) ... 323s Selecting previously unselected package zlib1g-dev:s390x. 323s Preparing to unpack .../42-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_s390x.deb ... 323s Unpacking zlib1g-dev:s390x (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 323s Selecting previously unselected package libpng-dev:s390x. 323s Preparing to unpack .../43-libpng-dev_1.6.47-1_s390x.deb ... 323s Unpacking libpng-dev:s390x (1.6.47-1) ... 323s Selecting previously unselected package libreadline-dev:s390x. 323s Preparing to unpack .../44-libreadline-dev_8.2-6_s390x.deb ... 323s Unpacking libreadline-dev:s390x (8.2-6) ... 323s Selecting previously unselected package liblzma-dev:s390x. 323s Preparing to unpack .../45-liblzma-dev_5.6.4-1_s390x.deb ... 323s Unpacking liblzma-dev:s390x (5.6.4-1) ... 323s Selecting previously unselected package pkgconf-bin. 323s Preparing to unpack .../46-pkgconf-bin_1.8.1-4_s390x.deb ... 323s Unpacking pkgconf-bin (1.8.1-4) ... 323s Selecting previously unselected package pkgconf:s390x. 323s Preparing to unpack .../47-pkgconf_1.8.1-4_s390x.deb ... 323s Unpacking pkgconf:s390x (1.8.1-4) ... 323s Selecting previously unselected package libtirpc-dev:s390x. 323s Preparing to unpack .../48-libtirpc-dev_1.3.4+ds-1.3_s390x.deb ... 323s Unpacking libtirpc-dev:s390x (1.3.4+ds-1.3) ... 323s Selecting previously unselected package r-base-dev. 323s Preparing to unpack .../49-r-base-dev_4.4.3-1_all.deb ... 323s Unpacking r-base-dev (4.4.3-1) ... 323s Selecting previously unselected package pkg-r-autopkgtest. 323s Preparing to unpack .../50-pkg-r-autopkgtest_20231212ubuntu1_all.deb ... 323s Unpacking pkg-r-autopkgtest (20231212ubuntu1) ... 323s Setting up libjpeg-turbo8-dev:s390x (2.1.5-3ubuntu2) ... 323s Setting up libncurses-dev:s390x (6.5+20250216-2) ... 323s Setting up libreadline-dev:s390x (8.2-6) ... 323s Setting up libpcre2-16-0:s390x (10.45-1) ... 323s Setting up libpcre2-32-0:s390x (10.45-1) ... 323s Setting up libtirpc-dev:s390x (1.3.4+ds-1.3) ... 323s Setting up libpkgconf3:s390x (1.8.1-4) ... 323s Setting up libmpc3:s390x (1.3.1-1build2) ... 323s Setting up icu-devtools (76.1-1ubuntu2) ... 323s Setting up pkgconf-bin (1.8.1-4) ... 323s Setting up liblzma-dev:s390x (5.6.4-1) ... 323s Setting up libubsan1:s390x (15-20250222-0ubuntu1) ... 323s Setting up zlib1g-dev:s390x (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 323s Setting up libpcre2-posix3:s390x (10.45-1) ... 323s Setting up libasan8:s390x (15-20250222-0ubuntu1) ... 323s Setting up libjpeg8-dev:s390x (8c-2ubuntu11) ... 323s Setting up libisl23:s390x (0.27-1) ... 323s Setting up libdeflate-dev:s390x (1.23-1) ... 323s Setting up libicu-dev:s390x (76.1-1ubuntu2) ... 323s Setting up libcc1-0:s390x (15-20250222-0ubuntu1) ... 323s Setting up libblas-dev:s390x (3.12.1-2) ... 323s update-alternatives: using /usr/lib/s390x-linux-gnu/blas/libblas.so to provide /usr/lib/s390x-linux-gnu/libblas.so (libblas.so-s390x-linux-gnu) in auto mode 323s Setting up dctrl-tools (2.24-3build3) ... 323s Setting up libitm1:s390x (15-20250222-0ubuntu1) ... 323s Setting up libbz2-dev:s390x (1.0.8-6) ... 323s Setting up libpcre2-dev:s390x (10.45-1) ... 323s Setting up libpng-dev:s390x (1.6.47-1) ... 323s Setting up libjpeg-dev:s390x (8c-2ubuntu11) ... 323s Setting up pkgconf:s390x (1.8.1-4) ... 323s Setting up liblapack-dev:s390x (3.12.1-2) ... 323s update-alternatives: using /usr/lib/s390x-linux-gnu/lapack/liblapack.so to provide /usr/lib/s390x-linux-gnu/liblapack.so (liblapack.so-s390x-linux-gnu) in auto mode 323s Setting up cpp-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 323s Setting up cpp-14 (14.2.0-17ubuntu3) ... 323s Setting up libgcc-14-dev:s390x (14.2.0-17ubuntu3) ... 323s Setting up libstdc++-14-dev:s390x (14.2.0-17ubuntu3) ... 323s Setting up libgfortran-14-dev:s390x (14.2.0-17ubuntu3) ... 323s Setting up cpp-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 323s Setting up gcc-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 323s Setting up gcc-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 323s Setting up g++-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 323s Setting up cpp (4:14.2.0-1ubuntu1) ... 323s Setting up gfortran-14-s390x-linux-gnu (14.2.0-17ubuntu3) ... 323s Setting up g++-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 323s Setting up gcc-14 (14.2.0-17ubuntu3) ... 323s Setting up g++-14 (14.2.0-17ubuntu3) ... 323s Setting up gfortran-14 (14.2.0-17ubuntu3) ... 323s Setting up gfortran-s390x-linux-gnu (4:14.2.0-1ubuntu1) ... 323s Setting up gcc (4:14.2.0-1ubuntu1) ... 323s Setting up g++ (4:14.2.0-1ubuntu1) ... 323s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 323s Setting up build-essential (12.10ubuntu1) ... 323s Setting up gfortran (4:14.2.0-1ubuntu1) ... 323s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 323s update-alternatives: warning: skip creation of /usr/share/man/man1/f95.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f95) doesn't exist 323s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 323s update-alternatives: warning: skip creation of /usr/share/man/man1/f77.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f77) doesn't exist 323s Setting up r-base-dev (4.4.3-1) ... 323s Setting up pkg-r-autopkgtest (20231212ubuntu1) ... 323s Processing triggers for libc-bin (2.41-1ubuntu2) ... 323s Processing triggers for man-db (2.13.0-1) ... 324s Processing triggers for install-info (7.1.1-1) ... 325s autopkgtest [17:55:22]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 325s autopkgtest [17:55:22]: test pkg-r-autopkgtest: [----------------------- 325s Test: Try to load the R library actuar 325s 325s R version 4.4.3 (2025-02-28) -- "Trophy Case" 325s Copyright (C) 2025 The R Foundation for Statistical Computing 325s Platform: s390x-ibm-linux-gnu 325s 325s R is free software and comes with ABSOLUTELY NO WARRANTY. 325s You are welcome to redistribute it under certain conditions. 325s Type 'license()' or 'licence()' for distribution details. 325s 325s R is a collaborative project with many contributors. 325s Type 'contributors()' for more information and 325s 'citation()' on how to cite R or R packages in publications. 325s 325s Type 'demo()' for some demos, 'help()' for on-line help, or 325s 'help.start()' for an HTML browser interface to help. 325s Type 'q()' to quit R. 325s 325s > library('actuar') 326s 326s Attaching package: ‘actuar’ 326s 326s The following objects are masked from ‘package:stats’: 326s 326s sd, var 326s 326s The following object is masked from ‘package:grDevices’: 326s 326s cm 326s 326s > 326s > 326s Other tests are currently unsupported! 326s They will be progressively added. 326s autopkgtest [17:55:23]: test pkg-r-autopkgtest: -----------------------] 326s pkg-r-autopkgtest PASS 326s autopkgtest [17:55:23]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 327s autopkgtest [17:55:24]: @@@@@@@@@@@@@@@@@@@@ summary 327s run-unit-test PASS 327s pkg-r-autopkgtest PASS 331s nova [W] Using flock in prodstack6-s390x 331s Creating nova instance adt-plucky-s390x-r-cran-actuar-20250315-174957-juju-7f2275-prod-proposed-migration-environment-20-0515cf08-991c-4fc3-a74a-df865a733ae3 from image adt/ubuntu-plucky-s390x-server-20250315.img (UUID 3d3557fa-fd0f-4bba-9b89-8d5964e09f61)... 331s nova [W] Timed out waiting for 50a85a8d-1aa6-4c0e-817a-449ebe02cc1d to get deleted.