0s autopkgtest [15:57:11]: starting date and time: 2025-03-15 15:57:11+0000 0s autopkgtest [15:57:11]: git checkout: 325255d2 Merge branch 'pin-any-arch' into 'ubuntu/production' 0s autopkgtest [15:57:11]: host juju-7f2275-prod-proposed-migration-environment-9; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.yxv48pj6/out --timeout-copy=6000 --setup-commands 'ln -s /dev/null /etc/systemd/system/bluetooth.service; printf "http_proxy=http://squid.internal:3128\nhttps_proxy=http://squid.internal:3128\nno_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\n" >> /etc/environment' --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 -- lxd -r lxd-armhf-10.145.243.202 lxd-armhf-10.145.243.202:autopkgtest/ubuntu/plucky/armhf 21s autopkgtest [15:57:32]: testbed dpkg architecture: armhf 23s autopkgtest [15:57:34]: testbed apt version: 2.9.33 27s autopkgtest [15:57:38]: @@@@@@@@@@@@@@@@@@@@ test bed setup 28s autopkgtest [15:57:39]: testbed release detected to be: None 36s autopkgtest [15:57:47]: updating testbed package index (apt update) 38s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [126 kB] 39s Get:2 http://ftpmaster.internal/ubuntu plucky InRelease [257 kB] 39s Get:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease [126 kB] 39s Get:4 http://ftpmaster.internal/ubuntu plucky-security InRelease [126 kB] 39s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [379 kB] 40s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.8 kB] 40s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [99.7 kB] 40s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf Packages [114 kB] 40s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf c-n-f Metadata [1832 B] 40s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/restricted armhf c-n-f Metadata [116 B] 40s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf Packages [312 kB] 40s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf c-n-f Metadata [11.1 kB] 40s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse armhf Packages [3472 B] 40s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse armhf c-n-f Metadata [240 B] 40s Get:15 http://ftpmaster.internal/ubuntu plucky/universe Sources [21.0 MB] 63s Get:16 http://ftpmaster.internal/ubuntu plucky/multiverse Sources [299 kB] 65s Get:17 http://ftpmaster.internal/ubuntu plucky/main Sources [1394 kB] 66s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf Packages [1378 kB] 68s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf c-n-f Metadata [29.4 kB] 68s Get:20 http://ftpmaster.internal/ubuntu plucky/restricted armhf c-n-f Metadata [108 B] 68s Get:21 http://ftpmaster.internal/ubuntu plucky/universe armhf Packages [15.1 MB] 85s Get:22 http://ftpmaster.internal/ubuntu plucky/multiverse armhf Packages [172 kB] 87s Fetched 41.0 MB in 49s (843 kB/s) 88s Reading package lists... 94s autopkgtest [15:58:45]: upgrading testbed (apt dist-upgrade and autopurge) 96s Reading package lists... 96s Building dependency tree... 96s Reading state information... 97s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 97s Starting 2 pkgProblemResolver with broken count: 0 97s Done 98s Entering ResolveByKeep 98s 98s Calculating upgrade... 99s The following packages will be upgraded: 99s libc-bin libc6 locales pinentry-curses python3-jinja2 sos strace 99s 7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 99s Need to get 8683 kB of archives. 99s After this operation, 23.6 kB of additional disk space will be used. 99s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc6 armhf 2.41-1ubuntu2 [2932 kB] 103s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc-bin armhf 2.41-1ubuntu2 [545 kB] 103s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf locales all 2.41-1ubuntu2 [4246 kB] 108s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf strace armhf 6.13+ds-1ubuntu1 [445 kB] 108s Get:5 http://ftpmaster.internal/ubuntu plucky/main armhf pinentry-curses armhf 1.3.1-2ubuntu3 [40.6 kB] 108s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf python3-jinja2 all 3.1.5-2ubuntu1 [109 kB] 108s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf sos all 4.9.0-5 [365 kB] 109s Preconfiguring packages ... 109s Fetched 8683 kB in 10s (912 kB/s) 109s (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 ... 64655 files and directories currently installed.) 109s Preparing to unpack .../libc6_2.41-1ubuntu2_armhf.deb ... 110s Unpacking libc6:armhf (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 110s Setting up libc6:armhf (2.41-1ubuntu2) ... 110s (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 ... 64655 files and directories currently installed.) 110s Preparing to unpack .../libc-bin_2.41-1ubuntu2_armhf.deb ... 110s Unpacking libc-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 110s Setting up libc-bin (2.41-1ubuntu2) ... 110s (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 ... 64655 files and directories currently installed.) 110s Preparing to unpack .../locales_2.41-1ubuntu2_all.deb ... 110s Unpacking locales (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 111s Preparing to unpack .../strace_6.13+ds-1ubuntu1_armhf.deb ... 111s Unpacking strace (6.13+ds-1ubuntu1) over (6.11-0ubuntu1) ... 111s Preparing to unpack .../pinentry-curses_1.3.1-2ubuntu3_armhf.deb ... 111s Unpacking pinentry-curses (1.3.1-2ubuntu3) over (1.3.1-2ubuntu2) ... 111s Preparing to unpack .../python3-jinja2_3.1.5-2ubuntu1_all.deb ... 111s Unpacking python3-jinja2 (3.1.5-2ubuntu1) over (3.1.5-2) ... 111s Preparing to unpack .../archives/sos_4.9.0-5_all.deb ... 111s Unpacking sos (4.9.0-5) over (4.9.0-4) ... 111s Setting up sos (4.9.0-5) ... 112s Setting up pinentry-curses (1.3.1-2ubuntu3) ... 112s Setting up locales (2.41-1ubuntu2) ... 113s Generating locales (this might take a while)... 115s en_US.UTF-8... done 115s Generation complete. 115s Setting up python3-jinja2 (3.1.5-2ubuntu1) ... 115s Setting up strace (6.13+ds-1ubuntu1) ... 115s Processing triggers for man-db (2.13.0-1) ... 116s Processing triggers for systemd (257.3-1ubuntu3) ... 119s Reading package lists... 119s Building dependency tree... 119s Reading state information... 120s Starting pkgProblemResolver with broken count: 0 120s Starting 2 pkgProblemResolver with broken count: 0 120s Done 120s Solving dependencies... 121s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 123s autopkgtest [15:59:14]: rebooting testbed after setup commands that affected boot 164s autopkgtest [15:59:55]: testbed running kernel: Linux 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 18:10:51 UTC 2 189s autopkgtest [16:00:20]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-actuar 201s Get:1 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (dsc) [2135 B] 201s Get:2 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (tar) [984 kB] 201s Get:3 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (diff) [3424 B] 201s gpgv: Signature made Wed Jan 22 07:35:04 2025 UTC 201s gpgv: using RSA key 73471499CC60ED9EEE805946C5BD6C8F2295D502 201s gpgv: issuer "plessy@debian.org" 201s gpgv: Can't check signature: No public key 201s dpkg-source: warning: cannot verify inline signature for ./r-cran-actuar_3.3-5-1.dsc: no acceptable signature found 201s autopkgtest [16:00:32]: testing package r-cran-actuar version 3.3-5-1 204s autopkgtest [16:00:35]: build not needed 207s autopkgtest [16:00:38]: test run-unit-test: preparing testbed 209s Reading package lists... 209s Building dependency tree... 209s Reading state information... 209s Starting pkgProblemResolver with broken count: 0 210s Starting 2 pkgProblemResolver with broken count: 0 210s Done 210s The following NEW packages will be installed: 210s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono libblas3 210s libcairo2 libdatrie1 libdeflate0 libfontconfig1 libfreetype6 libgfortran5 210s libgomp1 libgraphite2-3 libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 210s libjpeg8 liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 210s libpangoft2-1.0-0 libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 210s libtcl8.6 libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 210s libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 r-base-core r-cran-actuar 210s r-cran-expint r-cran-mass unzip x11-common xdg-utils zip 211s 0 upgraded, 48 newly installed, 0 to remove and 0 not upgraded. 211s Need to get 40.3 MB of archives. 211s After this operation, 74.3 MB of additional disk space will be used. 211s Get:1 http://ftpmaster.internal/ubuntu plucky/main armhf libfreetype6 armhf 2.13.3+dfsg-1 [330 kB] 211s Get:2 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-dejavu-mono all 2.37-8 [502 kB] 212s Get:3 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-dejavu-core all 2.37-8 [835 kB] 213s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf fontconfig-config armhf 2.15.0-2ubuntu1 [37.5 kB] 213s Get:5 http://ftpmaster.internal/ubuntu plucky/main armhf libfontconfig1 armhf 2.15.0-2ubuntu1 [114 kB] 213s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf fontconfig armhf 2.15.0-2ubuntu1 [190 kB] 213s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf libblas3 armhf 3.12.1-2 [132 kB] 213s Get:8 http://ftpmaster.internal/ubuntu plucky/main armhf libpixman-1-0 armhf 0.44.0-3 [183 kB] 214s Get:9 http://ftpmaster.internal/ubuntu plucky/main armhf libxcb-render0 armhf 1.17.0-2 [15.3 kB] 214s Get:10 http://ftpmaster.internal/ubuntu plucky/main armhf libxcb-shm0 armhf 1.17.0-2 [5774 B] 214s Get:11 http://ftpmaster.internal/ubuntu plucky/main armhf libxrender1 armhf 1:0.9.10-1.1build1 [16.0 kB] 214s Get:12 http://ftpmaster.internal/ubuntu plucky/main armhf libcairo2 armhf 1.18.2-2 [484 kB] 214s Get:13 http://ftpmaster.internal/ubuntu plucky/main armhf libdatrie1 armhf 0.2.13-3build1 [15.7 kB] 214s Get:14 http://ftpmaster.internal/ubuntu plucky/main armhf libdeflate0 armhf 1.23-1 [38.5 kB] 214s Get:15 http://ftpmaster.internal/ubuntu plucky/main armhf libgfortran5 armhf 15-20250222-0ubuntu1 [330 kB] 215s Get:16 http://ftpmaster.internal/ubuntu plucky/main armhf libgomp1 armhf 15-20250222-0ubuntu1 [128 kB] 215s Get:17 http://ftpmaster.internal/ubuntu plucky/main armhf libgraphite2-3 armhf 1.3.14-2ubuntu1 [64.8 kB] 215s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf libharfbuzz0b armhf 10.2.0-1 [464 kB] 215s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf x11-common all 1:7.7+23ubuntu3 [21.7 kB] 215s Get:20 http://ftpmaster.internal/ubuntu plucky/main armhf libice6 armhf 2:1.1.1-1 [36.5 kB] 215s Get:21 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg-turbo8 armhf 2.1.5-3ubuntu2 [127 kB] 216s Get:22 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg8 armhf 8c-2ubuntu11 [2148 B] 216s Get:23 http://ftpmaster.internal/ubuntu plucky/main armhf liblapack3 armhf 3.12.1-2 [2091 kB] 218s Get:24 http://ftpmaster.internal/ubuntu plucky/main armhf liblerc4 armhf 4.0.0+ds-5ubuntu1 [160 kB] 218s Get:25 http://ftpmaster.internal/ubuntu plucky/main armhf libthai-data all 0.1.29-2build1 [158 kB] 218s Get:26 http://ftpmaster.internal/ubuntu plucky/main armhf libthai0 armhf 0.1.29-2build1 [15.2 kB] 218s Get:27 http://ftpmaster.internal/ubuntu plucky/main armhf libpango-1.0-0 armhf 1.56.2-1 [216 kB] 218s Get:28 http://ftpmaster.internal/ubuntu plucky/main armhf libpangoft2-1.0-0 armhf 1.56.2-1 [43.6 kB] 219s Get:29 http://ftpmaster.internal/ubuntu plucky/main armhf libpangocairo-1.0-0 armhf 1.56.2-1 [25.1 kB] 219s Get:30 http://ftpmaster.internal/ubuntu plucky/main armhf libpaper2 armhf 2.2.5-0.3 [16.3 kB] 219s Get:31 http://ftpmaster.internal/ubuntu plucky/main armhf libpaper-utils armhf 2.2.5-0.3 [14.2 kB] 219s Get:32 http://ftpmaster.internal/ubuntu plucky/main armhf libsharpyuv0 armhf 1.5.0-0.1 [16.4 kB] 219s Get:33 http://ftpmaster.internal/ubuntu plucky/main armhf libsm6 armhf 2:1.2.4-1 [15.1 kB] 219s Get:34 http://ftpmaster.internal/ubuntu plucky/main armhf libtcl8.6 armhf 8.6.16+dfsg-1 [909 kB] 220s Get:35 http://ftpmaster.internal/ubuntu plucky/main armhf libjbig0 armhf 2.1-6.1ubuntu2 [24.9 kB] 220s Get:36 http://ftpmaster.internal/ubuntu plucky/main armhf libwebp7 armhf 1.5.0-0.1 [188 kB] 220s Get:37 http://ftpmaster.internal/ubuntu plucky/main armhf libtiff6 armhf 4.5.1+git230720-4ubuntu4 [179 kB] 220s Get:38 http://ftpmaster.internal/ubuntu plucky/main armhf libxft2 armhf 2.3.6-1build1 [37.4 kB] 220s Get:39 http://ftpmaster.internal/ubuntu plucky/main armhf libxss1 armhf 1:1.2.3-1build3 [6500 B] 220s Get:40 http://ftpmaster.internal/ubuntu plucky/main armhf libtk8.6 armhf 8.6.16-1 [686 kB] 221s Get:41 http://ftpmaster.internal/ubuntu plucky/main armhf libxt6t64 armhf 1:1.2.1-1.2build1 [145 kB] 221s Get:42 http://ftpmaster.internal/ubuntu plucky/main armhf zip armhf 3.0-14ubuntu2 [164 kB] 221s Get:43 http://ftpmaster.internal/ubuntu plucky/main armhf unzip armhf 6.0-28ubuntu6 [167 kB] 222s Get:44 http://ftpmaster.internal/ubuntu plucky/main armhf xdg-utils all 1.2.1-2ubuntu1 [66.0 kB] 222s Get:45 http://ftpmaster.internal/ubuntu plucky/universe armhf r-base-core armhf 4.4.3-1 [28.2 MB] 257s Get:46 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-expint armhf 0.1-8-1 [208 kB] 257s Get:47 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-actuar armhf 3.3-5-1 [1409 kB] 259s Get:48 http://ftpmaster.internal/ubuntu plucky/universe armhf r-cran-mass armhf 7.3-64-1 [1105 kB] 261s Preconfiguring packages ... 261s Fetched 40.3 MB in 50s (800 kB/s) 261s Selecting previously unselected package libfreetype6:armhf. 261s (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 ... 64655 files and directories currently installed.) 261s Preparing to unpack .../00-libfreetype6_2.13.3+dfsg-1_armhf.deb ... 261s Unpacking libfreetype6:armhf (2.13.3+dfsg-1) ... 261s Selecting previously unselected package fonts-dejavu-mono. 261s Preparing to unpack .../01-fonts-dejavu-mono_2.37-8_all.deb ... 261s Unpacking fonts-dejavu-mono (2.37-8) ... 261s Selecting previously unselected package fonts-dejavu-core. 261s Preparing to unpack .../02-fonts-dejavu-core_2.37-8_all.deb ... 261s Unpacking fonts-dejavu-core (2.37-8) ... 262s Selecting previously unselected package fontconfig-config. 262s Preparing to unpack .../03-fontconfig-config_2.15.0-2ubuntu1_armhf.deb ... 262s Unpacking fontconfig-config (2.15.0-2ubuntu1) ... 262s Selecting previously unselected package libfontconfig1:armhf. 262s Preparing to unpack .../04-libfontconfig1_2.15.0-2ubuntu1_armhf.deb ... 262s Unpacking libfontconfig1:armhf (2.15.0-2ubuntu1) ... 262s Selecting previously unselected package fontconfig. 262s Preparing to unpack .../05-fontconfig_2.15.0-2ubuntu1_armhf.deb ... 262s Unpacking fontconfig (2.15.0-2ubuntu1) ... 262s Selecting previously unselected package libblas3:armhf. 262s Preparing to unpack .../06-libblas3_3.12.1-2_armhf.deb ... 262s Unpacking libblas3:armhf (3.12.1-2) ... 262s Selecting previously unselected package libpixman-1-0:armhf. 262s Preparing to unpack .../07-libpixman-1-0_0.44.0-3_armhf.deb ... 262s Unpacking libpixman-1-0:armhf (0.44.0-3) ... 262s Selecting previously unselected package libxcb-render0:armhf. 262s Preparing to unpack .../08-libxcb-render0_1.17.0-2_armhf.deb ... 262s Unpacking libxcb-render0:armhf (1.17.0-2) ... 262s Selecting previously unselected package libxcb-shm0:armhf. 262s Preparing to unpack .../09-libxcb-shm0_1.17.0-2_armhf.deb ... 262s Unpacking libxcb-shm0:armhf (1.17.0-2) ... 262s Selecting previously unselected package libxrender1:armhf. 262s Preparing to unpack .../10-libxrender1_1%3a0.9.10-1.1build1_armhf.deb ... 262s Unpacking libxrender1:armhf (1:0.9.10-1.1build1) ... 262s Selecting previously unselected package libcairo2:armhf. 262s Preparing to unpack .../11-libcairo2_1.18.2-2_armhf.deb ... 262s Unpacking libcairo2:armhf (1.18.2-2) ... 262s Selecting previously unselected package libdatrie1:armhf. 262s Preparing to unpack .../12-libdatrie1_0.2.13-3build1_armhf.deb ... 262s Unpacking libdatrie1:armhf (0.2.13-3build1) ... 262s Selecting previously unselected package libdeflate0:armhf. 262s Preparing to unpack .../13-libdeflate0_1.23-1_armhf.deb ... 262s Unpacking libdeflate0:armhf (1.23-1) ... 262s Selecting previously unselected package libgfortran5:armhf. 262s Preparing to unpack .../14-libgfortran5_15-20250222-0ubuntu1_armhf.deb ... 262s Unpacking libgfortran5:armhf (15-20250222-0ubuntu1) ... 262s Selecting previously unselected package libgomp1:armhf. 262s Preparing to unpack .../15-libgomp1_15-20250222-0ubuntu1_armhf.deb ... 262s Unpacking libgomp1:armhf (15-20250222-0ubuntu1) ... 262s Selecting previously unselected package libgraphite2-3:armhf. 262s Preparing to unpack .../16-libgraphite2-3_1.3.14-2ubuntu1_armhf.deb ... 262s Unpacking libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 262s Selecting previously unselected package libharfbuzz0b:armhf. 262s Preparing to unpack .../17-libharfbuzz0b_10.2.0-1_armhf.deb ... 262s Unpacking libharfbuzz0b:armhf (10.2.0-1) ... 262s Selecting previously unselected package x11-common. 262s Preparing to unpack .../18-x11-common_1%3a7.7+23ubuntu3_all.deb ... 262s Unpacking x11-common (1:7.7+23ubuntu3) ... 262s Selecting previously unselected package libice6:armhf. 262s Preparing to unpack .../19-libice6_2%3a1.1.1-1_armhf.deb ... 262s Unpacking libice6:armhf (2:1.1.1-1) ... 262s Selecting previously unselected package libjpeg-turbo8:armhf. 262s Preparing to unpack .../20-libjpeg-turbo8_2.1.5-3ubuntu2_armhf.deb ... 262s Unpacking libjpeg-turbo8:armhf (2.1.5-3ubuntu2) ... 262s Selecting previously unselected package libjpeg8:armhf. 262s Preparing to unpack .../21-libjpeg8_8c-2ubuntu11_armhf.deb ... 262s Unpacking libjpeg8:armhf (8c-2ubuntu11) ... 262s Selecting previously unselected package liblapack3:armhf. 262s Preparing to unpack .../22-liblapack3_3.12.1-2_armhf.deb ... 262s Unpacking liblapack3:armhf (3.12.1-2) ... 263s Selecting previously unselected package liblerc4:armhf. 263s Preparing to unpack .../23-liblerc4_4.0.0+ds-5ubuntu1_armhf.deb ... 263s Unpacking liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 263s Selecting previously unselected package libthai-data. 263s Preparing to unpack .../24-libthai-data_0.1.29-2build1_all.deb ... 263s Unpacking libthai-data (0.1.29-2build1) ... 263s Selecting previously unselected package libthai0:armhf. 263s Preparing to unpack .../25-libthai0_0.1.29-2build1_armhf.deb ... 263s Unpacking libthai0:armhf (0.1.29-2build1) ... 263s Selecting previously unselected package libpango-1.0-0:armhf. 263s Preparing to unpack .../26-libpango-1.0-0_1.56.2-1_armhf.deb ... 263s Unpacking libpango-1.0-0:armhf (1.56.2-1) ... 263s Selecting previously unselected package libpangoft2-1.0-0:armhf. 263s Preparing to unpack .../27-libpangoft2-1.0-0_1.56.2-1_armhf.deb ... 263s Unpacking libpangoft2-1.0-0:armhf (1.56.2-1) ... 263s Selecting previously unselected package libpangocairo-1.0-0:armhf. 263s Preparing to unpack .../28-libpangocairo-1.0-0_1.56.2-1_armhf.deb ... 263s Unpacking libpangocairo-1.0-0:armhf (1.56.2-1) ... 263s Selecting previously unselected package libpaper2:armhf. 263s Preparing to unpack .../29-libpaper2_2.2.5-0.3_armhf.deb ... 263s Unpacking libpaper2:armhf (2.2.5-0.3) ... 263s Selecting previously unselected package libpaper-utils. 263s Preparing to unpack .../30-libpaper-utils_2.2.5-0.3_armhf.deb ... 263s Unpacking libpaper-utils (2.2.5-0.3) ... 263s Selecting previously unselected package libsharpyuv0:armhf. 263s Preparing to unpack .../31-libsharpyuv0_1.5.0-0.1_armhf.deb ... 263s Unpacking libsharpyuv0:armhf (1.5.0-0.1) ... 263s Selecting previously unselected package libsm6:armhf. 263s Preparing to unpack .../32-libsm6_2%3a1.2.4-1_armhf.deb ... 263s Unpacking libsm6:armhf (2:1.2.4-1) ... 263s Selecting previously unselected package libtcl8.6:armhf. 263s Preparing to unpack .../33-libtcl8.6_8.6.16+dfsg-1_armhf.deb ... 263s Unpacking libtcl8.6:armhf (8.6.16+dfsg-1) ... 263s Selecting previously unselected package libjbig0:armhf. 263s Preparing to unpack .../34-libjbig0_2.1-6.1ubuntu2_armhf.deb ... 263s Unpacking libjbig0:armhf (2.1-6.1ubuntu2) ... 263s Selecting previously unselected package libwebp7:armhf. 263s Preparing to unpack .../35-libwebp7_1.5.0-0.1_armhf.deb ... 263s Unpacking libwebp7:armhf (1.5.0-0.1) ... 263s Selecting previously unselected package libtiff6:armhf. 263s Preparing to unpack .../36-libtiff6_4.5.1+git230720-4ubuntu4_armhf.deb ... 263s Unpacking libtiff6:armhf (4.5.1+git230720-4ubuntu4) ... 263s Selecting previously unselected package libxft2:armhf. 263s Preparing to unpack .../37-libxft2_2.3.6-1build1_armhf.deb ... 263s Unpacking libxft2:armhf (2.3.6-1build1) ... 263s Selecting previously unselected package libxss1:armhf. 263s Preparing to unpack .../38-libxss1_1%3a1.2.3-1build3_armhf.deb ... 263s Unpacking libxss1:armhf (1:1.2.3-1build3) ... 263s Selecting previously unselected package libtk8.6:armhf. 263s Preparing to unpack .../39-libtk8.6_8.6.16-1_armhf.deb ... 263s Unpacking libtk8.6:armhf (8.6.16-1) ... 263s Selecting previously unselected package libxt6t64:armhf. 263s Preparing to unpack .../40-libxt6t64_1%3a1.2.1-1.2build1_armhf.deb ... 263s Unpacking libxt6t64:armhf (1:1.2.1-1.2build1) ... 263s Selecting previously unselected package zip. 263s Preparing to unpack .../41-zip_3.0-14ubuntu2_armhf.deb ... 263s Unpacking zip (3.0-14ubuntu2) ... 263s Selecting previously unselected package unzip. 263s Preparing to unpack .../42-unzip_6.0-28ubuntu6_armhf.deb ... 263s Unpacking unzip (6.0-28ubuntu6) ... 263s Selecting previously unselected package xdg-utils. 263s Preparing to unpack .../43-xdg-utils_1.2.1-2ubuntu1_all.deb ... 263s Unpacking xdg-utils (1.2.1-2ubuntu1) ... 263s Selecting previously unselected package r-base-core. 263s Preparing to unpack .../44-r-base-core_4.4.3-1_armhf.deb ... 263s Unpacking r-base-core (4.4.3-1) ... 264s Selecting previously unselected package r-cran-expint. 264s Preparing to unpack .../45-r-cran-expint_0.1-8-1_armhf.deb ... 264s Unpacking r-cran-expint (0.1-8-1) ... 264s Selecting previously unselected package r-cran-actuar. 264s Preparing to unpack .../46-r-cran-actuar_3.3-5-1_armhf.deb ... 264s Unpacking r-cran-actuar (3.3-5-1) ... 264s Selecting previously unselected package r-cran-mass. 264s Preparing to unpack .../47-r-cran-mass_7.3-64-1_armhf.deb ... 264s Unpacking r-cran-mass (7.3-64-1) ... 264s Setting up libgraphite2-3:armhf (1.3.14-2ubuntu1) ... 264s Setting up libpixman-1-0:armhf (0.44.0-3) ... 264s Setting up libsharpyuv0:armhf (1.5.0-0.1) ... 264s Setting up liblerc4:armhf (4.0.0+ds-5ubuntu1) ... 264s Setting up libxrender1:armhf (1:0.9.10-1.1build1) ... 264s Setting up libdatrie1:armhf (0.2.13-3build1) ... 264s Setting up libxcb-render0:armhf (1.17.0-2) ... 264s Setting up unzip (6.0-28ubuntu6) ... 264s Setting up x11-common (1:7.7+23ubuntu3) ... 264s Setting up libdeflate0:armhf (1.23-1) ... 264s Setting up libxcb-shm0:armhf (1.17.0-2) ... 264s Setting up libgomp1:armhf (15-20250222-0ubuntu1) ... 264s Setting up libjbig0:armhf (2.1-6.1ubuntu2) ... 264s Setting up zip (3.0-14ubuntu2) ... 264s Setting up libblas3:armhf (3.12.1-2) ... 264s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so.3 to provide /usr/lib/arm-linux-gnueabihf/libblas.so.3 (libblas.so.3-arm-linux-gnueabihf) in auto mode 264s Setting up libfreetype6:armhf (2.13.3+dfsg-1) ... 264s Setting up fonts-dejavu-mono (2.37-8) ... 264s Setting up libtcl8.6:armhf (8.6.16+dfsg-1) ... 264s Setting up fonts-dejavu-core (2.37-8) ... 265s Setting up libjpeg-turbo8:armhf (2.1.5-3ubuntu2) ... 265s Setting up libgfortran5:armhf (15-20250222-0ubuntu1) ... 265s Setting up libwebp7:armhf (1.5.0-0.1) ... 265s Setting up libharfbuzz0b:armhf (10.2.0-1) ... 265s Setting up libthai-data (0.1.29-2build1) ... 265s Setting up libxss1:armhf (1:1.2.3-1build3) ... 265s Setting up libpaper2:armhf (2.2.5-0.3) ... 265s Setting up xdg-utils (1.2.1-2ubuntu1) ... 265s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 265s Setting up libjpeg8:armhf (8c-2ubuntu11) ... 265s Setting up libice6:armhf (2:1.1.1-1) ... 265s Setting up liblapack3:armhf (3.12.1-2) ... 265s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so.3 to provide /usr/lib/arm-linux-gnueabihf/liblapack.so.3 (liblapack.so.3-arm-linux-gnueabihf) in auto mode 265s Setting up fontconfig-config (2.15.0-2ubuntu1) ... 265s Setting up libpaper-utils (2.2.5-0.3) ... 265s Setting up libthai0:armhf (0.1.29-2build1) ... 265s Setting up libtiff6:armhf (4.5.1+git230720-4ubuntu4) ... 265s Setting up libfontconfig1:armhf (2.15.0-2ubuntu1) ... 265s Setting up libsm6:armhf (2:1.2.4-1) ... 265s Setting up fontconfig (2.15.0-2ubuntu1) ... 267s Regenerating fonts cache... done. 267s Setting up libxft2:armhf (2.3.6-1build1) ... 267s Setting up libtk8.6:armhf (8.6.16-1) ... 267s Setting up libpango-1.0-0:armhf (1.56.2-1) ... 267s Setting up libcairo2:armhf (1.18.2-2) ... 267s Setting up libxt6t64:armhf (1:1.2.1-1.2build1) ... 267s Setting up libpangoft2-1.0-0:armhf (1.56.2-1) ... 267s Setting up libpangocairo-1.0-0:armhf (1.56.2-1) ... 267s Setting up r-base-core (4.4.3-1) ... 267s Creating config file /etc/R/Renviron with new version 267s Setting up r-cran-mass (7.3-64-1) ... 267s Setting up r-cran-expint (0.1-8-1) ... 267s Setting up r-cran-actuar (3.3-5-1) ... 267s Processing triggers for man-db (2.13.0-1) ... 268s Processing triggers for install-info (7.1.1-1) ... 268s Processing triggers for libc-bin (2.41-1ubuntu2) ... 276s autopkgtest [16:01:47]: test run-unit-test: [----------------------- 279s BEGIN TEST betaint-tests.R 279s 279s R version 4.4.3 (2025-02-28) -- "Trophy Case" 279s Copyright (C) 2025 The R Foundation for Statistical Computing 279s Platform: arm-unknown-linux-gnueabihf (32-bit) 279s 279s R is free software and comes with ABSOLUTELY NO WARRANTY. 279s You are welcome to redistribute it under certain conditions. 279s Type 'license()' or 'licence()' for distribution details. 279s 279s R is a collaborative project with many contributors. 279s Type 'contributors()' for more information and 279s 'citation()' on how to cite R or R packages in publications. 279s 279s Type 'demo()' for some demos, 'help()' for on-line help, or 279s 'help.start()' for an HTML browser interface to help. 279s Type 'q()' to quit R. 279s 279s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 279s > ### 279s > ### Tests for the "beta integral" 279s > ### 279s > ### B(a, b; x) = Gamma(a + b) int_0^x t^(a-1) (1 - t)^(b-1) dt 279s > ### 279s > ### Inspired by (and some parts taken from) `tests/d-p-q-r-tests.R` in 279s > ### R sources. 279s > ### 279s > ### AUTHOR: Vincent Goulet with 279s > ### indirect help from the R Core Team 279s > 279s > ## Load the package 279s > library(actuar) 279s 279s Attaching package: ‘actuar’ 279s 279s The following objects are masked from ‘package:stats’: 279s 279s sd, var 279s 279s > 279s > ## Define a "local" version of the otherwise non-exported function 279s > ## 'betaint'. 279s > betaint <- actuar:::betaint 279s > 279s > ## Special values and utilities. Taken from `tests/d-p-q-r-tests.R`. 279s > xMax <- 1 - .Machine$double.eps 279s > xMin <- .Machine$double.xmin 279s > All.eq <- function(x, y) 279s + { 279s + all.equal.numeric(x, y, tolerance = 64 * .Machine$double.eps, 279s + scale = max(0, mean(abs(x), na.rm = TRUE))) 279s + } 279s > 279s > if(!interactive()) 279s + set.seed(123) 279s > 279s > ## Limiting cases 279s > stopifnot(exprs = { 279s + !is.finite(betaint(0.3, Inf, 2)) 279s + !is.finite(betaint(0.3, Inf, -2.2)) 279s + is.nan (betaint(0.3, 0, 2)) 279s + !is.finite(betaint(0.3, 2, Inf)) 279s + is.nan (betaint(0.3, 2, -2.2)) # a <= 1 + floor(-b) 279s + is.nan (betaint(0.3, 2, 0)) 279s + }) 279s The following object is masked from ‘package:grDevices’: 279s 279s cm 279s 279s > 279s > ## Tests for cases with b > 0 279s > x <- c(xMin, runif(10), xMax) 279s Warning messages: 279s 1: In betaint(0.3, 0, 2) : NaNs produced 279s 2: In betaint(0.3, 2, -2.2) : NaNs produced 279s 3: In betaint(0.3, 2, 0) : NaNs produced 279s > b <- 2 279s > for (a in rlnorm(5, 2)) 279s + stopifnot(exprs = { 279s + All.eq(betaint(x, a, b), 279s + gamma(a) * gamma(b) * pbeta(x, a, b)) 279s + }) 279s > 279s > ## Tests for cases with b < 0 279s > b <- -2.2 279s > r <- floor(-b) # r = 2 279s > for (a in 1 + r + rlnorm(5, 2)) 279s + { 279s + s <- (x^(a-1) * (1-x)^b)/b + 279s + ((a-1) * x^(a-2) * (1-x)^(b+1))/(b * (b+1)) + 279s + ((a-1) * (a-2) * x^(a-3) * (1-x)^(b+2))/(b * (b+1) * (b+2)) 279s + stopifnot(exprs = { 279s + all.equal(betaint(x, a, b), 279s + -gamma(a+b) * s + 279s + (a-1)*(a-2)*(a-3) * gamma(a-r-1)/(b*(b+1)*(b+2)) * 279s + gamma(b+r+1)*pbeta(x, a-r-1, b+r+1)) 279s + }) 279s + } 279s > 279s BEGIN TEST dpqr-tests.R 279s 279s R version 4.4.3 (2025-02-28) -- "Trophy Case" 279s Copyright (C) 2025 The R Foundation for Statistical Computing 279s Platform: arm-unknown-linux-gnueabihf (32-bit) 279s 279s R is free software and comes with ABSOLUTELY NO WARRANTY. 279s You are welcome to redistribute it under certain conditions. 279s Type 'license()' or 'licence()' for distribution details. 279s 279s R is a collaborative project with many contributors. 279s Type 'contributors()' for more information and 279s 'citation()' on how to cite R or R packages in publications. 279s 279s Type 'demo()' for some demos, 'help()' for on-line help, or 279s 'help.start()' for an HTML browser interface to help. 279s Type 'q()' to quit R. 279s 279s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 279s > ### 279s > ### Tests of functions for continuous and discrete probability 279s > ### distributions. 279s > ### 279s > ### Despite the name of the file, the tests are for [dpqrm,lev] 279s > ### functions (for continuous distributions): 279s > ### 279s > ### d: density or probability mass 279s > ### p: cumulative distribution 279s > ### q: quantile 279s > ### r: random number generation 279s > ### m: moment 279s > ### lev: limited moment 279s > ### 279s > ### Distributions are classified and sorted as in appendix A and 279s > ### appendix B of the 'distributions' package vignette. 279s > ### 279s > ### Inspired by (and some parts taken from) `tests/d-p-q-r-tests.R` in 279s > ### R sources. 279s > ### 279s > ### AUTHOR: Vincent Goulet with 279s > ### indirect help from the R Core Team 279s > 279s > ## Load the package 279s > library(actuar) 279s 279s Attaching package: ‘actuar’ 279s 279s The following objects are masked from ‘package:stats’: 279s 279s sd, var 279s 279s The following object is masked from ‘package:grDevices’: 279s 279s cm 279s 279s > library(expint) # for gammainc 279s > 279s > ## Define a "local" version of the otherwise non-exported function 279s > ## 'betaint'. 279s > betaint <- actuar:::betaint 279s > 279s > ## No warnings, unless explicitly asserted via tools::assertWarning. 279s > options(warn = 2) 279s > assertWarning <- tools::assertWarning 280s > 280s > ## Special values and utilities. Taken from `tests/d-p-q-r-tests.R`. 280s > Meps <- .Machine$double.eps 280s > xMax <- .Machine$double.xmax 280s > xMin <- .Machine$double.xmin 280s > All.eq <- function(x, y) 280s + { 280s + all.equal.numeric(x, y, tolerance = 64 * .Machine$double.eps, 280s + scale = max(0, mean(abs(x), na.rm = TRUE))) 280s + } 280s > 280s > if(!interactive()) 280s + set.seed(123) 280s > 280s > ### 280s > ### CONTINUOUS DISTRIBUTIONS 280s > ### 280s > 280s > ## 280s > ## FELLER-PARETO AND PARETO II, III, IV DISTRIBUTIONS 280s > ## 280s > 280s > ## When reasonable, we also test consistency with the special cases 280s > ## min = 0: 280s > ## 280s > ## Feller-Pareto -> Transformated beta 280s > ## Pareto IV -> Burr 280s > ## Pareto III -> Loglogistic 280s > ## Pareto II -> Pareto 280s > 280s > ## Density: first check that functions return 0 when scale = Inf, and 280s > ## when x = scale = Inf. 280s > stopifnot(exprs = { 280s + dfpareto(c(42, Inf), min = 1, shape1 = 2, shape2 = 3, shape3 = 4, scale = Inf) == c(0, 0) 280s + dpareto4(c(42, Inf), min = 1, shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 280s + dpareto3(c(42, Inf), min = 1, shape = 3, scale = Inf) == c(0, 0) 280s + dpareto2(c(42, Inf), min = 1, shape = 2, scale = Inf) == c(0, 0) 280s + }) 280s > 280s > ## Next test density functions for an array of standard values. 280s > nshpar <- 3 # (maximum) number of shape parameters 280s > min <- round(rnorm(30, 2), 2) 280s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 280s > scpar <- rlnorm(30, 2) # scale parameters 280s > for (i in seq_along(min)) 280s + { 280s + m <- min[i] 280s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 280s + Be <- beta(a, t) 280s + for (s in scpar) 280s + { 280s + x <- rfpareto(100, min = m, shape1 = a, shape2 = g, shape3 = t, scale = s) 280s + y <- (x - m)/s 280s + u <- 1/(1 + y^(-g)) 280s + stopifnot(exprs = { 280s + all.equal(d1 <- dfpareto(x, min = m, 280s + shape1 = a, shape2 = g, shape3 = t, 280s + scale = s), 280s + d2 <- dfpareto(y, min = 0, 280s + shape1 = a, shape2 = g, shape3 = t, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d2, 280s + dtrbeta(y, 280s + shape1 = a, shape2 = g, shape3 = t, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + g * y^(g*t - 1)/(s * Be * (1 + y^g)^(a + t)), 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + g * u^t * (1 - u)^a/((x - m) * Be), 280s + tolerance = 1e-10) 280s + }) 280s + x <- rpareto4(100, min = m, shape1 = a, shape2 = g, scale = s) 280s + y <- (x - m)/s 280s + u <- 1/(1 + y^g) 280s + stopifnot(exprs = { 280s + all.equal(d1 <- dpareto4(x, min = m, 280s + shape1 = a, shape2 = g, 280s + scale = s), 280s + d2 <- dpareto4(y, min = 0, 280s + shape1 = a, shape2 = g, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d2, 280s + dburr(y, 280s + shape1 = a, shape2 = g, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + a * g * y^(g - 1)/(s * (1 + y^g)^(a + 1)), 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + a * g * u^a * (1 - u)/(x - m), 280s + tolerance = 1e-10) 280s + }) 280s + x <- rpareto3(100, min = m, shape = g, scale = s) 280s + y <- (x - m)/s 280s + u <- 1/(1 + y^(-g)) 280s + stopifnot(exprs = { 280s + all.equal(d1 <- dpareto3(x, min = m, 280s + shape = g, 280s + scale = s), 280s + d2 <- dpareto3(y, min = 0, 280s + shape = g, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d2, 280s + dllogis(y, 280s + shape = g, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + g * y^(g - 1)/(s * (1 + y^g)^2), 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + g * u * (1 - u)/(x - m), 280s + tolerance = 1e-10) 280s + }) 280s + x <- rpareto2(100, min = m, shape = a, scale = s) 280s + y <- (x - m)/s 280s + u <- 1/(1 + y) 280s + stopifnot(exprs = { 280s + all.equal(d1 <- dpareto2(x, min = m, 280s + shape = a, 280s + scale = s), 280s + d2 <- dpareto2(y, min = 0, 280s + shape = a, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d2, 280s + dpareto(y, 280s + shape = a, 280s + scale = 1)/s, 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + a/(s * (1 + y)^(a + 1)), 280s + tolerance = 1e-10) 280s + all.equal(d1, 280s + a * u^a * (1 - u)/(x - m), 280s + tolerance = 1e-10) 280s + }) 280s + } 280s + } 281s > 281s > ## Tests on the cumulative distribution function. 281s > ## 281s > ## Note: when shape1 = shape3 = 1, the underlying beta distribution is 281s > ## a uniform. Therefore, pfpareto(x, min, 1, shape2, 1, scale) should 281s > ## return the value of u = v/(1 + v), v = ((x - min)/scale)^shape2. 281s > ## 281s > ## x = 2/Meps = 2^53 (with min = 0, shape2 = scale = 1) is the value 281s > ## where the cdf would jump to 1 if we weren't using the trick to 281s > ## compute the cdf with pbeta(1 - u, ..., lower = FALSE). 281s > scLrg <- 1e300 * c(0.5, 1, 2) 281s > m <- rnorm(1) 281s > stopifnot(exprs = { 281s + pfpareto(Inf, min = 10, 1, 2, 3, scale = xMax) == 1 281s + pfpareto(2^53, min = 0, 1, 1, 1, scale = 1) != 1 281s + pfpareto(2^53 + xMax, min = xMax, 1, 1, 1, scale = 1) != 1 281s + all.equal(pfpareto(xMin + m, min = m, 1, 1, 1, scale = 1), xMin) 281s + all.equal(y <- pfpareto(1e300 + m, min = m, 281s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 281s + shape3 = 1, 281s + scale = scLrg, log = TRUE), 281s + ptrbeta(1e300, 281s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 281s + shape3 = 1, 281s + scale = scLrg, log = TRUE)) 281s + all.equal(y, 281s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 281s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE), 281s + pbeta(c(4/5, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 281s + pbeta(4/5, 3, 1, lower.tail = FALSE, log = TRUE))) 281s + }) 281s > stopifnot(exprs = { 281s + ppareto4(Inf, min = 10, 1, 3, scale = xMax) == 1 281s + ppareto4(2^53, min = 0, 1, 1, scale = 1) != 1 281s + ppareto4(2^53 + xMax, min = xMax, 1, 1, scale = 1) != 1 281s + all.equal(ppareto4(xMin + m, min = m, 1, 1, scale = 1), xMin) 281s + all.equal(y <- ppareto4(1e300 + m, min = m, 281s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 281s + scale = scLrg, log = TRUE), 281s + pburr(1e300, 281s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 281s + scale = scLrg, log = TRUE)) 281s + all.equal(y, 281s + c(log(1 - c(1/3, 1/2, 2/3)^3), 281s + log(1 - c(1/5, 1/2, 4/5)^3))) 281s + }) 281s > stopifnot(exprs = { 281s + ppareto3(Inf, min = 10, 3, scale = xMax) == 1 281s + ppareto3(2^53, min = 0, 1, scale = 1) != 1 281s + ppareto3(2^53 + xMax, min = xMax, 1, scale = 1) != 1 281s + all.equal(ppareto3(xMin + m, min = m, 1, scale = 1), xMin) 281s + all.equal(y <- ppareto3(1e300 + m, min = m, 281s + shape = rep(c(1, 2), each = length(scLrg)), 281s + scale = scLrg, log = TRUE), 281s + pllogis (1e300, 281s + shape = rep(c(1, 2), each = length(scLrg)), 281s + scale = scLrg, log = TRUE)) 281s + all.equal(y, 281s + c(log(c(2/3, 1/2, 1/3)), 281s + log(c(4/5, 1/2, 1/5)))) 281s + }) 281s > stopifnot(exprs = { 281s + ppareto2(Inf, min = 10, 3, scale = xMax) == 1 281s + ppareto2(2^53, min = 0, 1, scale = 1) != 1 281s + ppareto2(2^53 + xMax, min = xMax, 1, scale = 1) != 1 281s + all.equal(ppareto2(xMin + m, min = m, 1, scale = 1), xMin) 281s + all.equal(y <- ppareto2(1e300 + m, min = m, 281s + shape = 3, 281s + scale = scLrg, log = TRUE), 281s + ppareto (1e300, 281s + shape = 3, 281s + scale = scLrg, log = TRUE)) 281s + all.equal(y, 281s + c(log(1 - c(1/3, 1/2, 2/3)^3))) 281s + }) 281s > 281s > ## Also check that distribution functions return 0 when scale = Inf. 281s > stopifnot(exprs = { 281s + pfpareto(x, min = m, shape1 = a, shape2 = g, shape3 = t, scale = Inf) == 0 281s + ppareto4(x, min = m, shape1 = a, shape2 = g, scale = Inf) == 0 281s + ppareto3(x, min = m, shape = g, scale = Inf) == 0 281s + ppareto2(x, min = m, shape = a, scale = Inf) == 0 281s + }) 281s > 281s > ## Tests for first three (positive) moments 281s > ## 281s > ## Simulation of new parameters ensuring that the first three moments 281s > ## exist. 281s > set.seed(123) # reset the seed 281s > nshpar <- 3 # (maximum) number of shape parameters 281s > min <- round(rnorm(30, 2), 2) 281s > shpar <- replicate(30, c(3, 3, 0) + rlnorm(nshpar, 2), simplify = FALSE) 281s > scpar <- rlnorm(30, 2) # scale parameters 281s > for (i in seq_along(min)) 281s + { 281s + m <- min[i] 281s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 281s + Be <- beta(a, t) 281s + Ga <- gamma(a) 281s + for (s in scpar) 281s + { 281s + stopifnot(exprs = { 281s + All.eq(mfpareto(1, min = m, 281s + shape1 = a, shape2 = g, shape3 = t, 281s + scale = s), 281s + m * (Be + (s/m) * beta(t + 1/g, a - 1/g))/Be) 281s + All.eq(mfpareto(2, min = m, 281s + shape1 = a, shape2 = g, shape3 = t, 281s + scale = s), 281s + m^2 * (Be + 2 * (s/m) * beta(t + 1/g, a - 1/g) 281s + + (s/m)^2 * beta(t + 2/g, a - 2/g))/Be) 281s + All.eq(mfpareto(3, min = m, 281s + shape1 = a, shape2 = g, shape3 = t, 281s + scale = s), 281s + m^3 * (Be + 3 * (s/m) * beta(t + 1/g, a - 1/g) 281s + + 3 * (s/m)^2 * beta(t + 2/g, a - 2/g) 281s + + (s/m)^3 * beta(t + 3/g, a - 3/g))/Be) 281s + }) 281s + stopifnot(exprs = { 281s + All.eq(mpareto4(1, min = m, 281s + shape1 = a, shape2 = g, 281s + scale = s), 281s + m * (Ga + (s/m) * gamma(1 + 1/g) * gamma(a - 1/g))/Ga) 281s + All.eq(mpareto4(2, min = m, 281s + shape1 = a, shape2 = g, 281s + scale = s), 281s + m^2 * (Ga + 2 * (s/m) * gamma(1 + 1/g) * gamma(a - 1/g) 281s + + (s/m)^2 * gamma(1 + 2/g) * gamma(a - 2/g))/Ga) 281s + All.eq(mpareto4(3, min = m, 281s + shape1 = a, shape2 = g, 281s + scale = s), 281s + m^3 * (Ga + 3 * (s/m) * gamma(1 + 1/g) * gamma(a - 1/g) 281s + + 3 * (s/m)^2 * gamma(1 + 2/g) * gamma(a - 2/g) 281s + + (s/m)^3 * gamma(1 + 3/g) * gamma(a - 3/g))/Ga) 281s + }) 281s + stopifnot(exprs = { 281s + All.eq(mpareto3(1, min = m, 281s + shape = g, 281s + scale = s), 281s + m * (1 + (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g))) 281s + All.eq(mpareto3(2, min = m, 281s + shape = g, 281s + scale = s), 281s + m^2 * (1 + 2 * (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g) 281s + + (s/m)^2 * gamma(1 + 2/g) * gamma(1 - 2/g))) 281s + All.eq(mpareto3(3, min = m, 281s + shape = g, 281s + scale = s), 281s + m^3 * (1 + 3 * (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g) 281s + + 3 * (s/m)^2 * gamma(1 + 2/g) * gamma(1 - 2/g) 281s + + (s/m)^3 * gamma(1 + 3/g) * gamma(1 - 3/g))) 281s + }) 281s + stopifnot(exprs = { 281s + All.eq(mpareto2(1, min = m, 281s + shape = a, 281s + scale = s), 281s + m * (Ga + (s/m) * gamma(1 + 1) * gamma(a - 1))/Ga) 281s + All.eq(mpareto2(2, min = m, 281s + shape = a, 281s + scale = s), 281s + m^2 * (Ga + 2 * (s/m) * gamma(1 + 1) * gamma(a - 1) 281s + + (s/m)^2 * gamma(1 + 2) * gamma(a - 2))/Ga) 281s + All.eq(mpareto2(3, min = m, 281s + shape = a, 281s + scale = s), 281s + m^3 * (Ga + 3 * (s/m) * gamma(1 + 1) * gamma(a - 1) 281s + + 3 * (s/m)^2 * gamma(1 + 2) * gamma(a - 2) 281s + + (s/m)^3 * gamma(1 + 3) * gamma(a - 3))/Ga) 281s + }) 281s + } 281s + } 281s > 281s > ## Tests for first three limited moments 281s > ## 281s > ## Limits are taken from quantiles of each distribution. 281s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) 281s > for (i in seq_along(min)) 281s + { 281s + m <- min[i] 281s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 281s + Ga <- gamma(a) 281s + Gt <- gamma(t) 281s + for (s in scpar) 281s + { 281s + limit <- qfpareto(q, min = m, 281s + shape1 = a, shape2 = g, shape3 = t, 281s + scale = s) 281s + y <- (limit - m)/s 281s + u <- 1/(1 + y^(-g)) 281s + stopifnot(exprs = { 281s + All.eq(levfpareto(limit, order = 1, min = m, 281s + shape1 = a, shape2 = g, shape3 = t, 281s + scale = s), 281s + m * (betaint(u, t, a) + (s/m) * betaint(u, t + 1/g, a - 1/g))/(Ga * Gt) + 281s + limit * pbeta(u, t, a, lower = FALSE)) 281s + All.eq(levfpareto(limit, order = 2, min = m, 281s + shape1 = a, shape2 = g, shape3 = t, 281s + scale = s), 281s + m^2 * (betaint(u, t, a) + 2 * (s/m) * betaint(u, t + 1/g, a - 1/g) 281s + + (s/m)^2 * betaint(u, t + 2/g, a - 2/g))/(Ga * Gt) + 281s + limit^2 * pbeta(u, t, a, lower = FALSE)) 281s + All.eq(levfpareto(limit, order = 3, min = m, 281s + shape1 = a, shape2 = g, shape3 = t, 281s + scale = s), 281s + m^3 * (betaint(u, t, a) + 3 * (s/m) * betaint(u, t + 1/g, a - 1/g) 281s + + 3 * (s/m)^2 * betaint(u, t + 2/g, a - 2/g) 281s + + (s/m)^3 * betaint(u, t + 3/g, a - 3/g))/(Ga * Gt) + 281s + limit^3 * pbeta(u, t, a, lower = FALSE)) 281s + }) 281s + limit <- qpareto4(q, min = m, 281s + shape1 = a, shape2 = g, 281s + scale = s) 281s + y <- (limit - m)/s 281s + u <- 1/(1 + y^g) 281s + u1m <- 1/(1 + y^(-g)) 281s + stopifnot(exprs = { 281s + All.eq(levpareto4(limit, order = 1, min = m, 281s + shape1 = a, shape2 = g, 281s + scale = s), 281s + m * (betaint(u1m, 1, a) + (s/m) * betaint(u1m, 1 + 1/g, a - 1/g))/Ga + 281s + limit * u^a) 281s + All.eq(levpareto4(limit, order = 2, min = m, 281s + shape1 = a, shape2 = g, 281s + scale = s), 281s + m^2 * (betaint(u1m, 1, a) + 2 * (s/m) * betaint(u1m, 1 + 1/g, a - 1/g) 281s + + (s/m)^2 * betaint(u1m, 1 + 2/g, a - 2/g))/Ga + 281s + limit^2 * u^a) 281s + All.eq(levpareto4(limit, order = 3, min = m, 281s + shape1 = a, shape2 = g, 281s + scale = s), 281s + m^3 * (betaint(u1m, 1, a) + 3 * (s/m) * betaint(u1m, 1 + 1/g, a - 1/g) 281s + + 3 * (s/m)^2 * betaint(u1m, 1 + 2/g, a - 2/g) 281s + + (s/m)^3 * betaint(u1m, 1 + 3/g, a - 3/g))/Ga + 281s + limit^3 * u^a) 281s + }) 281s + limit <- qpareto3(q, min = m, 281s + shape = g, 281s + scale = s) 281s + y <- (limit - m)/s 281s + u <- 1/(1 + y^(-g)) 281s + u1m <- 1/(1 + y^g) 281s + stopifnot(exprs = { 281s + All.eq(levpareto3(limit, order = 1, min = m, 281s + shape = g, 281s + scale = s), 281s + m * (u + (s/m) * betaint(u, 1 + 1/g, 1 - 1/g)) + 281s + limit * u1m) 281s + All.eq(levpareto3(limit, order = 2, min = m, 281s + shape = g, 281s + scale = s), 281s + m^2 * (u + 2 * (s/m) * betaint(u, 1 + 1/g, 1 - 1/g) 281s + + (s/m)^2 * betaint(u, 1 + 2/g, 1 - 2/g)) + 281s + limit^2 * u1m) 281s + All.eq(levpareto3(limit, order = 3, min = m, 281s + shape = g, 281s + scale = s), 281s + m^3 * (u + 3 * (s/m) * betaint(u, 1 + 1/g, 1 - 1/g) 281s + + 3 * (s/m)^2 * betaint(u, 1 + 2/g, 1 - 2/g) 281s + + (s/m)^3 * betaint(u, 1 + 3/g, 1 - 3/g)) + 281s + limit^3 * u1m) 281s + }) 281s + limit <- qpareto2(q, min = m, 281s + shape = a, 281s + scale = s) 281s + y <- (limit - m)/s 281s + u <- 1/(1 + y) 281s + u1m <- 1/(1 + y^(-1)) 281s + stopifnot(exprs = { 281s + All.eq(levpareto2(limit, order = 1, min = m, 281s + shape = a, 281s + scale = s), 281s + m * (betaint(u1m, 1, a) + (s/m) * betaint(u1m, 1 + 1, a - 1))/Ga + 281s + limit * u^a) 281s + All.eq(levpareto2(limit, order = 2, min = m, 281s + shape = a, 281s + scale = s), 281s + m^2 * (betaint(u1m, 1, a) + 2 * (s/m) * betaint(u1m, 1 + 1, a - 1) 281s + + (s/m)^2 * betaint(u1m, 1 + 2, a - 2))/Ga + 281s + limit^2 * u^a) 281s + All.eq(levpareto2(limit, order = 3, min = m, 281s + shape = a, 281s + scale = s), 281s + m^3 * (betaint(u1m, 1, a) + 3 * (s/m) * betaint(u1m, 1 + 1, a - 1) 281s + + 3 * (s/m)^2 * betaint(u1m, 1 + 2, a - 2) 281s + + (s/m)^3 * betaint(u1m, 1 + 3, a - 3))/Ga + 281s + limit^3 * u^a) 281s + }) 281s + } 281s + } 283s > 283s > ## 283s > ## TRANSFORMED BETA FAMILY 283s > ## 283s > 283s > ## Density: first check that functions return 0 when scale = Inf, and 283s > ## when x = scale = Inf. 283s > stopifnot(exprs = { 283s + dtrbeta (c(42, Inf), shape1 = 2, shape2 = 3, shape3 = 4, scale = Inf) == c(0, 0) 283s + dburr (c(42, Inf), shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 283s + dllogis (c(42, Inf), shape = 3, scale = Inf) == c(0, 0) 283s + dparalogis (c(42, Inf), shape = 2, scale = Inf) == c(0, 0) 283s + dgenpareto (c(42, Inf), shape1 = 2, shape2 = 4, scale = Inf) == c(0, 0) 283s + dpareto (c(42, Inf), shape = 2, scale = Inf) == c(0, 0) 283s + dinvburr (c(42, Inf), shape1 = 4, shape2 = 3, scale = Inf) == c(0, 0) 283s + dinvpareto (c(42, Inf), shape = 4, scale = Inf) == c(0, 0) 283s + dinvparalogis(c(42, Inf), shape = 4, scale = Inf) == c(0, 0) 283s + }) 283s > 283s > ## Next test density functions for an array of standard values. 283s > set.seed(123) # reset the seed 283s > nshpar <- 3 # (maximum) number of shape parameters 283s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 283s > scpar <- rlnorm(30, 2) # scale parameters 283s > for (i in seq_along(shpar)) 283s + { 283s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 283s + Be <- beta(a, t) 283s + for (s in scpar) 283s + { 283s + x <- rtrbeta(100, shape1 = a, shape2 = g, shape3 = t, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^(-g)) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dtrbeta(x, shape1 = a, shape2 = g, shape3 = t, 283s + scale = s), 283s + d2 <- dtrbeta(y, shape1 = a, shape2 = g, shape3 = t, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + g * y^(g*t - 1)/(s * Be * (1 + y^g)^(a + t)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + g * u^t * (1 - u)^a/(x * Be), 283s + tolerance = 1e-10) 283s + }) 283s + x <- rburr(100, shape1 = a, shape2 = g, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^g) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dburr(x, shape1 = a, shape2 = g, 283s + scale = s), 283s + d2 <- dburr(y, shape1 = a, shape2 = g, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + a * g * y^(g - 1)/(s * (1 + y^g)^(a + 1)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + a * g * u^a * (1 - u)/x, 283s + tolerance = 1e-10) 283s + }) 283s + x <- rllogis(100, shape = g, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^(-g)) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dllogis(x, shape = g, 283s + scale = s), 283s + d2 <- dllogis(y, shape = g, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + g * y^(g - 1)/(s * (1 + y^g)^2), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + g * u * (1 - u)/x, 283s + tolerance = 1e-10) 283s + }) 283s + x <- rparalogis(100, shape = a, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^a) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dparalogis(x, shape = a, 283s + scale = s), 283s + d2 <- dparalogis(y, shape = a, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + a^2 * y^(a - 1)/(s * (1 + y^a)^(a + 1)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + a^2 * u^a * (1 - u)/x, 283s + tolerance = 1e-10) 283s + }) 283s + x <- rgenpareto(100, shape1 = a, shape2 = t, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^(-1)) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dgenpareto(x, shape1 = a, shape2 = t, 283s + scale = s), 283s + d2 <- dgenpareto(y, shape1 = a, shape2 = t, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + y^(t - 1)/(s * Be * (1 + y)^(a + t)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + u^t * (1 - u)^a/(x * Be), 283s + tolerance = 1e-10) 283s + }) 283s + x <- rpareto(100, shape = a, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dpareto(x, shape = a, 283s + scale = s), 283s + d2 <- dpareto(y, shape = a, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + a/(s * (1 + y)^(a + 1)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + a * u^a * (1 - u)/x, 283s + tolerance = 1e-10) 283s + }) 283s + x <- rpareto1(100, min = s, shape = a) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dpareto1(x, min = s, shape = a), 283s + a * s^a/(x^(a + 1)), 283s + tolerance = 1e-10) 283s + }) 283s + x <- rinvburr(100, shape1 = t, shape2 = g, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^(-g)) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dinvburr(x, shape1 = t, shape2 = g, 283s + scale = s), 283s + d2 <- dinvburr(y, shape1 = t, shape2 = g, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + t * g * y^(g*t - 1)/(s * (1 + y^g)^(t + 1)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + t * g * u^t * (1 - u)/x, 283s + tolerance = 1e-10) 283s + }) 283s + x <- rinvpareto(100, shape = t, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^(-1)) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dinvpareto(x, shape = t, 283s + scale = s), 283s + d2 <- dinvpareto(y, shape = t, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + t * y^(t - 1)/(s * (1 + y)^(t + 1)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + t * u^t * (1 - u)/x, 283s + tolerance = 1e-10) 283s + }) 283s + x <- rinvparalogis(100, shape = t, scale = s) 283s + y <- x/s 283s + u <- 1/(1 + y^(-t)) 283s + stopifnot(exprs = { 283s + all.equal(d1 <- dinvparalogis(x, shape = t, 283s + scale = s), 283s + d2 <- dinvparalogis(y, shape = t, 283s + scale = 1)/s, 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + t^2 * y^(t^2 - 1)/(s * (1 + y^t)^(t + 1)), 283s + tolerance = 1e-10) 283s + all.equal(d1, 283s + t^2 * u^t * (1 - u)/x, 283s + tolerance = 1e-10) 283s + }) 283s + } 283s + } 285s > 285s > ## Tests on the cumulative distribution function. 285s > ## 285s > ## Note: when shape1 = shape3 = 1, the underlying beta distribution is 285s > ## a uniform. Therefore, ptrbeta(x, 1, shape2, 1, scale) should return 285s > ## the value of u = v/(1 + v), v = (x/scale)^shape2. 285s > ## 285s > ## x = 2/Meps = 2^53 (with, shape2 = scale = 1) is the value where the 285s > ## cdf would jump to 1 if we weren't using the trick to compute the 285s > ## cdf with pbeta(1 - u, ..., lower = FALSE). 285s > scLrg <- 1e300 * c(0.5, 1, 2) 285s > stopifnot(exprs = { 285s + ptrbeta(Inf, 1, 2, 3, scale = xMax) == 1 285s + ptrbeta(2^53, 1, 1, 1, scale = 1) != 1 285s + all.equal(ptrbeta(xMin, 1, 1, 1, scale = 1), xMin) 285s + all.equal(ptrbeta(1e300, 285s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 285s + shape3 = 1, 285s + scale = scLrg, log = TRUE), 285s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 285s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE), 285s + pbeta(c(4/5, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 285s + pbeta(4/5, 3, 1, lower.tail = FALSE, log = TRUE))) 285s + }) 285s > stopifnot(exprs = { 285s + pburr(Inf, 1, 3, scale = xMax) == 1 285s + pburr(2^53, 1, 1, scale = 1) != 1 285s + all.equal(pburr(xMin, 1, 1, scale = 1), xMin) 285s + all.equal(pburr(1e300, 285s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 285s + scale = scLrg, log = TRUE), 285s + c(log(1 - c(1/3, 1/2, 2/3)^3), 285s + log(1 - c(1/5, 1/2, 4/5)^3))) 285s + }) 285s > stopifnot(exprs = { 285s + pllogis(Inf, 3, scale = xMax) == 1 285s + pllogis(2^53, 1, scale = 1) != 1 285s + all.equal(pllogis(xMin, 1, scale = 1), xMin) 285s + all.equal(pllogis(1e300, 285s + shape = rep(c(1, 2), each = length(scLrg)), 285s + scale = scLrg, log = TRUE), 285s + c(log(c(2/3, 1/2, 1/3)), 285s + log(c(4/5, 1/2, 1/5)))) 285s + }) 285s > stopifnot(exprs = { 285s + pparalogis(Inf, 3, scale = xMax) == 1 285s + pparalogis(2^53, 1, scale = 1) != 1 285s + all.equal(pparalogis(xMin, 1, scale = 1), xMin) 285s + all.equal(pparalogis(1e300, 285s + shape = rep(c(2, 3), each = length(scLrg)), 285s + scale = scLrg, log = TRUE), 285s + c(log(1 - c(1/5, 1/2, 4/5)^2), 285s + log(1 - c(1/9, 1/2, 8/9)^3))) 285s + }) 285s > stopifnot(exprs = { 285s + pgenpareto(Inf, 1, 3, scale = xMax) == 1 285s + pgenpareto(2^53, 1, 1, scale = 1) != 1 285s + all.equal(pgenpareto(xMin, 1, 1, scale = 1), xMin) 285s + all.equal(pgenpareto(1e300, 285s + shape1 = 3, shape2 = 1, 285s + scale = scLrg, log = TRUE), 285s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 285s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE))) 285s + }) 285s > stopifnot(exprs = { 285s + ppareto(Inf, 3, scale = xMax) == 1 285s + ppareto(2^53, 1, scale = 1) != 1 285s + all.equal(ppareto(xMin, 1, scale = 1), xMin) 285s + all.equal(ppareto(1e300, 285s + shape = 3, 285s + scale = scLrg, log = TRUE), 285s + c(log(1 - c(1/3, 1/2, 2/3)^3))) 285s + }) 285s > stopifnot(exprs = { 285s + ppareto1(Inf, 3, min = xMax) == 1 285s + ppareto1(2^53, 1, min = 1) != 1 285s + all.equal(ppareto1(xMin, 1, min = 1), xMin) 285s + all.equal(ppareto1(1e300, 285s + shape = 3, 285s + min = 1e300 * c(0.001, 0.1, 0.5), log = TRUE), 285s + c(log(1 - c(0.001, 0.1, 0.5)^3))) 285s + }) 285s > stopifnot(exprs = { 285s + pinvburr(Inf, 1, 3, scale = xMax) == 1 285s + pinvburr(2^53, 1, 1, scale = 1) != 1 285s + all.equal(pinvburr(xMin, 1, 1, scale = 1), xMin) 285s + all.equal(pinvburr(1e300, 285s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 285s + scale = scLrg, log = TRUE), 285s + c(log(c(2/3, 1/2, 1/3)^3), 285s + log(c(4/5, 1/2, 1/5)^3))) 285s + }) 285s > stopifnot(exprs = { 285s + pinvpareto(Inf, 3, scale = xMax) == 1 285s + pinvpareto(2^53, 1, scale = 1) != 1 285s + all.equal(pinvpareto(xMin, 1, scale = 1), xMin) 285s + all.equal(pinvpareto(1e300, 285s + shape = 3, 285s + scale = scLrg, log = TRUE), 285s + c(log(c(2/3, 1/2, 1/3)^3))) 285s + }) 285s > stopifnot(exprs = { 285s + pinvparalogis(Inf, 3, scale = xMax) == 1 285s + pinvparalogis(2^53, 1, scale = 1) != 1 285s + all.equal(pinvparalogis(xMin, 1, scale = 1), xMin) 285s + all.equal(pinvparalogis(1e300, 285s + shape = rep(c(2, 3), each = length(scLrg)), 285s + scale = scLrg, log = TRUE), 285s + c(log(c(4/5, 1/2, 1/5)^2), 285s + log(c(8/9, 1/2, 1/9)^3))) 285s + }) 285s > 285s > ## Also check that distribution functions return 0 when scale = Inf. 285s > stopifnot(exprs = { 285s + ptrbeta (x, shape1 = a, shape2 = g, shape3 = t, scale = Inf) == 0 285s + pburr (x, shape1 = a, shape2 = g, scale = Inf) == 0 285s + pllogis (x, shape = g, scale = Inf) == 0 285s + pparalogis (x, shape = a, scale = Inf) == 0 285s + pgenpareto (x, shape1 = a, shape2 = t, scale = Inf) == 0 285s + ppareto (x, shape = a, scale = Inf) == 0 285s + pinvburr (x, shape1 = t, shape2 = g, scale = Inf) == 0 285s + pinvpareto (x, shape = t, scale = Inf) == 0 285s + pinvparalogis(x, shape = t, scale = Inf) == 0 285s + }) 285s > 285s > ## Tests for first three positive moments and first two negative 285s > ## moments. 285s > ## 285s > ## Simulation of new parameters ensuring that said moments exist. 285s > set.seed(123) # reset the seed 285s > nshpar <- 3 # (maximum) number of shape parameters 285s > shpar <- replicate(30, c(3, 3, 3) + rlnorm(nshpar, 2), simplify = FALSE) 285s > scpar <- rlnorm(30, 2) # scale parameters 285s > k <- c(-2, -1, 1, 2, 3) # orders 285s > for (i in seq_along(shpar)) 285s + { 285s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 285s + Be <- beta(a, t) 285s + Ga <- gamma(a) 285s + for (s in scpar) 285s + { 285s + stopifnot(exprs = { 285s + All.eq(mtrbeta(k, shape1 = a, shape2 = g, shape3 = t, scale = s), 285s + s^k * beta(t + k/g, a - k/g)/Be) 285s + All.eq(mburr(k, shape1 = a, shape2 = g, scale = s), 285s + s^k * gamma(1 + k/g) * gamma(a - k/g)/Ga) 285s + All.eq(mllogis(k, shape = g, scale = s), 285s + s^k * gamma(1 + k/g) * gamma(1 - k/g)) 285s + All.eq(mparalogis(k, shape = a, scale = s), 285s + s^k * gamma(1 + k/a) * gamma(a - k/a)/Ga) 285s + All.eq(mgenpareto(k, shape1 = a, shape2 = t, scale = s), 285s + s^k * beta(t + k, a - k)/Be) 285s + All.eq(mpareto(k[k > -1], shape = a, scale = s), 285s + s^k[k > -1] * gamma(1 + k[k > -1]) * gamma(a - k[k > -1])/Ga) 285s + All.eq(mpareto1(k, shape = a, min = s), 285s + s^k * a/(a - k)) 285s + All.eq(minvburr(k, shape1 = a, shape2 = g, scale = s), 285s + s^k * gamma(a + k/g) * gamma(1 - k/g)/Ga) 285s + All.eq(minvpareto(k[k < 1], shape = a, scale = s), 285s + s^k[k < 1] * gamma(a + k[k < 1]) * gamma(1 - k[k < 1])/Ga) 285s + All.eq(minvparalogis(k, shape = a, scale = s), 285s + s^k * gamma(a + k/a) * gamma(1 - k/a)/Ga) 285s + }) 285s + } 285s + } 285s > 285s > ## Tests for first three positive limited moments and first two 285s > ## negative limited moments. 285s > ## 285s > ## Limits are taken from quantiles of each distribution. 285s > order <- c(-2, -1, 1, 2, 3) # orders 285s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 285s > for (i in seq_along(shpar)) 285s + { 285s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 285s + Ga <- gamma(a) 285s + Gt <- gamma(t) 285s + for (s in scpar) 285s + { 285s + limit <- qtrbeta(q, shape1 = a, shape2 = g, shape3 = t, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^(-g)) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levtrbeta(limit, order = k, shape1 = a, shape2 = g, shape3 = t, scale = s), 285s + s^k * betaint(u, t + k/g, a - k/g)/(Ga * Gt) + 285s + limit^k * pbeta(u, t, a, lower = FALSE)) 285s + }) 285s + limit <- qburr(q, shape1 = a, shape2 = g, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^g) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levburr(limit, order = k, shape1 = a, shape2 = g, scale = s), 285s + s^k * betaint(1 - u, 1 + k/g, a - k/g)/Ga + 285s + limit^k * u^a) 285s + }) 285s + limit <- qllogis(q, shape = g, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^(-g)) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levllogis(limit, order = k, shape = g, scale = s), 285s + s^k * betaint(u, 1 + k/g, 1 - k/g) + 285s + limit^k * (1 - u)) 285s + }) 285s + limit <- qparalogis(q, shape = a, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^a) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levparalogis(limit, order = k, shape = a, scale = s), 285s + s^k * betaint(1 - u, 1 + k/a, a - k/a)/Ga + 285s + limit^k * u^a) 285s + }) 285s + limit <- qgenpareto(q, shape1 = a, shape2 = t, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^(-1)) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levgenpareto(limit, order = k, shape1 = a, shape2 = t, scale = s), 285s + s^k * betaint(u, t + k, a - k)/(Ga * Gt) + 285s + limit^k * pbeta(u, t, a, lower = FALSE)) 285s + }) 285s + limit <- qpareto(q, shape = a, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y) 285s + for (k in order[order > -1]) 285s + stopifnot(exprs = { 285s + All.eq(levpareto(limit, order = k, shape = a, scale = s), 285s + s^k * betaint(1 - u, 1 + k, a - k)/Ga + 285s + limit^k * u^a) 285s + }) 285s + limit <- qpareto1(q, shape = a, min = s) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levpareto1(limit, order = k, shape = a, min = s), 285s + s^k * a/(a - k) - k * s^a/((a - k) * limit^(a - k))) 285s + }) 285s + limit <- qinvburr(q, shape1 = a, shape2 = g, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^(-g)) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levinvburr(limit, order = k, shape1 = a, shape2 = g, scale = s), 285s + s^k * betaint(u, a + k/g, 1 - k/g)/Ga + 285s + limit^k * (1 - u^a)) 285s + }) 285s + limit <- qinvpareto(q, shape = a, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^(-1)) 285s + for (k in order[order < 1]) 285s + stopifnot(exprs = { 285s + All.eq(levinvpareto(limit, order = k, shape = a, scale = s), 285s + s^k * a * 285s + sapply(u, 285s + function(upper) 285s + integrate(function(x) x^(a+k-1) * (1-x)^(-k), 285s + lower = 0, upper = upper)$value) + 285s + limit^k * (1 - u^a)) 285s + }) 285s + limit <- qinvparalogis(q, shape = a, scale = s) 285s + y <- limit/s 285s + u <- 1/(1 + y^(-a)) 285s + for (k in order) 285s + stopifnot(exprs = { 285s + All.eq(levinvparalogis(limit, order = k, shape = a, scale = s), 285s + s^k * betaint(u, a + k/a, 1 - k/a)/Ga + 285s + limit^k * (1 - u^a)) 285s + }) 285s + } 285s + } 289s > 289s > ## 289s > ## TRANSFORMED GAMMA AND INVERSE TRANSFORMED GAMMA FAMILIES 289s > ## 289s > 289s > ## Density: first check that functions return 0 when scale = Inf, and 289s > ## when x = scale = Inf (transformed gamma), or when scale = 0 and 289s > ## when x = scale = 0 (inverse distributions). 289s > stopifnot(exprs = { 289s + dtrgamma (c(42, Inf), shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 289s + dinvtrgamma(c(42, 0), shape1 = 2, shape2 = 3, scale = 0) == c(0, 0) 289s + dinvgamma (c(42, 0), shape = 2, scale = 0) == c(0, 0) 289s + dinvweibull(c(42, 0), shape = 3, scale = 0) == c(0, 0) 289s + dinvexp (c(42, 0), scale = 0) == c(0, 0) 289s + }) 289s > 289s > ## Tests on the density 289s > set.seed(123) # reset the seed 289s > nshpar <- 2 # (maximum) number of shape parameters 289s > shpar <- replicate(30, rgamma(nshpar, 5), simplify = FALSE) 289s > scpar <- rlnorm(30, 2) # scale parameters 289s > for (i in seq_along(shpar)) 289s + { 289s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 289s + Ga <- gamma(a) 289s + for (s in scpar) 289s + { 289s + x <- rtrgamma(100, shape1 = a, shape2 = t, scale = s) 289s + y <- x/s 289s + u <- y^t 289s + stopifnot(exprs = { 289s + all.equal(d1 <- dtrgamma(x, shape1 = a, shape2 = t, 289s + scale = s), 289s + d2 <- dtrgamma(y, shape1 = a, shape2 = t, 289s + scale = 1)/s, 289s + tolerance = 1e-10) 289s + all.equal(d2, 289s + t/(Ga * s^(a * t)) * x^(a * t - 1) * exp(-u), 289s + tolerance = 1e-10) 289s + all.equal(d1, 289s + t/(Ga * x) * u^a * exp(-u), 289s + tolerance = 1e-10) 289s + }) 289s + x <- rinvtrgamma(100, shape1 = a, shape2 = t, scale = s) 289s + y <- x/s 289s + u <- y^(-t) 289s + stopifnot(exprs = { 289s + all.equal(d1 <- dinvtrgamma(x, shape1 = a, shape2 = t, 289s + scale = s), 289s + d2 <- dinvtrgamma(y, shape1 = a, shape2 = t, 289s + scale = 1)/s, 289s + tolerance = 1e-10) 289s + all.equal(d2, 289s + t * s^(a * t)/(Ga * x^(a * t + 1)) * exp(-u), 289s + tolerance = 1e-10) 289s + all.equal(d1, 289s + t/(Ga * x) * u^a * exp(-u), 289s + tolerance = 1e-10) 289s + }) 289s + x <- rinvgamma(100, shape = a, scale = s) 289s + y <- x/s 289s + u <- y^(-1) 289s + stopifnot(exprs = { 289s + all.equal(d1 <- dinvgamma(x, shape = a, scale = s), 289s + d2 <- dinvgamma(y, shape = a, scale = 1)/s, 289s + tolerance = 1e-10) 289s + all.equal(d2, 289s + s^a/(Ga * x^(a + 1)) * exp(-u), 289s + tolerance = 1e-10) 289s + all.equal(d1, 289s + 1/(Ga * x) * u^a * exp(-u), 289s + tolerance = 1e-10) 289s + }) 289s + x <- rinvweibull(100, shape = t, scale = s) 289s + y <- x/s 289s + u <- y^(-t) 289s + stopifnot(exprs = { 289s + all.equal(d1 <- dinvweibull(x, shape = t, scale = s), 289s + d2 <- dinvweibull(y, shape = t, scale = 1)/s, 289s + tolerance = 1e-10) 289s + all.equal(d2, 289s + t * s^t/x^(t + 1) * exp(-u), 289s + tolerance = 1e-10) 289s + all.equal(d1, 289s + t/x * u * exp(-u), 289s + tolerance = 1e-10) 289s + }) 289s + x <- rinvexp(100, scale = s) 289s + y <- x/s 289s + u <- y^(-1) 289s + stopifnot(exprs = { 289s + all.equal(d1 <- dinvexp(x, scale = s), 289s + d2 <- dinvexp(y, scale = 1)/s, 289s + tolerance = 1e-10) 289s + all.equal(d2, 289s + s/x^2 * exp(-u), 289s + tolerance = 1e-10) 289s + all.equal(d1, 289s + 1/x * u * exp(-u), 289s + tolerance = 1e-10) 289s + }) 289s + } 289s + } 290s > 290s > ## Tests on the cumulative distribution function. 290s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf) 290s > stopifnot(exprs = { 290s + ptrgamma(Inf, 2, 3, scale = xMax) == 1 290s + ptrgamma(xMax, 2, 3, scale = xMax) == pgamma(1, 2, 1) 290s + ptrgamma(xMin, 2, 1, scale = 1) == pgamma(xMin, 2, 1) 290s + all.equal(ptrgamma(1e300, shape1 = 2, shape2 = 1, scale = scLrg, log = TRUE), 290s + pgamma(c(5e299, 1e+298, 10, 1, 0.1, 0.01, 1e-7, 1e+300/xMax, 0), 290s + 2, 1, log = TRUE)) 290s + }) 290s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, 0) 290s > stopifnot(exprs = { 290s + pinvtrgamma(Inf, 2, 3, scale = xMax) == 1 290s + pinvtrgamma(xMax, 2, 3, scale = xMax) == pgamma(1, 2, 1, lower = FALSE) 290s + pinvtrgamma(xMin, 2, 1, scale = 1) == pgamma(1/xMin, 2, 1, lower = FALSE) 290s + all.equal(pinvtrgamma(1e300, shape1 = 2, shape2 = 1, scale = scLrg, log = TRUE), 290s + pgamma(c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0), 290s + 2, 1, lower = FALSE, log = TRUE)) 290s + }) 290s > stopifnot(exprs = { 290s + pinvgamma(Inf, 2, scale = xMax) == 1 290s + pinvgamma(xMax, 2, scale = xMax) == pgamma(1, 2, 1, lower = FALSE) 290s + pinvgamma(xMin, 2, scale = 1) == pgamma(1/xMin, 2, 1, lower = FALSE) 290s + all.equal(pinvgamma(1e300, shape = 2, scale = scLrg, log = TRUE), 290s + pgamma(c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0), 290s + 2, 1, lower = FALSE, log = TRUE)) 290s + }) 290s > stopifnot(exprs = { 290s + pinvweibull(Inf, 3, scale = xMax) == 1 290s + pinvweibull(xMax, 3, scale = xMax) == exp(-1) 290s + pinvweibull(xMin, 1, scale = 1) == exp(-1/xMin) 290s + all.equal(pinvweibull(1e300, shape = 1, scale = scLrg, log = TRUE), 290s + -c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0)) 290s + }) 290s > stopifnot(exprs = { 290s + pinvexp(Inf, 3, scale = xMax) == 1 290s + pinvexp(xMax, 3, scale = xMax) == exp(-1) 290s + pinvexp(xMin, 1, scale = 1) == exp(-1/xMin) 290s + all.equal(pinvexp(1e300, scale = scLrg, log = TRUE), 290s + -c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0)) 290s + }) 290s > 290s > ## Tests for first three positive moments and first two negative 290s > ## moments. (Including for the Gamma, Weibull and Exponential 290s > ## distributions of base R.) 290s > ## 290s > ## Simulation of new parameters ensuring that said moments exist. 290s > set.seed(123) # reset the seed 290s > nshpar <- 2 # (maximum) number of shape parameters 290s > shpar <- replicate(30, c(3, 3) + rlnorm(nshpar, 2), simplify = FALSE) 290s > scpar <- rlnorm(30, 2) # scale parameters 290s > k <- c(-2, -1, 1, 2, 3) # orders 290s > for (i in seq_along(shpar)) 290s + { 290s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 290s + Ga <- gamma(a) 290s + for (s in scpar) 290s + { 290s + stopifnot(exprs = { 290s + All.eq(mtrgamma(k, shape1 = a, shape2 = t, scale = s), 290s + s^k * gamma(a + k/t)/Ga) 290s + All.eq(mgamma(k, shape = a, scale = s), 290s + s^k * gamma(a + k)/Ga) 290s + All.eq(mweibull(k, shape = t, scale = s), 290s + s^k * gamma(1 + k/t)) 290s + All.eq(mexp(k[k > -1], rate = 1/s), 290s + s^k[k > -1] * gamma(1 + k[k > -1])) 290s + All.eq(minvtrgamma(k, shape1 = a, shape2 = t, scale = s), 290s + s^k * gamma(a - k/t)/Ga) 290s + All.eq(minvgamma(k, shape = a, scale = s), 290s + s^k * gamma(a - k)/Ga) 290s + All.eq(minvweibull(k, shape = t, scale = s), 290s + s^k * gamma(1 - k/t)) 290s + All.eq(minvexp(k[k < 1], scale = s), 290s + s^k[k < 1] * gamma(1 - k[k < 1])) 290s + }) 290s + } 290s + } 291s > 291s > ## Tests for first three positive limited moments and first two 291s > ## negative limited moments. (Including for the Gamma, Weibull and 291s > ## Exponential distributions of base R.) 291s > ## 291s > ## Limits are taken from quantiles of each distribution. 291s > order <- c(-2, -1, 1, 2, 3) # orders 291s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 291s > for (i in seq_along(shpar)) 291s + { 291s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 291s + Ga <- gamma(a) 291s + for (s in scpar) 291s + { 291s + limit <- qtrgamma(q, shape1 = a, shape2 = t, scale = s) 291s + y <- limit/s 291s + u <- y^t 291s + for (k in order) 291s + stopifnot(exprs = { 291s + All.eq(levtrgamma(limit, order = k, shape1 = a, shape2 = t, scale = s), 291s + s^k * gamma(a + k/t)/Ga * pgamma(u, a + k/t, scale = 1) + 291s + limit^k * pgamma(u, a, scale = 1, lower = FALSE)) 291s + }) 291s + limit <- qgamma(q, shape = a, scale = s) 291s + y <- limit/s 291s + for (k in order) 291s + stopifnot(exprs = { 291s + All.eq(levgamma(limit, order = k, shape = a, scale = s), 291s + s^k * gamma(a + k)/Ga * pgamma(y, a + k, scale = 1) + 291s + limit^k * pgamma(y, a, scale = 1, lower = FALSE)) 291s + }) 291s + limit <- qweibull(q, shape = t, scale = s) 291s + y <- limit/s 291s + u <- y^t 291s + for (k in order) 291s + stopifnot(exprs = { 291s + All.eq(levweibull(limit, order = k, shape = t, scale = s), 291s + s^k * gamma(1 + k/t) * pgamma(u, 1 + k/t, scale = 1) + 291s + limit^k * pgamma(u, 1, scale = 1, lower = FALSE)) 291s + }) 291s + limit <- qexp(q, rate = 1/s) 291s + y <- limit/s 291s + for (k in order[order > -1]) 291s + stopifnot(exprs = { 291s + All.eq(levexp(limit, order = k, rate = 1/s), 291s + s^k * gamma(1 + k) * pgamma(y, 1 + k, scale = 1) + 291s + limit^k * pgamma(y, 1, scale = 1, lower = FALSE)) 291s + }) 291s + limit <- qinvtrgamma(q, shape1 = a, shape2 = t, scale = s) 291s + y <- limit/s 291s + u <- y^(-t) 291s + for (k in order) 291s + stopifnot(exprs = { 291s + All.eq(levinvtrgamma(limit, order = k, shape1 = a, shape2 = t, scale = s), 291s + s^k * (gammainc(a - k/t, u)/Ga) + 291s + limit^k * pgamma(u, a, scale = 1)) 291s + }) 291s + limit <- qinvgamma(q, shape = a, scale = s) 291s + y <- limit/s 291s + u <- y^(-1) 291s + for (k in order) 291s + stopifnot(exprs = { 291s + All.eq(levinvgamma(limit, order = k, shape = a, scale = s), 291s + s^k * (gammainc(a - k, u)/Ga) + 291s + limit^k * pgamma(u, a, scale = 1)) 291s + }) 291s + limit <- qinvweibull(q, shape = t, scale = s) 291s + y <- limit/s 291s + u <- y^(-t) 291s + for (k in order) 291s + stopifnot(exprs = { 291s + All.eq(levinvweibull(limit, order = k, shape = t, scale = s), 291s + s^k * gammainc(1 - k/t, u) + 291s + limit^k * (-expm1(-u))) 291s + }) 291s + limit <- qinvexp(q, scale = s) 291s + y <- limit/s 291s + u <- y^(-1) 291s + for (k in order) 291s + stopifnot(exprs = { 291s + All.eq(levinvexp(limit, order = k, scale = s), 291s + s^k * gammainc(1 - k, u) + 291s + limit^k * (-expm1(-u))) 291s + }) 291s + } 291s + } 294s > 294s > ## 294s > ## OTHER DISTRIBUTIONS 294s > ## 294s > 294s > ## Distributions in this category are quite different, so let's treat 294s > ## them separately. 294s > 294s > ## LOGGAMMA 294s > 294s > ## Tests on the density. 294s > stopifnot(exprs = { 294s + dlgamma(c(42, Inf), shapelog = 2, ratelog = 0) == c(0, 0) 294s + }) 294s > assertWarning(stopifnot(exprs = { 294s + is.nan(dlgamma(c(0, 42, Inf), shapelog = 2, ratelog = Inf)) 294s + })) 294s > x <- rlgamma(100, shapelog = 2, ratelog = 1) 294s > for(a in round(rlnorm(30), 2)) 294s + { 294s + Ga <- gamma(a) 294s + for(r in round(rlnorm(30), 2)) 294s + stopifnot(exprs = { 294s + All.eq(dlgamma(x, shapelog = a, ratelog = r), 294s + r^a * (log(x))^(a - 1)/(Ga * x^(r + 1))) 294s + }) 294s + } 294s > 294s > ## Tests on the cumulative distribution function. 294s > assertWarning(stopifnot(exprs = { 294s + is.nan(plgamma(Inf, 1, ratelog = Inf)) 294s + is.nan(plgamma(Inf, Inf, ratelog = Inf)) 294s + })) 294s > scLrg <- log(c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf)) 294s > stopifnot(exprs = { 294s + plgamma(Inf, 2, ratelog = xMax) == 1 294s + plgamma(xMax, 2, ratelog = 0) == 0 294s + all.equal(plgamma(1e300, 2, ratelog = 1/scLrg, log = TRUE), 294s + pgamma(log(1e300), 2, scale = scLrg, log = TRUE)) 294s + }) 294s > 294s > ## Tests for first three positive moments and first two negative 294s > ## moments. 294s > k <- c(-2, -1, 1, 2, 3) # orders 294s > for(a in round(rlnorm(30), 2)) 294s + { 294s + Ga <- gamma(a) 294s + for(r in 3 + round(rlnorm(30), 2)) 294s + stopifnot(exprs = { 294s + All.eq(mlgamma(k, shapelog = a, ratelog = r), 294s + (1 - k/r)^(-a)) 294s + }) 294s + } 294s > 294s > ## Tests for first three positive limited moments and first two 294s > ## negative limited moments. 294s > order <- c(-2, -1, 1, 2, 3) # orders 294s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 294s > for(a in round(rlnorm(30), 2)) 294s + { 294s + Ga <- gamma(a) 294s + for(r in 3 + round(rlnorm(30), 2)) 294s + { 294s + limit <- qlgamma(q, shapelog = a, ratelog = r) 294s + for (k in order) 294s + { 294s + u <- log(limit) 294s + stopifnot(exprs = { 294s + All.eq(levlgamma(limit, order = k, shapelog = a, ratelog = r), 294s + (1 - k/r)^(-a) * pgamma((r - k) * u, a, scale = 1) + 294s + limit^k * pgamma(r * u, a, scale = 1,lower = FALSE)) 294s + }) 294s + } 294s + } 294s + } 294s > 294s > ## GUMBEL 294s > 294s > ## Tests on the density. 294s > stopifnot(exprs = { 294s + dgumbel(c(1, 3, Inf), alpha = 2, scale = Inf) == c(0, 0, 0) 294s + dgumbel(c(1, 2, 3), alpha = 2, scale = 0) == c(0, Inf, 0) 294s + dgumbel(c(-Inf, Inf), alpha = 1, scale = 1) == c(0, 0) 294s + dgumbel(1, alpha = Inf, scale = 1) == 0 294s + }) 294s > assertWarning(stopifnot(exprs = { 294s + is.nan(dgumbel(Inf, alpha = Inf, scale = 1)) 294s + is.nan(dgumbel(-Inf, alpha = -Inf, scale = 1)) 294s + is.nan(dgumbel(Inf, alpha = 1, scale = -1)) 294s + is.nan(dgumbel(1, alpha = 1, scale = -1)) 294s + is.nan(dgumbel(1, alpha = Inf, scale = -1)) 294s + })) 294s > x <- rgumbel(100, alpha = 2, scale = 5) 294s > for(a in round(rlnorm(30), 2)) 294s + { 294s + Ga <- gamma(a) 294s + for(s in round(rlnorm(30), 2)) 294s + { 294s + u <- (x - a)/s 294s + stopifnot(exprs = { 294s + All.eq(dgumbel(x, alpha = a, scale = s), 294s + exp(-(u + exp(-u)))/s) 294s + }) 294s + } 294s + } 294s > 294s > ## Tests on the cumulative distribution function. 294s > assertWarning(stopifnot(exprs = { 294s + is.nan(pgumbel(Inf, alpha = Inf, scale = 1)) 294s + is.nan(pgumbel(-Inf, alpha = -Inf, scale = 1)) 294s + is.nan(pgumbel(Inf, alpha = 1, scale = -1)) 294s + is.nan(pgumbel(1, alpha = 1, scale = -1)) 294s + is.nan(pgumbel(1, alpha = Inf, scale = -1)) 294s + })) 294s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf) 294s > stopifnot(exprs = { 294s + pgumbel(c(-Inf, Inf), 2, scale = xMax) == c(0, 1) 294s + pgumbel(c(xMin, xMax), 2, scale = 0) == c(0, 1) 294s + all.equal(pgumbel(1e300, 0, scale = scLrg, log = TRUE), 294s + -exp(-c(5e299, 1e+298, 10, 1, 0.1, 0.01, 1e-7, 1e+300/xMax, 0))) 294s + }) 294s > 294s > ## Test the first two moments, the only ones implemented. 294s > assertWarning(stopifnot(exprs = { 294s + is.nan(mgumbel(c(-2, -1, 3, 4), alpha = 2, scale = 5)) 294s + })) 294s > stopifnot(exprs = { 294s + All.eq(mgumbel(1, alpha = 2, scale = 5), 294s + 2 + 5 * 0.577215664901532860606512090082) 294s + All.eq(mgumbel(2, alpha = 2, scale = 5), 294s + pi^2 * 25/6 + (2 + 5 * 0.577215664901532860606512090082)^2) 294s + }) 294s > 294s > ## INVERSE GAUSSIAN 294s > 294s > ## Tests on the density. 294s > stopifnot(exprs = { 294s + dinvgauss(c(1, 3, Inf), mean = 2, dispersion = Inf) == c(0, 0, 0) 294s + dinvgauss(c(0, 42, Inf), mean = 2, dispersion = 0) == c(Inf, 0, 0) 294s + dinvgauss(c(0, Inf), mean = 1, dispersion = 1) == c(0, 0) 294s + dinvgauss(1, mean = Inf, dispersion = 2) == dinvgamma(1, 0.5, scale = 0.25) 294s + }) 294s > assertWarning(stopifnot(exprs = { 294s + is.nan(dinvgauss(-Inf, mean = -1, dispersion = 1)) 294s + is.nan(dinvgauss(Inf, mean = 1, dispersion = -1)) 294s + is.nan(dinvgauss(1, mean = 1, dispersion = -1)) 294s + is.nan(dinvgauss(1, mean = Inf, dispersion = -1)) 294s + })) 294s > x <- rinvgauss(100, mean = 2, dispersion = 5) 294s > for(mu in round(rlnorm(30), 2)) 294s + { 294s + for(phi in round(rlnorm(30), 2)) 294s + stopifnot(exprs = { 294s + All.eq(dinvgauss(x, mean = mu, dispersion = phi), 294s + 1/sqrt(2*pi*phi*x^3) * exp(-((x/mu - 1)^2)/(2*phi*x))) 294s + }) 294s + } 294s > 294s > ## Tests on the cumulative distribution function. 294s > assertWarning(stopifnot(exprs = { 294s + is.nan(pinvgauss(-Inf, mean = -Inf, dispersion = 1)) 294s + is.nan(pinvgauss(Inf, mean = 1, dispersion = -1)) 294s + is.nan(pinvgauss(1, mean = Inf, dispersion = -1)) 294s + })) 294s > x <- c(1:50, 10^c(3:10, 20, 50, 150, 250)) 294s > sqx <- sqrt(x) 294s > stopifnot(exprs = { 294s + pinvgauss(c(0, Inf), mean = 2, dispersion = xMax) == c(0, 1) 294s + pinvgauss(c(0, xMax), mean = xMax, dispersion = 0) == c(0, 1) 294s + all.equal(pinvgauss(x, 1, dispersion = 1, log = TRUE), 294s + log(pnorm(sqx - 1/sqx) + exp(2) * pnorm(-sqx - 1/sqx))) 294s + }) 294s > 294s > ## Tests for small value of 'shape'. Added for the patch in 4294e9c. 294s > q <- runif(100) 294s > stopifnot(exprs = { 294s + all.equal(q, 294s + pinvgauss(qinvgauss(q, 0.1, 1e-2), 0.1, 1e-2)) 294s + all.equal(q, 294s + pinvgauss(qinvgauss(q, 0.1, 1e-6), 0.1, 1e-6)) 294s + }) 294s > 294s > ## Tests for first three positive, integer moments. 294s > k <- 1:3 294s > for(mu in round(rlnorm(30), 2)) 294s + { 294s + for(phi in round(rlnorm(30), 2)) 294s + stopifnot(exprs = { 294s + All.eq(minvgauss(k, mean = mu, dispersion = phi), 294s + c(mu, 294s + mu^2 * (1 + phi * mu), 294s + mu^3 * (1 + 3 * phi * mu + 3 * (phi * mu)^2))) 294s + }) 294s + } 294s > 294s > ## Tests for limited expected value. 294s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 294s > for(mu in round(rlnorm(30), 2)) 294s + { 294s + for(phi in round(rlnorm(30), 2)) 294s + { 294s + limit <- qinvgauss(q, mean = mu, dispersion = phi) 294s + stopifnot(exprs = { 294s + All.eq(levinvgauss(limit, mean = mu, dispersion = phi), 294s + mu * (pnorm((limit/mu - 1)/sqrt(phi * limit)) - 294s + exp(2/phi/mu) * pnorm(-(limit/mu + 1)/sqrt(phi * limit))) + 294s + limit * pinvgauss(limit, mean = mu, dispersion = phi, lower = FALSE)) 294s + }) 294s + } 294s + } 295s > 295s > ## GENERALIZED BETA 295s > stopifnot(exprs = { 295s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 0, shape3 = 3, scale = 5) == c(Inf, 0, Inf) 295s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 0, shape3 = 0, scale = 5) == c(Inf, 0, Inf) 295s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 2, shape3 = 0, scale = 5) == c(Inf, 0, 0) 295s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = Inf, shape3 = 3, scale = 5) == c(Inf, 0, 0) 295s + dgenbeta(c(0, 2.5, 5), shape1 = 1, shape2 = Inf, shape3 = 3, scale = 5) == c(Inf, 0, 0) 295s + dgenbeta(c(0, 2.5, 5), shape1 = Inf, shape2 = Inf, shape3 = 3, scale = 5) == c(0, Inf, 0) 295s + dgenbeta(c(0, 2.5, 5), shape1 = Inf, shape2 = Inf, shape3 = Inf, scale = 5) == c(0, 0, Inf) 295s + }) 295s > nshpar <- 3 # number of shape parameters 295s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 295s > scpar <- rlnorm(30, 2) # scale parameters 295s > for (i in seq_along(shpar)) 295s + { 295s + a <- shpar[[c(i, 1)]]; b <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 295s + Be <- beta(a, b) 295s + for (s in scpar) 295s + { 295s + u <- rbeta(100, a, b) 295s + y <- u^(1/t) 295s + x <- s * y 295s + stopifnot(exprs = { 295s + all.equal(d1 <- dgenbeta(x, shape1 = a, shape2 = b, shape3 = t, 295s + scale = s), 295s + d2 <- dgenbeta(y, shape1 = a, shape2 = b, shape3 = t, 295s + scale = 1)/s, 295s + tolerance = 1e-10) 295s + all.equal(d1, 295s + t * y^(a*t - 1) * (1 - y^t)^(b - 1)/(s * Be), 295s + tolerance = 1e-10) 295s + all.equal(d1, 295s + t * u^a * (1 - u)^(b - 1)/(x * Be), 295s + tolerance = 1e-10) 295s + }) 295s + } 295s + } 295s > 295s > ## Tests on the cumulative distribution function. 295s > scLrg <- 1e300 * c(0.5, 1, 2, 4) 295s > stopifnot(exprs = { 295s + all.equal(pgenbeta(1e300, 295s + shape1 = 3, shape2 = 1, 295s + shape3 = rep(c(1, 2), each = length(scLrg)), 295s + scale = scLrg, log = TRUE), 295s + c(0, pbeta(c(1, 1/2, 1/4), 3, 1, log = TRUE), 295s + 0, pbeta(c(1, 1/4, 1/16), 3, 1, log = TRUE))) 295s + }) 295s > 295s > ## Tests for first three positive moments and first two negative 295s > ## moments. 295s > ## 295s > ## Simulation of new parameters ensuring that said moments exist. 295s > set.seed(123) # reset the seed 295s > nshpar <- 3 # number of shape parameters 295s > shpar <- replicate(30, sqrt(c(3, 0, 3)) + rlnorm(nshpar, 2), simplify = FALSE) 295s > scpar <- rlnorm(30, 2) # scale parameters 295s > k <- c(-2, -1, 1, 2, 3) # orders 295s > for (i in seq_along(shpar)) 295s + { 295s + a <- shpar[[c(i, 1)]]; b <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 295s + Be <- beta(a, b) 295s + for (s in scpar) 295s + stopifnot(exprs = { 295s + All.eq(mgenbeta(k, shape1 = a, shape2 = b, shape3 = t, scale = s), 295s + s^k * beta(a + k/t, b)/Be) 295s + }) 295s + } 295s > 295s > ## Tests for first three positive limited moments and first two 295s > ## negative limited moments. 295s > ## 295s > ## Simulation of new parameters ensuring that said moments exist. 295s > order <- c(-2, -1, 1, 2, 3) # orders 295s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 295s > for (i in seq_along(shpar)) 295s + { 295s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 295s + Be <- beta(a, b) 295s + for (s in scpar) 295s + { 295s + limit <- qgenbeta(q, shape1 = a, shape2 = b, shape3 = t, scale = s) 295s + u <- (limit/s)^t 295s + for (k in order) 295s + stopifnot(exprs = { 295s + All.eq(levgenbeta(limit, order = k, shape1 = a, shape2 = b, shape3 = t, scale = s), 295s + s^k * beta(a + k/t, b)/Be * pbeta(u, a + k/t, b) + 295s + limit^k * pbeta(u, a, b, lower = FALSE)) 295s + }) 295s + } 295s + } 295s > 295s > ## 295s > ## RANDOM NUMBERS (all continuous distributions) 295s > ## 295s > set.seed(123) 295s > n <- 20 295s > m <- rnorm(1) 295s > 295s > ## Generate variates 295s > Rfpareto <- rfpareto(n, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > Rpareto4 <- rpareto4(n, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 295s > Rpareto3 <- rpareto3(n, min = m, shape = 1.5, scale = 2) 295s > Rpareto2 <- rpareto2(n, min = m, shape = 0.8, scale = 2) 295s > Rtrbeta <- rtrbeta (n, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > Rburr <- rburr (n, shape1 = 0.8, shape2 = 1.5, scale = 2) 295s > Rllogis <- rllogis (n, shape = 1.5, scale = 2) 295s > Rparalogis <- rparalogis (n, shape = 0.8, scale = 2) 295s > Rgenpareto <- rgenpareto (n, shape1 = 0.8, shape2 = 2, scale = 2) 295s > Rpareto <- rpareto (n, shape = 0.8, scale = 2) 295s > Rpareto1 <- rpareto1 (n, shape = 0.8, min = 2) 295s > Rinvburr <- rinvburr (n, shape1 = 1.5, shape2 = 2, scale = 2) 295s > Rinvpareto <- rinvpareto (n, shape = 2, scale = 2) 295s > Rinvparalogis <- rinvparalogis(n, shape = 2, scale = 2) 295s > Rtrgamma <- rtrgamma (n, shape1 = 2, shape2 = 3, scale = 5) 295s > Rinvtrgamma <- rinvtrgamma (n, shape1 = 2, shape2 = 3, scale = 5) 295s > Rinvgamma <- rinvgamma (n, shape = 2, scale = 5) 295s > Rinvweibull <- rinvweibull (n, shape = 3, scale = 5) 295s > Rinvexp <- rinvexp (n, scale = 5) 295s > Rlgamma <- rlgamma(n, shapelog = 1.5, ratelog = 5) 295s > Rgumbel <- rgumbel(n, alpha = 2, scale = 5) 295s > Rinvgauss <- rinvgauss(n, mean = 2, dispersion = 5) 295s > Rgenbeta <- rgenbeta(n, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > 295s > ## Compute quantiles 295s > Pfpareto <- pfpareto(Rfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > Ppareto4 <- ppareto4(Rpareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 295s > Ppareto3 <- ppareto3(Rpareto3, min = m, shape = 1.5, scale = 2) 295s > Ppareto2 <- ppareto2(Rpareto2, min = m, shape = 0.8, scale = 2) 295s > Ptrbeta <- ptrbeta (Rtrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > Pburr <- pburr (Rburr, shape1 = 0.8, shape2 = 1.5, scale = 2) 295s > Pllogis <- pllogis (Rllogis, shape = 1.5, scale = 2) 295s > Pparalogis <- pparalogis (Rparalogis, shape = 0.8, scale = 2) 295s > Pgenpareto <- pgenpareto (Rgenpareto, shape1 = 0.8, shape2 = 2, scale = 2) 295s > Ppareto <- ppareto (Rpareto, shape = 0.8, scale = 2) 295s > Ppareto1 <- ppareto1 (Rpareto1, shape = 0.8, min = 2) 295s > Pinvburr <- pinvburr (Rinvburr, shape1 = 1.5, shape2 = 2, scale = 2) 295s > Pinvpareto <- pinvpareto (Rinvpareto, shape = 2, scale = 2) 295s > Pinvparalogis <- pinvparalogis(Rinvparalogis, shape = 2, scale = 2) 295s > Ptrgamma <- ptrgamma (Rtrgamma, shape1 = 2, shape2 = 3, scale = 5) 295s > Pinvtrgamma <- pinvtrgamma (Rinvtrgamma, shape1 = 2, shape2 = 3, scale = 5) 295s > Pinvgamma <- pinvgamma (Rinvgamma, shape = 2, scale = 5) 295s > Pinvweibull <- pinvweibull (Rinvweibull, shape = 3, scale = 5) 295s > Pinvexp <- pinvexp (Rinvexp, scale = 5) 295s > Plgamma <- plgamma(Rlgamma, shapelog = 1.5, ratelog = 5) 295s > Pgumbel <- pgumbel(Rgumbel, alpha = 2, scale = 5) 295s > Pinvgauss <- pinvgauss(Rinvgauss, mean = 2, dispersion = 5) 295s > Pgenbeta <- pgenbeta(Rgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > 295s > ## Just compute pdf 295s > Dfpareto <- dfpareto(Rfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > Dpareto4 <- dpareto4(Rpareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 295s > Dpareto3 <- dpareto3(Rpareto3, min = m, shape = 1.5, scale = 2) 295s > Dpareto2 <- dpareto2(Rpareto2, min = m, shape = 0.8, scale = 2) 295s > Dtrbeta <- dtrbeta (Rtrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > Dburr <- dburr (Rburr, shape1 = 0.8, shape2 = 1.5, scale = 2) 295s > Dllogis <- dllogis (Rllogis, shape = 1.5, scale = 2) 295s > Dparalogis <- dparalogis (Rparalogis, shape = 0.8, scale = 2) 295s > Dgenpareto <- dgenpareto (Rgenpareto, shape1 = 0.8, shape2 = 2, scale = 2) 295s > Dpareto <- dpareto (Rpareto, shape = 0.8, scale = 2) 295s > Dpareto1 <- dpareto1 (Rpareto1, shape = 0.8, min = 2) 295s > Dinvburr <- dinvburr (Rinvburr, shape1 = 1.5, shape2 = 2, scale = 2) 295s > Dinvpareto <- dinvpareto (Rinvpareto, shape = 2, scale = 2) 295s > Dinvparalogis <- dinvparalogis(Rinvparalogis, shape = 2, scale = 2) 295s > Dtrgamma <- dtrgamma (Rtrgamma, shape1 = 2, shape2 = 3, scale = 5) 295s > Dinvtrgamma <- dinvtrgamma (Rinvtrgamma, shape1 = 2, shape2 = 3, scale = 5) 295s > Dinvgamma <- dinvgamma (Rinvtrgamma, shape = 2, scale = 5) 295s > Dinvweibull <- dinvweibull (Rinvweibull, shape = 3, scale = 5) 295s > Dinvexp <- dinvexp (Rinvexp, scale = 5) 295s > Dlgamma <- dlgamma(Rlgamma, shapelog = 1.5, ratelog = 5) 295s > Dgumbel <- dgumbel(Rgumbel, alpha = 2, scale = 5) 295s > Dinvgauss <- dinvgauss(Rinvgauss, mean = 2, dispersion = 5) 295s > Dgenbeta <- dgenbeta(Rgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 295s > 295s > ## Check q(p(.)) identity 295s > stopifnot(exprs = { 295s + All.eq(Rfpareto, qfpareto(Pfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 295s + All.eq(Rpareto4, qpareto4(Ppareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2)) 295s + All.eq(Rpareto3, qpareto3(Ppareto3, min = m, shape = 1.5, scale = 2)) 295s + All.eq(Rpareto2, qpareto2(Ppareto2, min = m, shape = 0.8, scale = 2)) 295s + All.eq(Rtrbeta, qtrbeta (Ptrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 295s + All.eq(Rburr, qburr (Pburr, shape1 = 0.8, shape2 = 1.5, scale = 2)) 295s + All.eq(Rllogis, qllogis (Pllogis, shape = 1.5, scale = 2)) 295s + All.eq(Rparalogis, qparalogis (Pparalogis, shape = 0.8, scale = 2)) 295s + All.eq(Rgenpareto, qgenpareto (Pgenpareto, shape1 = 0.8, shape2 = 2, scale = 2)) 295s + All.eq(Rpareto, qpareto (Ppareto, shape = 0.8, scale = 2)) 295s + All.eq(Rpareto1, qpareto1 (Ppareto1, shape = 0.8, min = 2)) 295s + All.eq(Rinvburr, qinvburr (Pinvburr, shape1 = 1.5, shape2 = 2, scale = 2)) 295s + All.eq(Rinvpareto, qinvpareto (Pinvpareto, shape = 2, scale = 2)) 295s + All.eq(Rinvparalogis, qinvparalogis(Pinvparalogis, shape = 2, scale = 2)) 295s + All.eq(Rtrgamma, qtrgamma (Ptrgamma, shape1 = 2, shape2 = 3, scale = 5)) 295s + All.eq(Rinvtrgamma, qinvtrgamma (Pinvtrgamma, shape1 = 2, shape2 = 3, scale = 5)) 295s + All.eq(Rinvgamma, qinvgamma (Pinvgamma, shape = 2, scale = 5)) 295s + All.eq(Rinvweibull, qinvweibull (Pinvweibull, shape = 3, scale = 5)) 295s + All.eq(Rinvexp, qinvexp (Pinvexp, scale = 5)) 295s + All.eq(Rlgamma, qlgamma(Plgamma, shapelog = 1.5, ratelog = 5)) 295s + All.eq(Rgumbel, qgumbel(Pgumbel, alpha = 2, scale = 5)) 295s + All.eq(Rinvgauss, qinvgauss(Pinvgauss, mean = 2, dispersion = 5)) 295s + All.eq(Rgenbeta, qgenbeta(Pgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 295s + }) 295s > 295s > ## Check q(p(.)) identity for special cases 295s > stopifnot(exprs = { 295s + All.eq(Rfpareto - m, qtrbeta(Pfpareto, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 295s + All.eq(Rpareto4 - m, qburr (Ppareto4, shape1 = 0.8, shape2 = 1.5, scale = 2)) 295s + All.eq(Rpareto3 - m, qllogis(Ppareto3, shape = 1.5, scale = 2)) 295s + All.eq(Rpareto2 - m, qpareto(Ppareto2, shape = 0.8, scale = 2)) 295s + }) 295s > 295s > ## Check q(p(.)) identity with upper tail 295s > stopifnot(exprs = { 295s + All.eq(Rfpareto, qfpareto(1 - Pfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 295s + All.eq(Rpareto4, qpareto4(1 - Ppareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE)) 295s + All.eq(Rpareto3, qpareto3(1 - Ppareto3, min = m, shape = 1.5, scale = 2, lower = FALSE)) 295s + All.eq(Rpareto2, qpareto2(1 - Ppareto2, min = m, shape = 0.8, scale = 2, lower = FALSE)) 295s + All.eq(Rtrbeta, qtrbeta (1 - Ptrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 295s + All.eq(Rburr, qburr (1 - Pburr, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE)) 295s + All.eq(Rllogis, qllogis (1 - Pllogis, shape = 1.5, scale = 2, lower = FALSE)) 295s + All.eq(Rparalogis, qparalogis (1 - Pparalogis, shape = 0.8, scale = 2, lower = FALSE)) 295s + All.eq(Rgenpareto, qgenpareto (1 - Pgenpareto, shape1 = 0.8, shape2 = 2, scale = 2, lower = FALSE)) 295s + All.eq(Rpareto, qpareto (1 - Ppareto, shape = 0.8, scale = 2, lower = FALSE)) 295s + All.eq(Rpareto1, qpareto1 (1 - Ppareto1, shape = 0.8, min = 2, lower = FALSE)) 295s + All.eq(Rinvburr, qinvburr (1 - Pinvburr, shape1 = 1.5, shape2 = 2, scale = 2, lower = FALSE)) 295s + All.eq(Rinvpareto, qinvpareto (1 - Pinvpareto, shape = 2, scale = 2, lower = FALSE)) 295s + All.eq(Rinvparalogis, qinvparalogis(1 - Pinvparalogis, shape = 2, scale = 2, lower = FALSE)) 295s + All.eq(Rtrgamma, qtrgamma (1 - Ptrgamma, shape1 = 2, shape2 = 3, scale = 5, lower = FALSE)) 295s + All.eq(Rinvtrgamma, qinvtrgamma (1 - Pinvtrgamma, shape1 = 2, shape2 = 3, scale = 5, lower = FALSE)) 295s + All.eq(Rinvgamma, qinvgamma (1 - Pinvgamma, shape = 2, scale = 5, lower = FALSE)) 295s + All.eq(Rinvweibull, qinvweibull (1 - Pinvweibull, shape = 3, scale = 5, lower = FALSE)) 295s + All.eq(Rinvexp, qinvexp (1 - Pinvexp, scale = 5, lower = FALSE)) 295s + All.eq(Rlgamma, qlgamma(1 - Plgamma, shapelog = 1.5, ratelog = 5, lower = FALSE)) 295s + All.eq(Rgumbel, qgumbel(1 - Pgumbel, alpha = 2, scale = 5, lower = FALSE)) 295s + All.eq(Rinvgauss, qinvgauss(1 - Pinvgauss, mean = 2, dispersion = 5, lower = FALSE)) 295s + All.eq(Rgenbeta, qgenbeta(1 - Pgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 295s + }) 295s > 295s > ## Check q(p(., log), log) identity 295s > stopifnot(exprs = { 295s + All.eq(Rfpareto, qfpareto(log(Pfpareto), min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 295s + All.eq(Rpareto4, qpareto4(log(Ppareto4), min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, log = TRUE)) 295s + All.eq(Rpareto3, qpareto3(log(Ppareto3), min = m, shape = 1.5, scale = 2, log = TRUE)) 295s + All.eq(Rpareto2, qpareto2(log(Ppareto2), min = m, shape = 0.8, scale = 2, log = TRUE)) 295s + All.eq(Rtrbeta, qtrbeta (log(Ptrbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 295s + All.eq(Rburr, qburr (log(Pburr), shape1 = 0.8, shape2 = 1.5, scale = 2, log = TRUE)) 295s + All.eq(Rllogis, qllogis (log(Pllogis), shape = 1.5, scale = 2, log = TRUE)) 295s + All.eq(Rparalogis, qparalogis (log(Pparalogis), shape = 0.8, scale = 2, log = TRUE)) 295s + All.eq(Rgenpareto, qgenpareto (log(Pgenpareto), shape1 = 0.8, shape2 = 2, scale = 2, log = TRUE)) 295s + All.eq(Rpareto, qpareto (log(Ppareto), shape = 0.8, scale = 2, log = TRUE)) 295s + All.eq(Rpareto1, qpareto1 (log(Ppareto1), shape = 0.8, min = 2, log = TRUE)) 295s + All.eq(Rinvburr, qinvburr (log(Pinvburr), shape1 = 1.5, shape2 = 2, scale = 2, log = TRUE)) 295s + All.eq(Rinvpareto, qinvpareto (log(Pinvpareto), shape = 2, scale = 2, log = TRUE)) 295s + All.eq(Rinvparalogis, qinvparalogis(log(Pinvparalogis), shape = 2, scale = 2, log = TRUE)) 295s + All.eq(Rtrgamma, qtrgamma (log(Ptrgamma), shape1 = 2, shape2 = 3, scale = 5, log = TRUE)) 295s + All.eq(Rinvtrgamma, qinvtrgamma (log(Pinvtrgamma), shape1 = 2, shape2 = 3, scale = 5, log = TRUE)) 295s + All.eq(Rinvgamma, qinvgamma (log(Pinvgamma), shape = 2, scale = 5, log = TRUE)) 295s + All.eq(Rinvweibull, qinvweibull (log(Pinvweibull), shape = 3, scale = 5, log = TRUE)) 295s + All.eq(Rinvexp, qinvexp (log(Pinvexp), scale = 5, log = TRUE)) 295s + All.eq(Rlgamma, qlgamma(log(Plgamma), shapelog = 1.5, ratelog = 5, log = TRUE)) 295s + All.eq(Rgumbel, qgumbel(log(Pgumbel), alpha = 2, scale = 5, log = TRUE)) 295s + All.eq(Rinvgauss, qinvgauss(log(Pinvgauss), mean = 2, dispersion = 5, log = TRUE)) 295s + All.eq(Rgenbeta, qgenbeta(log(Pgenbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 295s + }) 295s > 295s > ## Check q(p(., log), log) identity with upper tail 295s > stopifnot(exprs = { 295s + All.eq(Rfpareto, qfpareto(log1p(-Pfpareto), min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rpareto4, qpareto4(log1p(-Ppareto4), min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rpareto3, qpareto3(log1p(-Ppareto3), min = m, shape = 1.5, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rpareto2, qpareto2(log1p(-Ppareto2), min = m, shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rtrbeta, qtrbeta (log1p(-Ptrbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rburr, qburr (log1p(-Pburr), shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rllogis, qllogis (log1p(-Pllogis), shape = 1.5, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rparalogis, qparalogis (log1p(-Pparalogis), shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rgenpareto, qgenpareto (log1p(-Pgenpareto), shape1 = 0.8, shape2 = 2, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rpareto, qpareto (log1p(-Ppareto), shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rpareto1, qpareto1 (log1p(-Ppareto1), shape = 0.8, min = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvburr, qinvburr (log1p(-Pinvburr), shape1 = 1.5, shape2 = 2, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvpareto, qinvpareto (log1p(-Pinvpareto), shape = 2, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvparalogis, qinvparalogis(log1p(-Pinvparalogis), shape = 2, scale = 2, lower = FALSE, log = TRUE)) 295s + All.eq(Rtrgamma, qtrgamma (log1p(-Ptrgamma), shape1 = 2, shape2 = 3, scale = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvtrgamma, qinvtrgamma (log1p(-Pinvtrgamma), shape1 = 2, shape2 = 3, scale = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvgamma, qinvgamma (log1p(-Pinvgamma), shape = 2, scale = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvweibull, qinvweibull (log1p(-Pinvweibull), shape = 3, scale = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvexp, qinvexp (log1p(-Pinvexp), scale = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rlgamma, qlgamma(log1p(-Plgamma), shapelog = 1.5, ratelog = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rgumbel, qgumbel(log1p(-Pgumbel), alpha = 2, scale = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rinvgauss, qinvgauss(log1p(-Pinvgauss), mean = 2, dispersion = 5, lower = FALSE, log = TRUE)) 295s + All.eq(Rgenbeta, qgenbeta(log1p(-Pgenbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 295s + }) 295s > 295s > 295s > ### 295s > ### DISCRETE DISTRIBUTIONS 295s > ### 295s > 295s > ## Reset seed 295s > set.seed(123) 295s > 295s > ## Define a small function to compute probabilities for the (a, b, 1) 295s > ## family of discrete distributions using the recursive relation 295s > ## 295s > ## p[k] = (a + b/k)p[k - 1], k = 2, 3, ... 295s > ## 295s > ## for a, b and p[1] given. 295s > dab1 <- function(x, a, b, p1) 295s + { 295s + x <- floor(x) 295s + if (x < 1) 295s + stop("recursive computations possible for x >= 2 only") 295s + for (k in seq(2, length.out = x - 1)) 295s + { 295s + p2 <- (a + b/k) * p1 295s + p1 <- p2 295s + } 295s + p1 295s + } 295s > 295s > ## ZERO-TRUNCATED (a, b, 1) CLASS 295s > 295s > ## Tests on the probability mass function: 295s > ## 295s > ## 1. probability is 0 at x = 0; 295s > ## 2. pmf satisfies the recursive relation 295s > lambda <- rlnorm(30, 2) # Poisson parameters 295s > r <- lambda # size for negative binomial 295s > prob <- runif(30) # probs 295s > size <- round(lambda) # size for binomial 295s > stopifnot(exprs = { 295s + dztpois(0, lambda) == 0 295s + dztnbinom(0, r, prob) == 0 295s + dztgeom(0, prob) == 0 295s + dztbinom(0, size, prob) == 0 295s + dlogarithmic(0, prob) == 0 295s + }) 295s > 295s > x <- sapply(size, sample, size = 1) 295s > stopifnot(exprs = { 295s + All.eq(dztpois(x, lambda), 295s + mapply(dab1, x, 295s + a = 0, 295s + b = lambda, 295s + p1 = lambda/(exp(lambda) - 1))) 295s + All.eq(dztnbinom(x, r, prob), 295s + mapply(dab1, x, 295s + a = 1 - prob, 295s + b = (r - 1) * (1 - prob), 295s + p1 = r * prob^r * (1 - prob)/(1 - prob^r))) 295s + All.eq(dztgeom(x, prob), 295s + mapply(dab1, x, 295s + a = 1 - prob, 295s + b = 0, 295s + p1 = prob)) 295s + All.eq(dztbinom(x, size, prob), 295s + mapply(dab1, x, 295s + a = -prob/(1 - prob), 295s + b = (size + 1) * prob/(1 - prob), 295s + p1 = size * prob * (1 - prob)^(size - 1)/(1 - (1 - prob)^size))) 295s + All.eq(dlogarithmic(x, prob), 295s + mapply(dab1, x, 295s + a = prob, 295s + b = -prob, 295s + p1 = -prob/log1p(-prob))) 295s + }) 295s > 295s > ## Tests on cumulative distribution function. 295s > for (l in lambda) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dztpois(0:20, l)), 295s + pztpois(0:20, l), 295s + tolerance = 1e-8) 295s + }) 295s > for (i in seq_along(r)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dztnbinom(0:20, r[i], prob[i])), 295s + pztnbinom(0:20, r[i], prob[i]), 295s + tolerance = 1e-8) 295s + }) 295s > for (i in seq_along(r)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dztgeom(0:20, prob[i])), 295s + pztgeom(0:20, prob[i]), 295s + tolerance = 1e-8) 295s + }) 295s > for (i in seq_along(size)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dztbinom(0:20, size[i], prob[i])), 295s + pztbinom(0:20, size[i], prob[i]), 295s + tolerance = 1e-8) 295s + }) 295s > for (p in prob) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dlogarithmic(0:20, p)), 295s + plogarithmic(0:20, p), 295s + tolerance = 1e-8) 295s + }) 295s > 295s > ## ZERO-MODIFIED (a, b, 1) CLASS 295s > 295s > ## Tests on the probability mass function: 295s > ## 295s > ## 1. probability is p0 at x = 0 (trivial, but...); 295s > ## 2. pmf satisfies the recursive relation 295s > lambda <- rlnorm(30, 2) # Poisson parameters 295s > r <- lambda # size for negative binomial 295s > prob <- runif(30) # probs 295s > size <- round(lambda) # size for binomial 295s > p0 <- runif(30) # probs at 0 295s > stopifnot(exprs = { 295s + dzmpois(0, lambda, p0) == p0 295s + dzmnbinom(0, r, prob, p0) == p0 295s + dzmgeom(0, prob, p0) == p0 295s + dzmbinom(0, size, prob, p0) == p0 295s + dzmlogarithmic(0, prob, p0) == p0 295s + }) 295s > 295s > x <- sapply(size, sample, size = 1) 295s > stopifnot(exprs = { 295s + All.eq(dzmpois(x, lambda, p0), 295s + mapply(dab1, x, 295s + a = 0, 295s + b = lambda, 295s + p1 = (1 - p0) *lambda/(exp(lambda) - 1))) 295s + All.eq(dzmnbinom(x, r, prob, p0), 295s + mapply(dab1, x, 295s + a = 1 - prob, 295s + b = (r - 1) * (1 - prob), 295s + p1 = (1 - p0) * r * prob^r * (1 - prob)/(1 - prob^r))) 295s + All.eq(dzmgeom(x, prob, p0), 295s + mapply(dab1, x, 295s + a = 1 - prob, 295s + b = 0, 295s + p1 = (1 - p0) * prob)) 295s + All.eq(dzmbinom(x, size, prob, p0), 295s + mapply(dab1, x, 295s + a = -prob/(1 - prob), 295s + b = (size + 1) * prob/(1 - prob), 295s + p1 = (1 - p0) * size * prob * (1 - prob)^(size - 1)/(1 - (1 - prob)^size))) 295s + All.eq(dzmlogarithmic(x, prob, p0), 295s + mapply(dab1, x, 295s + a = prob, 295s + b = -prob, 295s + p1 = -(1 - p0) * prob/log1p(-prob))) 295s + }) 295s > 295s > ## Tests on cumulative distribution function. 295s > for (i in seq_along(lambda)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dzmpois(0:20, lambda[i], p0 = p0[i])), 295s + pzmpois(0:20, lambda[i], p0 = p0[i]), 295s + tolerance = 1e-8) 295s + }) 295s > for (i in seq_along(r)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dzmnbinom(0:20, r[i], prob[i], p0[i])), 295s + pzmnbinom(0:20, r[i], prob[i], p0[i]), 295s + tolerance = 1e-8) 295s + }) 295s > for (i in seq_along(r)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dzmgeom(0:20, prob[i], p0[i])), 295s + pzmgeom(0:20, prob[i], p0[i]), 295s + tolerance = 1e-8) 295s + }) 295s > for (i in seq_along(size)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dzmbinom(0:20, size[i], prob[i], p0[i])), 295s + pzmbinom(0:20, size[i], prob[i], p0[i]), 295s + tolerance = 1e-8) 295s + }) 295s > for (i in seq_along(prob)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dzmlogarithmic(0:20, prob[i], p0[i])), 295s + pzmlogarithmic(0:20, prob[i], p0[i]), 295s + tolerance = 1e-8) 295s + }) 295s > 295s > ## POISSON-INVERSE GAUSSIAN 295s > 295s > ## Reset seed 295s > set.seed(123) 295s > 295s > ## Define a small function to compute probabilities for the PIG 295s > ## directly using the Bessel function. 295s > dpigBK <- function(x, mu, phi) 295s + { 295s + M_LN2 <- 0.693147180559945309417232121458 295s + M_SQRT_2dPI <- 0.225791352644727432363097614947 295s + 295s + phimu <- phi * mu 295s + lphi <- log(phi) 295s + y <- x - 0.5 295s + 295s + logA = -lphi/2 - M_SQRT_2dPI 295s + logB = (M_LN2 + lphi + log1p(1/(2 * phimu * mu)))/2; 295s + 295s + exp(logA + 1/phimu - lfactorial(x) - y * logB) * 295s + besselK(exp(logB - lphi), y) 295s + } 295s > 295s > ## Tests on the probability mass function. 295s > mu <- rlnorm(30, 2) 295s > phi <- rlnorm(30, 2) 295s > x <- 0:100 295s > for (i in seq_along(phi)) 295s + { 295s + stopifnot(exprs = { 295s + all.equal(dpoisinvgauss(x, mean = mu[i], dispersion = phi[i]), 295s + dpigBK(x, mu[i], phi[i])) 295s + all.equal(dpoisinvgauss(x, mean = Inf, dispersion = phi[i]), 295s + dpigBK(x, Inf, phi[i])) 295s + }) 295s + } 295s > 295s > ## Tests on cumulative distribution function. 295s > for (i in seq_along(phi)) 295s + stopifnot(exprs = { 295s + all.equal(cumsum(dpoisinvgauss(0:20, mu[i], phi[i])), 295s + ppoisinvgauss(0:20, mu[i], phi[i]), 295s + tolerance = 1e-8) 295s + all.equal(cumsum(dpoisinvgauss(0:20, Inf, phi[i])), 295s + ppoisinvgauss(0:20, Inf, phi[i]), 295s + tolerance = 1e-8) 295s + }) 295s > 295s > ## 295s > ## RANDOM NUMBERS (all discrete distributions) 295s > ## 295s > set.seed(123) 295s > n <- 20 295s > 295s > ## Generate variates. 295s > ## 295s > ## For zero-modified distributions, we simulate two sets of values: 295s > ## one with p0m < p0 (suffix 'p0lt') and one with p0m > p0 (suffix 295s > ## 'p0gt'). 295s > Rztpois <- rztpois (n, lambda = 12) 295s > Rztnbinom <- rztnbinom (n, size = 7, prob = 0.01) 295s > Rztgeom <- rztgeom (n, prob = pi/16) 295s > Rztbinom <- rztbinom (n, size = 55, prob = pi/16) 295s > Rlogarithmic <- rlogarithmic(n, prob = 0.99) 295s > Rzmpoisp0lt <- rzmpois (n, lambda = 6, p0 = 0.001) 295s > Rzmpoisp0gt <- rzmpois (n, lambda = 6, p0 = 0.010) 295s > Rzmnbinomp0lt <- rzmnbinom (n, size = 7, prob = 0.8, p0 = 0.01) 295s > Rzmnbinomp0gt <- rzmnbinom (n, size = 7, prob = 0.8, p0 = 0.40) 295s > Rzmgeomp0lt <- rzmgeom (n, prob = pi/16, p0 = 0.01) 295s > Rzmgeomp0gt <- rzmgeom (n, prob = pi/16, p0 = 0.40) 295s > Rzmbinomp0lt <- rzmbinom (n, size = 12, prob = pi/16, p0 = 0.01) 295s > Rzmbinomp0gt <- rzmbinom (n, size = 12, prob = pi/16, p0 = 0.12) 295s > Rzmlogarithmicp0lt <- rzmlogarithmic(n, prob = 0.99, p0 = 0.05) 295s > Rzmlogarithmicp0gt <- rzmlogarithmic(n, prob = 0.99, p0 = 0.55) 295s > Rpoisinvgauss <- rpoisinvgauss(n, mean = 12, dispersion = 0.1) 295s > RpoisinvgaussInf <- rpoisinvgauss(n, mean = Inf, dispersion = 1.1) 295s > 295s > ## Compute quantiles 295s > Pztpois <- pztpois (Rztpois, lambda = 12) 295s > Pztnbinom <- pztnbinom (Rztnbinom, size = 7, prob = 0.01) 295s > Pztgeom <- pztgeom (Rztgeom, prob = pi/16) 295s > Pztbinom <- pztbinom (Rztbinom, size = 55, prob = pi/16) 295s > Plogarithmic <- plogarithmic(Rlogarithmic, prob = 0.99) 295s > Pzmpoisp0lt <- pzmpois (Rzmpoisp0lt, lambda = 6, p0 = 0.001) 295s > Pzmpoisp0gt <- pzmpois (Rzmpoisp0gt, lambda = 6, p0 = 0.010) 295s > Pzmnbinomp0lt <- pzmnbinom (Rzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 295s > Pzmnbinomp0gt <- pzmnbinom (Rzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 295s > Pzmgeomp0lt <- pzmgeom (Rzmgeomp0lt, prob = pi/16, p0 = 0.01) 295s > Pzmgeomp0gt <- pzmgeom (Rzmgeomp0gt, prob = pi/16, p0 = 0.40) 295s > Pzmbinomp0lt <- pzmbinom (Rzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 295s > Pzmbinomp0gt <- pzmbinom (Rzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 295s > Pzmlogarithmicp0lt <- pzmlogarithmic(Rzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 295s > Pzmlogarithmicp0gt <- pzmlogarithmic(Rzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 295s > Ppoisinvgauss <- ppoisinvgauss(Rpoisinvgauss, mean = 12, dispersion = 0.1) 295s > PpoisinvgaussInf <- ppoisinvgauss(RpoisinvgaussInf, mean = Inf, dispersion = 1.1) 295s > 295s > ## Just compute pmf 295s > Dztpois <- dztpois (Rztpois, lambda = 12) 295s > Dztnbinom <- dztnbinom (Rztnbinom, size = 7, prob = 0.01) 295s > Dztgeom <- dztgeom (Rztgeom, prob = pi/16) 295s > Dztbinom <- dztbinom (Rztbinom, size = 55, prob = pi/16) 295s > Dlogarithmic <- dlogarithmic(Rlogarithmic, prob = pi/16) 295s > Dzmpoisp0lt <- dzmpois (Rzmpoisp0lt, lambda = 6, p0 = 0.001) 295s > Dzmpoisp0gt <- dzmpois (Rzmpoisp0gt, lambda = 6, p0 = 0.010) 295s > Dzmnbinomp0lt <- dzmnbinom (Rzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 295s > Dzmnbinomp0gt <- dzmnbinom (Rzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 295s > Dzmgeomp0lt <- dzmgeom (Rzmgeomp0lt, prob = pi/16, p0 = 0.01) 295s > Dzmgeomp0gt <- dzmgeom (Rzmgeomp0gt, prob = pi/16, p0 = 0.40) 295s > Dzmbinomp0lt <- dzmbinom (Rzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 295s > Dzmbinomp0gt <- dzmbinom (Rzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 295s > Dzmlogarithmicp0lt <- dzmlogarithmic(Rzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 295s > Dzmlogarithmicp0gt <- dzmlogarithmic(Rzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 295s > Dpoisinvgauss <- dpoisinvgauss(Rpoisinvgauss, mean = 12, dispersion = 0.1) 295s > DpoisinvgaussInf <- dpoisinvgauss(RpoisinvgaussInf, mean = Inf, dispersion = 1.1) 295s > 295s > ## Check q(p(.)) identity 295s > stopifnot(exprs = { 295s + Rztpois == qztpois (Pztpois, lambda = 12) 295s + Rztnbinom == qztnbinom (Pztnbinom, size = 7, prob = 0.01) 295s + Rztgeom == qztgeom (Pztgeom, prob = pi/16) 295s + Rztbinom == qztbinom (Pztbinom, size = 55, prob = pi/16) 295s + Rlogarithmic == qlogarithmic(Plogarithmic, prob = 0.99) 295s + Rzmpoisp0lt == qzmpois (Pzmpoisp0lt, lambda = 6, p0 = 0.001) 295s + Rzmpoisp0gt == qzmpois (Pzmpoisp0gt, lambda = 6, p0 = 0.010) 295s + Rzmnbinomp0lt == qzmnbinom (Pzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 295s + Rzmnbinomp0gt == qzmnbinom (Pzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 295s + Rzmgeomp0lt == qzmgeom (Pzmgeomp0lt, prob = pi/16, p0 = 0.01) 295s + Rzmgeomp0gt == qzmgeom (Pzmgeomp0gt, prob = pi/16, p0 = 0.40) 295s + Rzmbinomp0lt == qzmbinom (Pzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 295s + Rzmbinomp0gt == qzmbinom (Pzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 295s + Rzmlogarithmicp0lt == qzmlogarithmic(Pzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 295s + Rzmlogarithmicp0gt == qzmlogarithmic(Pzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 295s + Rpoisinvgauss == qpoisinvgauss(Ppoisinvgauss, mean = 12, dispersion = 0.1) 295s + RpoisinvgaussInf == qpoisinvgauss(PpoisinvgaussInf, mean = Inf, dispersion = 1.1) 295s + }) 296s > 296s > ## Check q(p(.)) identity with upper tail 296s > stopifnot(exprs = { 296s + Rztpois == qztpois (1 - Pztpois, lambda = 12, lower = FALSE) 296s + Rztnbinom == qztnbinom (1 - Pztnbinom, size = 7, prob = 0.01, lower = FALSE) 296s + Rztgeom == qztgeom (1 - Pztgeom, prob = pi/16, lower = FALSE) 296s + Rztbinom == qztbinom (1 - Pztbinom, size = 55, prob = pi/16, lower = FALSE) 296s + Rlogarithmic == qlogarithmic(1 - Plogarithmic, prob = 0.99, lower = FALSE) 296s + Rzmpoisp0lt == qzmpois (1 - Pzmpoisp0lt, lambda = 6, p0 = 0.001, lower = FALSE) 296s + Rzmpoisp0gt == qzmpois (1 - Pzmpoisp0gt, lambda = 6, p0 = 0.010, lower = FALSE) 296s + Rzmnbinomp0lt == qzmnbinom (1 - Pzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01, lower = FALSE) 296s + Rzmnbinomp0gt == qzmnbinom (1 - Pzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40, lower = FALSE) 296s + Rzmgeomp0lt == qzmgeom (1 - Pzmgeomp0lt, prob = pi/16, p0 = 0.01, lower = FALSE) 296s + Rzmgeomp0gt == qzmgeom (1 - Pzmgeomp0gt, prob = pi/16, p0 = 0.40, lower = FALSE) 296s + Rzmbinomp0lt == qzmbinom (1 - Pzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01, lower = FALSE) 296s + Rzmbinomp0gt == qzmbinom (1 - Pzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12, lower = FALSE) 296s + Rzmlogarithmicp0lt == qzmlogarithmic(1 - Pzmlogarithmicp0lt, prob = 0.99, p0 = 0.05, lower = FALSE) 296s + Rzmlogarithmicp0gt == qzmlogarithmic(1 - Pzmlogarithmicp0gt, prob = 0.99, p0 = 0.55, lower = FALSE) 296s + Rpoisinvgauss == qpoisinvgauss(1 - Ppoisinvgauss, mean = 12, dispersion = 0.1, lower = FALSE) 296s + RpoisinvgaussInf == qpoisinvgauss(1 - PpoisinvgaussInf, mean = Inf, dispersion = 1.1, lower = FALSE) 296s + }) 298s > 298s > ## Check q(p(., log), log) identity 298s > stopifnot(exprs = { 298s + Rztpois == qztpois (log(Pztpois), lambda = 12, log = TRUE) 298s + Rztnbinom == qztnbinom (log(Pztnbinom), size = 7, prob = 0.01, log = TRUE) 298s + Rztgeom == qztgeom (log(Pztgeom), prob = pi/16, log = TRUE) 298s + Rztbinom == qztbinom (log(Pztbinom), size = 55, prob = pi/16, log = TRUE) 298s + Rlogarithmic == qlogarithmic(log(Plogarithmic), prob = 0.99, log = TRUE) 298s + Rzmpoisp0lt == qzmpois (log(Pzmpoisp0lt), lambda = 6, p0 = 0.001, log = TRUE) 298s + Rzmpoisp0gt == qzmpois (log(Pzmpoisp0gt), lambda = 6, p0 = 0.010, log = TRUE) 298s + Rzmnbinomp0lt == qzmnbinom (log(Pzmnbinomp0lt), size = 7, prob = 0.8, p0 = 0.01, log = TRUE) 298s + Rzmnbinomp0gt == qzmnbinom (log(Pzmnbinomp0gt), size = 7, prob = 0.8, p0 = 0.40, log = TRUE) 298s + Rzmgeomp0lt == qzmgeom (log(Pzmgeomp0lt), prob = pi/16, p0 = 0.01, log = TRUE) 298s + Rzmgeomp0gt == qzmgeom (log(Pzmgeomp0gt), prob = pi/16, p0 = 0.40, log = TRUE) 298s + Rzmbinomp0lt == qzmbinom (log(Pzmbinomp0lt), size = 12, prob = pi/16, p0 = 0.01, log = TRUE) 298s + Rzmbinomp0gt == qzmbinom (log(Pzmbinomp0gt), size = 12, prob = pi/16, p0 = 0.12, log = TRUE) 298s + Rzmlogarithmicp0lt == qzmlogarithmic(log(Pzmlogarithmicp0lt), prob = 0.99, p0 = 0.05, log = TRUE) 298s + Rzmlogarithmicp0gt == qzmlogarithmic(log(Pzmlogarithmicp0gt), prob = 0.99, p0 = 0.55, log = TRUE) 298s + Rpoisinvgauss == qpoisinvgauss(log(Ppoisinvgauss), mean = 12, dispersion = 0.1, log = TRUE) 298s + RpoisinvgaussInf == qpoisinvgauss(log(PpoisinvgaussInf), mean = Inf, dispersion = 1.1, log = TRUE) 298s + }) 299s > 299s > ## Check q(p(., log), log) identity with upper tail 299s > stopifnot(exprs = { 299s + Rztpois == qztpois (log1p(-Pztpois), lambda = 12, lower = FALSE, log = TRUE) 299s + Rztnbinom == qztnbinom (log1p(-Pztnbinom), size = 7, prob = 0.01, lower = FALSE, log = TRUE) 299s + Rztgeom == qztgeom (log1p(-Pztgeom), prob = pi/16, lower = FALSE, log = TRUE) 299s + Rztbinom == qztbinom (log1p(-Pztbinom), size = 55, prob = pi/16, lower = FALSE, log = TRUE) 299s + Rlogarithmic == qlogarithmic(log1p(-Plogarithmic), prob = 0.99, lower = FALSE, log = TRUE) 299s + Rzmpoisp0lt == qzmpois (log1p(-Pzmpoisp0lt), lambda = 6, p0 = 0.001, lower = FALSE, log = TRUE) 299s + Rzmpoisp0gt == qzmpois (log1p(-Pzmpoisp0gt), lambda = 6, p0 = 0.010, lower = FALSE, log = TRUE) 299s + Rzmnbinomp0lt == qzmnbinom (log1p(-Pzmnbinomp0lt), size = 7, prob = 0.8, p0 = 0.01, lower = FALSE, log = TRUE) 299s + Rzmnbinomp0gt == qzmnbinom (log1p(-Pzmnbinomp0gt), size = 7, prob = 0.8, p0 = 0.40, lower = FALSE, log = TRUE) 299s + Rzmgeomp0lt == qzmgeom (log1p(-Pzmgeomp0lt), prob = pi/16, p0 = 0.01, lower = FALSE, log = TRUE) 299s + Rzmgeomp0gt == qzmgeom (log1p(-Pzmgeomp0gt), prob = pi/16, p0 = 0.40, lower = FALSE, log = TRUE) 299s + Rzmbinomp0lt == qzmbinom (log1p(-Pzmbinomp0lt), size = 12, prob = pi/16, p0 = 0.01, lower = FALSE, log = TRUE) 299s + Rzmbinomp0gt == qzmbinom (log1p(-Pzmbinomp0gt), size = 12, prob = pi/16, p0 = 0.12, lower = FALSE, log = TRUE) 299s + Rzmlogarithmicp0lt == qzmlogarithmic(log1p(-Pzmlogarithmicp0lt), prob = 0.99, p0 = 0.05, lower = FALSE, log = TRUE) 299s + Rzmlogarithmicp0gt == qzmlogarithmic(log1p(-Pzmlogarithmicp0gt), prob = 0.99, p0 = 0.55, lower = FALSE, log = TRUE) 299s + Rpoisinvgauss == qpoisinvgauss(log1p(-Ppoisinvgauss), mean = 12, dispersion = 0.1, lower = FALSE, log = TRUE) 299s + RpoisinvgaussInf == qpoisinvgauss(log1p(-PpoisinvgaussInf), mean = Inf, dispersion = 1.1, lower = FALSE, log = TRUE) 299s + }) 300s > 300s BEGIN TEST rcompound-tests.R 300s 300s R version 4.4.3 (2025-02-28) -- "Trophy Case" 300s Copyright (C) 2025 The R Foundation for Statistical Computing 300s Platform: arm-unknown-linux-gnueabihf (32-bit) 300s 300s R is free software and comes with ABSOLUTELY NO WARRANTY. 300s You are welcome to redistribute it under certain conditions. 300s Type 'license()' or 'licence()' for distribution details. 300s 300s R is a collaborative project with many contributors. 300s Type 'contributors()' for more information and 300s 'citation()' on how to cite R or R packages in publications. 300s 300s Type 'demo()' for some demos, 'help()' for on-line help, or 300s 'help.start()' for an HTML browser interface to help. 300s Type 'q()' to quit R. 300s 300s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 300s > ### 300s > ### Tests for the simulation of compound models with 'rcompound' and 300s > ### 'rcomppois'. 300s > ### 300s > ### AUTHOR: Vincent Goulet 300s > 300s > ## Load the package 300s > library(actuar) 300s 300s Attaching package: ‘actuar’ 300s 300s The following objects are masked from ‘package:stats’: 300s 300s sd, var 300s 300s > 300s > ## Copy of tools::assertError. 300s > assertError <- tools::assertError 300s The following object is masked from ‘package:grDevices’: 300s 300s cm 300s 300s > 300s > ### 300s > ### Tests for rcompound 300s > ### 300s > 300s > ## Test the function itself with various types of arguments. 300s > n <- 20 300s > fmodel <- expression(rnbinom(2, 0.8)) 300s > smodel <- expression(rgamma(2, 1)) 300s > set.seed(123) 300s > x <- numeric(n) 300s > N <- rnbinom(n, 2, 0.8) 300s > y <- rgamma(sum(N), 2, 1) 300s > x[which(N != 0)] <- tapply(y, rep(seq_len(n), N), sum) 300s > stopifnot(exprs = { 300s + identical(x, { 300s + set.seed(123) 300s + rcompound(n, rnbinom(2, 0.8), rgamma(2, 1)) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + rcompound(n, rnbinom(2, 0.8), expression(rgamma(2, 1))) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + rcompound(n, expression(rnbinom(2, 0.8)), rgamma(2, 1)) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + rcompound(n, fmodel, smodel) 300s + }) 300s + }) 300s > 300s > ## Test the calling environment, that is that arguments are correctly 300s > ## identified when 'rcompound' is called inside another function. 300s > n <- 20 300s > lambda <- 2 300s > smodel <- expression(rgamma(2, 1)) 300s > set.seed(123) 300s > x <- rcompound(n, rpois(2), rgamma(2, 1)) 300s > f <- function(n, p, model.sev) 300s + { 300s + ## safe way to pass down the arguments 300s + model.freq <- substitute(rpois(p), list(p = p)) 300s + model.sev <- substitute(model.sev) 300s + if (is.name(model.sev)) 300s + model.sev <- eval.parent(model.sev) 300s + rcompound(n, model.freq, model.sev) 300s + } 300s > g1 <- function(n, p, s, r) 300s + rcompound(n, rpois(p), rgamma(s, r)) 300s > g2 <- function(n, p, s, r) 300s + rcompound(n, expression(rpois(p)), expression(rgamma(s, r))) 300s > h <- function(n, p, model.sev) 300s + { 300s + ## safe way to pass down the arguments 300s + model.sev <- substitute(model.sev) 300s + if (is.name(model.sev)) 300s + model.sev <- eval.parent(model.sev) 300s + f(n, p, model.sev) 300s + } 300s > stopifnot(exprs = { 300s + identical(x, { 300s + set.seed(123) 300s + f(n, 2, rgamma(2, 1)) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + f(n, lambda, expression(rgamma(2, 1))) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + f(n, lambda, smodel) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + g1(n, lambda, 2, 1) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + g2(n, lambda, 2, 1) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + h(n, 2, rgamma(2, 1)) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + h(n, lambda, smodel) 300s + }) 300s + }) 300s > 300s > ## Test invalid arguments. 300s > assertError(rcompound(-1, rpois(2), rgamma(2, 1))) 300s > 300s > 300s > ### 300s > ### Tests for rcomppois 300s > ### 300s > 300s > ## Test the function itself with various types of arguments. 300s > n <- 20 300s > lambda <- 2 300s > smodel <- expression(rgamma(2, 1)) 300s > set.seed(123) 300s > x <- numeric(n) 300s > N <- rpois(n, 2) 300s > y <- rgamma(sum(N), 2, 1) 300s > x[which(N != 0)] <- tapply(y, rep(seq_len(n), N), sum) 300s > stopifnot(exprs = { 300s + identical(x, { 300s + set.seed(123) 300s + rcomppois(n, 2, rgamma(2, 1)) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + rcomppois(n, lambda, expression(rgamma(2, 1))) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + rcomppois(n, lambda, smodel) 300s + }) 300s + }) 300s > 300s > ## Test the calling environment, that is that arguments are correctly 300s > ## identified when 'rcomppois' is called inside another function. 300s > n <- 20 300s > lambda <- 2 300s > smodel <- expression(rgamma(2, 1)) 300s > set.seed(123) 300s > x <- rcomppois(n, lambda, smodel) 300s > f <- function(n, p, model) 300s + { 300s + ## safe way to pass down all sorts of 'model' objects 300s + model <- substitute(model) 300s + if (is.name(model)) 300s + model <- eval.parent(model) 300s + rcomppois(n, p, model) 300s + } 300s > g1 <- function(n, p, s, r) 300s + rcomppois(n, p, rgamma(s, r)) 300s > g2 <- function(n, p, s, r) 300s + rcomppois(n, p, expression(rgamma(s, r))) 300s > h <- function(n, p, model) 300s + { 300s + ## safe way to pass down all sorts of 'model' objects 300s + model <- substitute(model) 300s + if (is.name(model)) 300s + model <- eval.parent(model) 300s + f(n, p, model) 300s + } 300s > stopifnot(exprs = { 300s + identical(x, { 300s + set.seed(123) 300s + f(n, 2, rgamma(2, 1)) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + f(n, lambda, expression(rgamma(2, 1))) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + f(n, lambda, smodel) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + g1(n, 2, 2, 1) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + g2(n, 2, 2, 1) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + h(n, 2, rgamma(2, 1)) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + h(n, lambda, smodel) 300s + }) 300s + }) 300s > 300s > ## Test invalid arguments. 300s > assertError(rcomppois(-1, lambda, smodel)) 300s > assertError(rcomppois(n, -1, smodel)) 300s > assertError(rcomppois(n, c(3, -1), smodel)) 300s > 300s BEGIN TEST rmixture-tests.R 300s 300s R version 4.4.3 (2025-02-28) -- "Trophy Case" 300s Copyright (C) 2025 The R Foundation for Statistical Computing 300s Platform: arm-unknown-linux-gnueabihf (32-bit) 300s 300s R is free software and comes with ABSOLUTELY NO WARRANTY. 300s You are welcome to redistribute it under certain conditions. 300s Type 'license()' or 'licence()' for distribution details. 300s 300s R is a collaborative project with many contributors. 300s Type 'contributors()' for more information and 300s 'citation()' on how to cite R or R packages in publications. 300s 300s Type 'demo()' for some demos, 'help()' for on-line help, or 300s 'help.start()' for an HTML browser interface to help. 300s Type 'q()' to quit R. 300s 300s 300s Attaching package: ‘actuar’ 300s 300s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 300s > ### 300s > ### Tests for the simulation of discrete mixtures with 'rmixture'. 300s > ### 300s > ### AUTHOR: Vincent Goulet 300s > 300s > ## Load the package 300s > library(actuar) 300s > 300s > ## Copy of tools::assertError. 300s > assertError <- tools::assertError 300s > 300s > ## Set common values for the tests 300s > n <- 20 300s > bmodels <- expression(rexp(1/20), 300s + rlnorm(3.6, 0.6), 300s + rpareto(shape = 4, scale = 240)) 300s > 300s > ## Function to inject the number of variates in an expression and 300s > ## evaluate it. 300s > f <- function(n, expr) 300s + { 300s + expr$n <- n 300s + eval(expr) 300s + } 300s > 300s > ## Test a "normal" case (with data that is not reshuffled). 300s > set.seed(123) 300s > probs <- c(2, 3, 5)/10 300s > nj <- rmultinom(1, n, prob = probs) 300s > x <- c(f(nj[1], bmodels[[1]]), f(nj[2], bmodels[[2]]), f(nj[3], bmodels[[3]])) 300s > set.seed(123) 300s > stopifnot(exprs = { 300s + identical(x, rmixture(n, probs, bmodels, shuffle = FALSE)) 300s + }) 300s > 300s > ## Test recycling of the probability vector. 300s > set.seed(123) 300s > probs <- 1 300s > nj <- rmultinom(1, n, prob = rep_len(probs, 3)) 300s > x <- c(f(nj[1], bmodels[[1]]), f(nj[2], bmodels[[2]]), f(nj[3], bmodels[[3]])) 300s > set.seed(123) 300s > stopifnot(exprs = { 300s + identical(x, rmixture(n, probs, bmodels, shuffle = FALSE)) 300s + }) 300s > 300s > ## Test recycling of the models vector. 300s > set.seed(123) 300s > probs <- c(2, 3, 5) 300s > nj <- rmultinom(1, n, prob = probs) 300s > x <- f(n, bmodels[[1]]) 300s > set.seed(123) 300s > stopifnot(exprs = { 300s + identical(x, rmixture(n, probs, bmodels[1], shuffle = FALSE)) 300s + }) 300s > 300s > ## Test special cases. 300s > stopifnot(exprs = { 300s + identical(numeric(0), rmixture(0, probs, bmodels)) 300s + identical(2L, length(rmixture(c(n, n), probs, bmodels))) 300s + }) 300s > 300s > ## Test the calling environment, that is that arguments are correctly 300s > ## identified when 'rmixture' is called inside another function. 300s > set.seed(123) 300s > probs <- c(2, 3, 5)/10 300s > x <- rmixture(n, probs, bmodels) 300s > f <- function(n, p, model) 300s + rmixture(n, p, model) 300s > g <- function(n, p, m, q) 300s + rmixture(n, p, expression(rexp(m[1]), rlnorm(m[2], q[2]), rpareto(m[3], q[3]))) 300s > h <- function(n, p, model) 300s + f(n, c(p[1], p[2], p[3]), 300s + c(model[1], model[2], model[3])) 300s > k <- function(n, p, m, q) 300s + { 300s + ## Pathological case where the models expression does not evaluate 300s + ## in the frame of 'rmixture' as 'm' and 'q' will not be bound. 300s + ## The fix is to substitute variables by their values. 300s + models <- substitute(expression(rexp(m[1]), rlnorm(m[2], q[2]), rpareto(m[3], q[3])), 300s + list(m = m, q = q)) 300s + 300s + f(n, p, eval(models)) 300s + } 300s > stopifnot(exprs = { 300s + identical(x, { 300s + set.seed(123) 300s + f(n, probs, bmodels) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + f(n, c(probs[1], probs[2], probs[3]), 300s + c(bmodels[1], bmodels[2], bmodels[3])) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + g(n, p = probs, 300s + m = c(eval(bmodels[[c(1, 2)]]), eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(3, 2)]])), 300s + q = c(NA, eval(bmodels[[c(2, 3)]]), eval(bmodels[[c(3, 3)]]))) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + h(n, probs, 300s + expression(rexp(eval(bmodels[[c(1, 2)]])), 300s + rlnorm(eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(2, 3)]])), 300s + rpareto(shape = eval(bmodels[[c(3, 2)]]), scale = eval(bmodels[[c(3, 3)]])))) 300s + }) 300s + identical(x, { 300s + set.seed(123) 300s + k(n, p = probs, 300s + m = c(eval(bmodels[[c(1, 2)]]), eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(3, 2)]])), 300s + q = c(NA, eval(bmodels[[c(2, 3)]]), eval(bmodels[[c(3, 3)]]))) 300s + }) 300s + }) 300s > 300s > ## Finally, test invalid arguments. 300s > assertError(rmixture(-1, probs, bmodels)) 300s > assertError(rmixture(c(3, -1), probs, bmodels)) 300s > assertError(rmixture(n, numeric(0), bmodels)) 300s > assertError(rmixture(n, 0, bmodels)) 300s > assertError(rmixture(n, c(0, 0), bmodels)) 300s > assertError(rmixture(n, probs, c(rexp(2), rexp(7)))) 300s > 300s The following objects are masked from ‘package:stats’: 300s 300s sd, var 300s 300s The following object is masked from ‘package:grDevices’: 300s 300s cm 300s 301s autopkgtest [16:02:12]: test run-unit-test: -----------------------] 304s autopkgtest [16:02:15]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 304s run-unit-test PASS 308s autopkgtest [16:02:19]: test pkg-r-autopkgtest: preparing testbed 310s Reading package lists... 310s Building dependency tree... 310s Reading state information... 312s Starting pkgProblemResolver with broken count: 0 312s Starting 2 pkgProblemResolver with broken count: 0 312s Done 312s The following NEW packages will be installed: 312s build-essential cpp cpp-14 cpp-14-arm-linux-gnueabihf 312s cpp-arm-linux-gnueabihf dctrl-tools g++ g++-14 g++-14-arm-linux-gnueabihf 312s g++-arm-linux-gnueabihf gcc gcc-14 gcc-14-arm-linux-gnueabihf 312s gcc-arm-linux-gnueabihf gfortran gfortran-14 gfortran-14-arm-linux-gnueabihf 312s gfortran-arm-linux-gnueabihf icu-devtools libasan8 libblas-dev libbz2-dev 312s libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libdeflate-dev libgcc-14-dev 312s libgfortran-14-dev libicu-dev libisl23 libjpeg-dev libjpeg-turbo8-dev 312s libjpeg8-dev liblapack-dev liblzma-dev libmpc3 libncurses-dev libpcre2-16-0 312s libpcre2-32-0 libpcre2-dev libpcre2-posix3 libpkgconf3 libpng-dev 312s libreadline-dev libstdc++-14-dev libtirpc-dev libubsan1 linux-libc-dev 312s pkg-r-autopkgtest pkgconf pkgconf-bin r-base-dev rpcsvc-proto zlib1g-dev 312s 0 upgraded, 55 newly installed, 0 to remove and 0 not upgraded. 312s Need to get 78.1 MB of archives. 312s After this operation, 243 MB of additional disk space will be used. 312s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc-dev-bin armhf 2.41-1ubuntu2 [23.0 kB] 312s Get:2 http://ftpmaster.internal/ubuntu plucky/main armhf linux-libc-dev armhf 6.14.0-10.10 [1683 kB] 313s Get:3 http://ftpmaster.internal/ubuntu plucky/main armhf libcrypt-dev armhf 1:4.4.38-1 [120 kB] 314s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf rpcsvc-proto armhf 1.4.2-0ubuntu7 [62.2 kB] 314s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf libc6-dev armhf 2.41-1ubuntu2 [1396 kB] 315s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf libisl23 armhf 0.27-1 [546 kB] 316s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf libmpc3 armhf 1.3.1-1build2 [47.1 kB] 316s Get:8 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [9220 kB] 326s Get:9 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-14 armhf 14.2.0-17ubuntu3 [1030 B] 326s Get:10 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [5578 B] 326s Get:11 http://ftpmaster.internal/ubuntu plucky/main armhf cpp armhf 4:14.2.0-1ubuntu1 [22.4 kB] 326s Get:12 http://ftpmaster.internal/ubuntu plucky/main armhf libcc1-0 armhf 15-20250222-0ubuntu1 [38.9 kB] 327s Get:13 http://ftpmaster.internal/ubuntu plucky/main armhf libasan8 armhf 15-20250222-0ubuntu1 [2955 kB] 330s Get:14 http://ftpmaster.internal/ubuntu plucky/main armhf libubsan1 armhf 15-20250222-0ubuntu1 [1191 kB] 331s Get:15 http://ftpmaster.internal/ubuntu plucky/main armhf libgcc-14-dev armhf 14.2.0-17ubuntu3 [897 kB] 332s Get:16 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [18.0 MB] 353s Get:17 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-14 armhf 14.2.0-17ubuntu3 [506 kB] 353s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [1218 B] 353s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf gcc armhf 4:14.2.0-1ubuntu1 [5004 B] 353s Get:20 http://ftpmaster.internal/ubuntu plucky/main armhf libstdc++-14-dev armhf 14.2.0-17ubuntu3 [2573 kB] 356s Get:21 http://ftpmaster.internal/ubuntu plucky/main armhf g++-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [10.5 MB] 369s Get:22 http://ftpmaster.internal/ubuntu plucky/main armhf g++-14 armhf 14.2.0-17ubuntu3 [21.8 kB] 369s Get:23 http://ftpmaster.internal/ubuntu plucky/main armhf g++-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [966 B] 369s Get:24 http://ftpmaster.internal/ubuntu plucky/main armhf g++ armhf 4:14.2.0-1ubuntu1 [1084 B] 369s Get:25 http://ftpmaster.internal/ubuntu plucky/main armhf build-essential armhf 12.10ubuntu1 [4928 B] 369s Get:26 http://ftpmaster.internal/ubuntu plucky/main armhf dctrl-tools armhf 2.24-3build3 [94.7 kB] 369s Get:27 http://ftpmaster.internal/ubuntu plucky/main armhf libgfortran-14-dev armhf 14.2.0-17ubuntu3 [370 kB] 369s Get:28 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran-14-arm-linux-gnueabihf armhf 14.2.0-17ubuntu3 [9763 kB] 382s Get:29 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran-14 armhf 14.2.0-17ubuntu3 [13.6 kB] 382s Get:30 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran-arm-linux-gnueabihf armhf 4:14.2.0-1ubuntu1 [1026 B] 382s Get:31 http://ftpmaster.internal/ubuntu plucky/main armhf gfortran armhf 4:14.2.0-1ubuntu1 [1166 B] 382s Get:32 http://ftpmaster.internal/ubuntu plucky/main armhf icu-devtools armhf 76.1-1ubuntu2 [206 kB] 382s Get:33 http://ftpmaster.internal/ubuntu plucky/main armhf libblas-dev armhf 3.12.1-2 [141 kB] 382s Get:34 http://ftpmaster.internal/ubuntu plucky/main armhf libbz2-dev armhf 1.0.8-6 [30.9 kB] 382s Get:35 http://ftpmaster.internal/ubuntu plucky/main armhf libdeflate-dev armhf 1.23-1 [45.0 kB] 382s Get:36 http://ftpmaster.internal/ubuntu plucky/main armhf libicu-dev armhf 76.1-1ubuntu2 [12.0 MB] 396s Get:37 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg-turbo8-dev armhf 2.1.5-3ubuntu2 [265 kB] 397s Get:38 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg8-dev armhf 8c-2ubuntu11 [1484 B] 397s Get:39 http://ftpmaster.internal/ubuntu plucky/main armhf libjpeg-dev armhf 8c-2ubuntu11 [1482 B] 397s Get:40 http://ftpmaster.internal/ubuntu plucky/main armhf liblapack-dev armhf 3.12.1-2 [2207 kB] 399s Get:41 http://ftpmaster.internal/ubuntu plucky/main armhf libncurses-dev armhf 6.5+20250216-2 [345 kB] 400s Get:42 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-16-0 armhf 10.45-1 [207 kB] 400s Get:43 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-32-0 armhf 10.45-1 [197 kB] 400s Get:44 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-posix3 armhf 10.45-1 [6300 B] 400s Get:45 http://ftpmaster.internal/ubuntu plucky/main armhf libpcre2-dev armhf 10.45-1 [752 kB] 401s Get:46 http://ftpmaster.internal/ubuntu plucky/main armhf libpkgconf3 armhf 1.8.1-4 [26.6 kB] 401s Get:47 http://ftpmaster.internal/ubuntu plucky/main armhf zlib1g-dev armhf 1:1.3.dfsg+really1.3.1-1ubuntu1 [880 kB] 402s Get:48 http://ftpmaster.internal/ubuntu plucky/main armhf libpng-dev armhf 1.6.47-1 [251 kB] 403s Get:49 http://ftpmaster.internal/ubuntu plucky/main armhf libreadline-dev armhf 8.2-6 [153 kB] 403s Get:50 http://ftpmaster.internal/ubuntu plucky/main armhf liblzma-dev armhf 5.6.4-1 [166 kB] 403s Get:51 http://ftpmaster.internal/ubuntu plucky/main armhf pkgconf-bin armhf 1.8.1-4 [21.2 kB] 403s Get:52 http://ftpmaster.internal/ubuntu plucky/main armhf pkgconf armhf 1.8.1-4 [16.8 kB] 403s Get:53 http://ftpmaster.internal/ubuntu plucky/main armhf libtirpc-dev armhf 1.3.4+ds-1.3 [184 kB] 404s Get:54 http://ftpmaster.internal/ubuntu plucky/universe armhf r-base-dev all 4.4.3-1 [4176 B] 404s Get:55 http://ftpmaster.internal/ubuntu plucky/universe armhf pkg-r-autopkgtest all 20231212ubuntu1 [6448 B] 404s Fetched 78.1 MB in 1min 32s (845 kB/s) 404s Selecting previously unselected package libc-dev-bin. 404s (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 ... 67039 files and directories currently installed.) 404s Preparing to unpack .../00-libc-dev-bin_2.41-1ubuntu2_armhf.deb ... 404s Unpacking libc-dev-bin (2.41-1ubuntu2) ... 404s Selecting previously unselected package linux-libc-dev:armhf. 404s Preparing to unpack .../01-linux-libc-dev_6.14.0-10.10_armhf.deb ... 404s Unpacking linux-libc-dev:armhf (6.14.0-10.10) ... 404s Selecting previously unselected package libcrypt-dev:armhf. 404s Preparing to unpack .../02-libcrypt-dev_1%3a4.4.38-1_armhf.deb ... 404s Unpacking libcrypt-dev:armhf (1:4.4.38-1) ... 404s Selecting previously unselected package rpcsvc-proto. 404s Preparing to unpack .../03-rpcsvc-proto_1.4.2-0ubuntu7_armhf.deb ... 404s Unpacking rpcsvc-proto (1.4.2-0ubuntu7) ... 404s Selecting previously unselected package libc6-dev:armhf. 404s Preparing to unpack .../04-libc6-dev_2.41-1ubuntu2_armhf.deb ... 404s Unpacking libc6-dev:armhf (2.41-1ubuntu2) ... 405s Selecting previously unselected package libisl23:armhf. 405s Preparing to unpack .../05-libisl23_0.27-1_armhf.deb ... 405s Unpacking libisl23:armhf (0.27-1) ... 405s Selecting previously unselected package libmpc3:armhf. 405s Preparing to unpack .../06-libmpc3_1.3.1-1build2_armhf.deb ... 405s Unpacking libmpc3:armhf (1.3.1-1build2) ... 405s Selecting previously unselected package cpp-14-arm-linux-gnueabihf. 405s Preparing to unpack .../07-cpp-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 405s Unpacking cpp-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 405s Selecting previously unselected package cpp-14. 405s Preparing to unpack .../08-cpp-14_14.2.0-17ubuntu3_armhf.deb ... 405s Unpacking cpp-14 (14.2.0-17ubuntu3) ... 405s Selecting previously unselected package cpp-arm-linux-gnueabihf. 405s Preparing to unpack .../09-cpp-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 405s Unpacking cpp-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 405s Selecting previously unselected package cpp. 405s Preparing to unpack .../10-cpp_4%3a14.2.0-1ubuntu1_armhf.deb ... 405s Unpacking cpp (4:14.2.0-1ubuntu1) ... 405s Selecting previously unselected package libcc1-0:armhf. 405s Preparing to unpack .../11-libcc1-0_15-20250222-0ubuntu1_armhf.deb ... 405s Unpacking libcc1-0:armhf (15-20250222-0ubuntu1) ... 405s Selecting previously unselected package libasan8:armhf. 405s Preparing to unpack .../12-libasan8_15-20250222-0ubuntu1_armhf.deb ... 405s Unpacking libasan8:armhf (15-20250222-0ubuntu1) ... 405s Selecting previously unselected package libubsan1:armhf. 405s Preparing to unpack .../13-libubsan1_15-20250222-0ubuntu1_armhf.deb ... 405s Unpacking libubsan1:armhf (15-20250222-0ubuntu1) ... 405s Selecting previously unselected package libgcc-14-dev:armhf. 405s Preparing to unpack .../14-libgcc-14-dev_14.2.0-17ubuntu3_armhf.deb ... 405s Unpacking libgcc-14-dev:armhf (14.2.0-17ubuntu3) ... 405s Selecting previously unselected package gcc-14-arm-linux-gnueabihf. 405s Preparing to unpack .../15-gcc-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 405s Unpacking gcc-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 406s Selecting previously unselected package gcc-14. 406s Preparing to unpack .../16-gcc-14_14.2.0-17ubuntu3_armhf.deb ... 406s Unpacking gcc-14 (14.2.0-17ubuntu3) ... 406s Selecting previously unselected package gcc-arm-linux-gnueabihf. 406s Preparing to unpack .../17-gcc-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 406s Unpacking gcc-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 406s Selecting previously unselected package gcc. 406s Preparing to unpack .../18-gcc_4%3a14.2.0-1ubuntu1_armhf.deb ... 406s Unpacking gcc (4:14.2.0-1ubuntu1) ... 406s Selecting previously unselected package libstdc++-14-dev:armhf. 406s Preparing to unpack .../19-libstdc++-14-dev_14.2.0-17ubuntu3_armhf.deb ... 406s Unpacking libstdc++-14-dev:armhf (14.2.0-17ubuntu3) ... 406s Selecting previously unselected package g++-14-arm-linux-gnueabihf. 406s Preparing to unpack .../20-g++-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 406s Unpacking g++-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 406s Selecting previously unselected package g++-14. 406s Preparing to unpack .../21-g++-14_14.2.0-17ubuntu3_armhf.deb ... 406s Unpacking g++-14 (14.2.0-17ubuntu3) ... 406s Selecting previously unselected package g++-arm-linux-gnueabihf. 406s Preparing to unpack .../22-g++-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 406s Unpacking g++-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 407s Selecting previously unselected package g++. 407s Preparing to unpack .../23-g++_4%3a14.2.0-1ubuntu1_armhf.deb ... 407s Unpacking g++ (4:14.2.0-1ubuntu1) ... 407s Selecting previously unselected package build-essential. 407s Preparing to unpack .../24-build-essential_12.10ubuntu1_armhf.deb ... 407s Unpacking build-essential (12.10ubuntu1) ... 407s Selecting previously unselected package dctrl-tools. 407s Preparing to unpack .../25-dctrl-tools_2.24-3build3_armhf.deb ... 407s Unpacking dctrl-tools (2.24-3build3) ... 407s Selecting previously unselected package libgfortran-14-dev:armhf. 407s Preparing to unpack .../26-libgfortran-14-dev_14.2.0-17ubuntu3_armhf.deb ... 407s Unpacking libgfortran-14-dev:armhf (14.2.0-17ubuntu3) ... 407s Selecting previously unselected package gfortran-14-arm-linux-gnueabihf. 407s Preparing to unpack .../27-gfortran-14-arm-linux-gnueabihf_14.2.0-17ubuntu3_armhf.deb ... 407s Unpacking gfortran-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 407s Selecting previously unselected package gfortran-14. 407s Preparing to unpack .../28-gfortran-14_14.2.0-17ubuntu3_armhf.deb ... 407s Unpacking gfortran-14 (14.2.0-17ubuntu3) ... 407s Selecting previously unselected package gfortran-arm-linux-gnueabihf. 407s Preparing to unpack .../29-gfortran-arm-linux-gnueabihf_4%3a14.2.0-1ubuntu1_armhf.deb ... 407s Unpacking gfortran-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 407s Selecting previously unselected package gfortran. 407s Preparing to unpack .../30-gfortran_4%3a14.2.0-1ubuntu1_armhf.deb ... 407s Unpacking gfortran (4:14.2.0-1ubuntu1) ... 407s Selecting previously unselected package icu-devtools. 407s Preparing to unpack .../31-icu-devtools_76.1-1ubuntu2_armhf.deb ... 407s Unpacking icu-devtools (76.1-1ubuntu2) ... 407s Selecting previously unselected package libblas-dev:armhf. 407s Preparing to unpack .../32-libblas-dev_3.12.1-2_armhf.deb ... 407s Unpacking libblas-dev:armhf (3.12.1-2) ... 407s Selecting previously unselected package libbz2-dev:armhf. 407s Preparing to unpack .../33-libbz2-dev_1.0.8-6_armhf.deb ... 407s Unpacking libbz2-dev:armhf (1.0.8-6) ... 407s Selecting previously unselected package libdeflate-dev:armhf. 407s Preparing to unpack .../34-libdeflate-dev_1.23-1_armhf.deb ... 407s Unpacking libdeflate-dev:armhf (1.23-1) ... 407s Selecting previously unselected package libicu-dev:armhf. 407s Preparing to unpack .../35-libicu-dev_76.1-1ubuntu2_armhf.deb ... 407s Unpacking libicu-dev:armhf (76.1-1ubuntu2) ... 408s Selecting previously unselected package libjpeg-turbo8-dev:armhf. 408s Preparing to unpack .../36-libjpeg-turbo8-dev_2.1.5-3ubuntu2_armhf.deb ... 408s Unpacking libjpeg-turbo8-dev:armhf (2.1.5-3ubuntu2) ... 408s Selecting previously unselected package libjpeg8-dev:armhf. 408s Preparing to unpack .../37-libjpeg8-dev_8c-2ubuntu11_armhf.deb ... 408s Unpacking libjpeg8-dev:armhf (8c-2ubuntu11) ... 408s Selecting previously unselected package libjpeg-dev:armhf. 408s Preparing to unpack .../38-libjpeg-dev_8c-2ubuntu11_armhf.deb ... 408s Unpacking libjpeg-dev:armhf (8c-2ubuntu11) ... 408s Selecting previously unselected package liblapack-dev:armhf. 408s Preparing to unpack .../39-liblapack-dev_3.12.1-2_armhf.deb ... 408s Unpacking liblapack-dev:armhf (3.12.1-2) ... 408s Selecting previously unselected package libncurses-dev:armhf. 408s Preparing to unpack .../40-libncurses-dev_6.5+20250216-2_armhf.deb ... 408s Unpacking libncurses-dev:armhf (6.5+20250216-2) ... 408s Selecting previously unselected package libpcre2-16-0:armhf. 408s Preparing to unpack .../41-libpcre2-16-0_10.45-1_armhf.deb ... 408s Unpacking libpcre2-16-0:armhf (10.45-1) ... 408s Selecting previously unselected package libpcre2-32-0:armhf. 408s Preparing to unpack .../42-libpcre2-32-0_10.45-1_armhf.deb ... 408s Unpacking libpcre2-32-0:armhf (10.45-1) ... 408s Selecting previously unselected package libpcre2-posix3:armhf. 408s Preparing to unpack .../43-libpcre2-posix3_10.45-1_armhf.deb ... 408s Unpacking libpcre2-posix3:armhf (10.45-1) ... 408s Selecting previously unselected package libpcre2-dev:armhf. 408s Preparing to unpack .../44-libpcre2-dev_10.45-1_armhf.deb ... 408s Unpacking libpcre2-dev:armhf (10.45-1) ... 408s Selecting previously unselected package libpkgconf3:armhf. 408s Preparing to unpack .../45-libpkgconf3_1.8.1-4_armhf.deb ... 408s Unpacking libpkgconf3:armhf (1.8.1-4) ... 408s Selecting previously unselected package zlib1g-dev:armhf. 408s Preparing to unpack .../46-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_armhf.deb ... 408s Unpacking zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 408s Selecting previously unselected package libpng-dev:armhf. 408s Preparing to unpack .../47-libpng-dev_1.6.47-1_armhf.deb ... 408s Unpacking libpng-dev:armhf (1.6.47-1) ... 408s Selecting previously unselected package libreadline-dev:armhf. 408s Preparing to unpack .../48-libreadline-dev_8.2-6_armhf.deb ... 408s Unpacking libreadline-dev:armhf (8.2-6) ... 408s Selecting previously unselected package liblzma-dev:armhf. 408s Preparing to unpack .../49-liblzma-dev_5.6.4-1_armhf.deb ... 408s Unpacking liblzma-dev:armhf (5.6.4-1) ... 408s Selecting previously unselected package pkgconf-bin. 408s Preparing to unpack .../50-pkgconf-bin_1.8.1-4_armhf.deb ... 408s Unpacking pkgconf-bin (1.8.1-4) ... 408s Selecting previously unselected package pkgconf:armhf. 408s Preparing to unpack .../51-pkgconf_1.8.1-4_armhf.deb ... 408s Unpacking pkgconf:armhf (1.8.1-4) ... 408s Selecting previously unselected package libtirpc-dev:armhf. 408s Preparing to unpack .../52-libtirpc-dev_1.3.4+ds-1.3_armhf.deb ... 408s Unpacking libtirpc-dev:armhf (1.3.4+ds-1.3) ... 409s Selecting previously unselected package r-base-dev. 409s Preparing to unpack .../53-r-base-dev_4.4.3-1_all.deb ... 409s Unpacking r-base-dev (4.4.3-1) ... 409s Selecting previously unselected package pkg-r-autopkgtest. 409s Preparing to unpack .../54-pkg-r-autopkgtest_20231212ubuntu1_all.deb ... 409s Unpacking pkg-r-autopkgtest (20231212ubuntu1) ... 409s Setting up linux-libc-dev:armhf (6.14.0-10.10) ... 409s Setting up libpcre2-16-0:armhf (10.45-1) ... 409s Setting up libpcre2-32-0:armhf (10.45-1) ... 409s Setting up libtirpc-dev:armhf (1.3.4+ds-1.3) ... 409s Setting up libpkgconf3:armhf (1.8.1-4) ... 409s Setting up rpcsvc-proto (1.4.2-0ubuntu7) ... 409s Setting up libmpc3:armhf (1.3.1-1build2) ... 409s Setting up icu-devtools (76.1-1ubuntu2) ... 409s Setting up pkgconf-bin (1.8.1-4) ... 409s Setting up liblzma-dev:armhf (5.6.4-1) ... 409s Setting up libubsan1:armhf (15-20250222-0ubuntu1) ... 409s Setting up libpcre2-posix3:armhf (10.45-1) ... 409s Setting up libcrypt-dev:armhf (1:4.4.38-1) ... 409s Setting up libasan8:armhf (15-20250222-0ubuntu1) ... 409s Setting up libgcc-14-dev:armhf (14.2.0-17ubuntu3) ... 409s Setting up libisl23:armhf (0.27-1) ... 409s Setting up libc-dev-bin (2.41-1ubuntu2) ... 409s Setting up libdeflate-dev:armhf (1.23-1) ... 409s Setting up libcc1-0:armhf (15-20250222-0ubuntu1) ... 409s Setting up libblas-dev:armhf (3.12.1-2) ... 409s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so to provide /usr/lib/arm-linux-gnueabihf/libblas.so (libblas.so-arm-linux-gnueabihf) in auto mode 409s Setting up dctrl-tools (2.24-3build3) ... 409s Setting up cpp-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 409s Setting up libgfortran-14-dev:armhf (14.2.0-17ubuntu3) ... 409s Setting up gcc-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 409s Setting up pkgconf:armhf (1.8.1-4) ... 409s Setting up liblapack-dev:armhf (3.12.1-2) ... 409s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so to provide /usr/lib/arm-linux-gnueabihf/liblapack.so (liblapack.so-arm-linux-gnueabihf) in auto mode 409s Setting up cpp-14 (14.2.0-17ubuntu3) ... 409s Setting up libc6-dev:armhf (2.41-1ubuntu2) ... 409s Setting up libstdc++-14-dev:armhf (14.2.0-17ubuntu3) ... 409s Setting up libicu-dev:armhf (76.1-1ubuntu2) ... 409s Setting up cpp-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 409s Setting up gfortran-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 409s Setting up libbz2-dev:armhf (1.0.8-6) ... 409s Setting up gcc-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 409s Setting up g++-14-arm-linux-gnueabihf (14.2.0-17ubuntu3) ... 409s Setting up libjpeg-turbo8-dev:armhf (2.1.5-3ubuntu2) ... 409s Setting up libncurses-dev:armhf (6.5+20250216-2) ... 409s Setting up libpcre2-dev:armhf (10.45-1) ... 409s Setting up libreadline-dev:armhf (8.2-6) ... 409s Setting up gcc-14 (14.2.0-17ubuntu3) ... 409s Setting up gfortran-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 409s Setting up zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 409s Setting up cpp (4:14.2.0-1ubuntu1) ... 409s Setting up g++-14 (14.2.0-17ubuntu3) ... 409s Setting up libjpeg8-dev:armhf (8c-2ubuntu11) ... 409s Setting up gfortran-14 (14.2.0-17ubuntu3) ... 409s Setting up g++-arm-linux-gnueabihf (4:14.2.0-1ubuntu1) ... 409s Setting up libpng-dev:armhf (1.6.47-1) ... 409s Setting up libjpeg-dev:armhf (8c-2ubuntu11) ... 409s Setting up gcc (4:14.2.0-1ubuntu1) ... 409s Setting up g++ (4:14.2.0-1ubuntu1) ... 409s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 409s Setting up build-essential (12.10ubuntu1) ... 409s Setting up gfortran (4:14.2.0-1ubuntu1) ... 409s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 409s 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 409s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 409s 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 409s Setting up r-base-dev (4.4.3-1) ... 409s Setting up pkg-r-autopkgtest (20231212ubuntu1) ... 409s Processing triggers for libc-bin (2.41-1ubuntu2) ... 409s Processing triggers for man-db (2.13.0-1) ... 410s Processing triggers for install-info (7.1.1-1) ... 418s autopkgtest [16:04:09]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 418s autopkgtest [16:04:09]: test pkg-r-autopkgtest: [----------------------- 420s Test: Try to load the R library actuar 420s 420s R version 4.4.3 (2025-02-28) -- "Trophy Case" 420s Copyright (C) 2025 The R Foundation for Statistical Computing 420s Platform: arm-unknown-linux-gnueabihf (32-bit) 420s 420s R is free software and comes with ABSOLUTELY NO WARRANTY. 420s You are welcome to redistribute it under certain conditions. 420s Type 'license()' or 'licence()' for distribution details. 420s 420s R is a collaborative project with many contributors. 420s Type 'contributors()' for more information and 420s 'citation()' on how to cite R or R packages in publications. 420s 420s Type 'demo()' for some demos, 'help()' for on-line help, or 420s 'help.start()' for an HTML browser interface to help. 420s Type 'q()' to quit R. 420s 420s > library('actuar') 420s 420s Attaching package: ‘actuar’ 420s 420s The following objects are masked from ‘package:stats’: 420s 420s sd, var 420s 420s The following object is masked from ‘package:grDevices’: 420s 420s cm 420s 420s > 420s > 420s Other tests are currently unsupported! 420s They will be progressively added. 420s autopkgtest [16:04:11]: test pkg-r-autopkgtest: -----------------------] 425s autopkgtest [16:04:16]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 425s pkg-r-autopkgtest PASS 428s autopkgtest [16:04:19]: @@@@@@@@@@@@@@@@@@@@ summary 428s run-unit-test PASS 428s pkg-r-autopkgtest PASS