0s autopkgtest [15:13:33]: starting date and time: 2025-03-15 15:13:33+0000 0s autopkgtest [15:13:33]: git checkout: 325255d2 Merge branch 'pin-any-arch' into 'ubuntu/production' 0s autopkgtest [15:13:33]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.2iw_5ega/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:glibc --apt-upgrade r-cran-actuar --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=glibc/2.41-1ubuntu2 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@bos03-arm64-7.secgroup --name adt-plucky-arm64-r-cran-actuar-20250315-151333-juju-7f2275-prod-proposed-migration-environment-2-5be40fbf-9208-403a-92c2-e29185e254b4 --image adt/ubuntu-plucky-arm64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-proposed-migration -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 136s autopkgtest [15:15:49]: testbed dpkg architecture: arm64 136s autopkgtest [15:15:49]: testbed apt version: 2.9.33 136s autopkgtest [15:15:49]: @@@@@@@@@@@@@@@@@@@@ test bed setup 136s autopkgtest [15:15:49]: testbed release detected to be: None 137s autopkgtest [15:15:50]: updating testbed package index (apt update) 138s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [126 kB] 138s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 138s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 138s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 138s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.8 kB] 138s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [101 kB] 138s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [404 kB] 139s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 Packages [78.2 kB] 139s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 c-n-f Metadata [1976 B] 139s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/restricted arm64 c-n-f Metadata [116 B] 139s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/universe arm64 Packages [346 kB] 139s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/universe arm64 c-n-f Metadata [15.8 kB] 139s Get:13 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse arm64 Packages [4948 B] 139s Get:14 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse arm64 c-n-f Metadata [572 B] 139s Fetched 1094 kB in 2s (698 kB/s) 140s Reading package lists... 141s Reading package lists... 141s Building dependency tree... 141s Reading state information... 142s Calculating upgrade... 142s Calculating upgrade... 142s The following packages will be upgraded: 142s python3-jinja2 strace 142s 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 142s Need to get 608 kB of archives. 142s After this operation, 11.3 kB of additional disk space will be used. 142s Get:1 http://ftpmaster.internal/ubuntu plucky/main arm64 strace arm64 6.13+ds-1ubuntu1 [499 kB] 143s Get:2 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-jinja2 all 3.1.5-2ubuntu1 [109 kB] 144s Fetched 608 kB in 1s (729 kB/s) 144s (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 ... 117701 files and directories currently installed.) 144s Preparing to unpack .../strace_6.13+ds-1ubuntu1_arm64.deb ... 144s Unpacking strace (6.13+ds-1ubuntu1) over (6.11-0ubuntu1) ... 144s Preparing to unpack .../python3-jinja2_3.1.5-2ubuntu1_all.deb ... 144s Unpacking python3-jinja2 (3.1.5-2ubuntu1) over (3.1.5-2) ... 144s Setting up python3-jinja2 (3.1.5-2ubuntu1) ... 144s Setting up strace (6.13+ds-1ubuntu1) ... 144s Processing triggers for man-db (2.13.0-1) ... 145s Reading package lists... 145s Building dependency tree... 145s Reading state information... 146s Solving dependencies... 146s The following packages will be REMOVED: 146s libnsl2* libpython3.12-minimal* libpython3.12-stdlib* libpython3.12t64* 146s libunwind8* linux-headers-6.11.0-8* linux-headers-6.11.0-8-generic* 146s linux-image-6.11.0-8-generic* linux-modules-6.11.0-8-generic* 146s linux-tools-6.11.0-8* linux-tools-6.11.0-8-generic* 147s 0 upgraded, 0 newly installed, 11 to remove and 5 not upgraded. 147s After this operation, 267 MB disk space will be freed. 147s (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 ... 117701 files and directories currently installed.) 147s Removing linux-tools-6.11.0-8-generic (6.11.0-8.8) ... 147s Removing linux-tools-6.11.0-8 (6.11.0-8.8) ... 147s Removing libpython3.12t64:arm64 (3.12.9-1) ... 147s Removing libpython3.12-stdlib:arm64 (3.12.9-1) ... 147s Removing libnsl2:arm64 (1.3.0-3build3) ... 147s Removing libpython3.12-minimal:arm64 (3.12.9-1) ... 147s Removing libunwind8:arm64 (1.6.2-3.1) ... 147s Removing linux-headers-6.11.0-8-generic (6.11.0-8.8) ... 147s Removing linux-headers-6.11.0-8 (6.11.0-8.8) ... 149s Removing linux-image-6.11.0-8-generic (6.11.0-8.8) ... 149s I: /boot/vmlinuz.old is now a symlink to vmlinuz-6.14.0-10-generic 149s I: /boot/initrd.img.old is now a symlink to initrd.img-6.14.0-10-generic 149s /etc/kernel/postrm.d/initramfs-tools: 149s update-initramfs: Deleting /boot/initrd.img-6.11.0-8-generic 149s /etc/kernel/postrm.d/zz-flash-kernel: 149s flash-kernel: Kernel 6.11.0-8-generic has been removed. 149s flash-kernel: A higher version (6.14.0-10-generic) is still installed, no reflashing required. 149s /etc/kernel/postrm.d/zz-update-grub: 149s Sourcing file `/etc/default/grub' 149s Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg' 149s Generating grub configuration file ... 150s Found linux image: /boot/vmlinuz-6.14.0-10-generic 150s Found initrd image: /boot/initrd.img-6.14.0-10-generic 150s Warning: os-prober will not be executed to detect other bootable partitions. 150s Systems on them will not be added to the GRUB boot configuration. 150s Check GRUB_DISABLE_OS_PROBER documentation entry. 150s Adding boot menu entry for UEFI Firmware Settings ... 150s done 150s Removing linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 150s Processing triggers for libc-bin (2.41-1ubuntu1) ... 151s (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 ... 81650 files and directories currently installed.) 151s Purging configuration files for linux-image-6.11.0-8-generic (6.11.0-8.8) ... 151s Purging configuration files for libpython3.12-minimal:arm64 (3.12.9-1) ... 151s Purging configuration files for linux-modules-6.11.0-8-generic (6.11.0-8.8) ... 151s autopkgtest [15:16:04]: upgrading testbed (apt dist-upgrade and autopurge) 151s Reading package lists... 151s Building dependency tree... 151s Reading state information... 152s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 152s Starting 2 pkgProblemResolver with broken count: 0 152s Done 153s Entering ResolveByKeep 153s 153s Calculating upgrade... 154s The following packages will be upgraded: 154s libc-bin libc-dev-bin libc6 libc6-dev locales 154s 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 154s Need to get 9530 kB of archives. 154s After this operation, 0 B of additional disk space will be used. 154s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 libc6-dev arm64 2.41-1ubuntu2 [1750 kB] 155s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 libc-dev-bin arm64 2.41-1ubuntu2 [24.0 kB] 155s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 libc6 arm64 2.41-1ubuntu2 [2910 kB] 157s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 libc-bin arm64 2.41-1ubuntu2 [600 kB] 158s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 locales all 2.41-1ubuntu2 [4246 kB] 161s Preconfiguring packages ... 161s Fetched 9530 kB in 7s (1304 kB/s) 162s (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 ... 81647 files and directories currently installed.) 162s Preparing to unpack .../libc6-dev_2.41-1ubuntu2_arm64.deb ... 162s Unpacking libc6-dev:arm64 (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 162s Preparing to unpack .../libc-dev-bin_2.41-1ubuntu2_arm64.deb ... 162s Unpacking libc-dev-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 162s Preparing to unpack .../libc6_2.41-1ubuntu2_arm64.deb ... 162s Unpacking libc6:arm64 (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 162s Setting up libc6:arm64 (2.41-1ubuntu2) ... 162s (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 ... 81647 files and directories currently installed.) 162s Preparing to unpack .../libc-bin_2.41-1ubuntu2_arm64.deb ... 162s Unpacking libc-bin (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 162s Setting up libc-bin (2.41-1ubuntu2) ... 162s (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 ... 81647 files and directories currently installed.) 162s Preparing to unpack .../locales_2.41-1ubuntu2_all.deb ... 162s Unpacking locales (2.41-1ubuntu2) over (2.41-1ubuntu1) ... 163s Setting up locales (2.41-1ubuntu2) ... 163s Generating locales (this might take a while)... 165s en_US.UTF-8... done 165s Generation complete. 165s Setting up libc-dev-bin (2.41-1ubuntu2) ... 165s Setting up libc6-dev:arm64 (2.41-1ubuntu2) ... 165s Processing triggers for man-db (2.13.0-1) ... 166s Processing triggers for systemd (257.3-1ubuntu3) ... 167s Reading package lists... 168s Building dependency tree... 168s Reading state information... 168s Starting pkgProblemResolver with broken count: 0 168s Starting 2 pkgProblemResolver with broken count: 0 168s Done 168s Solving dependencies... 169s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 169s autopkgtest [15:16:22]: rebooting testbed after setup commands that affected boot 192s autopkgtest [15:16:45]: testbed running kernel: Linux 6.14.0-10-generic #10-Ubuntu SMP PREEMPT_DYNAMIC Wed Mar 12 15:45:31 UTC 2025 195s autopkgtest [15:16:48]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-actuar 198s Get:1 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (dsc) [2135 B] 198s Get:2 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (tar) [984 kB] 198s Get:3 http://ftpmaster.internal/ubuntu plucky/universe r-cran-actuar 3.3-5-1 (diff) [3424 B] 198s gpgv: Signature made Wed Jan 22 07:35:04 2025 UTC 198s gpgv: using RSA key 73471499CC60ED9EEE805946C5BD6C8F2295D502 198s gpgv: issuer "plessy@debian.org" 198s gpgv: Can't check signature: No public key 198s dpkg-source: warning: cannot verify inline signature for ./r-cran-actuar_3.3-5-1.dsc: no acceptable signature found 198s autopkgtest [15:16:51]: testing package r-cran-actuar version 3.3-5-1 199s autopkgtest [15:16:52]: build not needed 202s autopkgtest [15:16:55]: test run-unit-test: preparing testbed 202s Reading package lists... 203s Building dependency tree... 203s Reading state information... 203s Starting pkgProblemResolver with broken count: 0 203s Starting 2 pkgProblemResolver with broken count: 0 203s Done 204s The following NEW packages will be installed: 204s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono libblas3 204s libcairo2 libdatrie1 libdeflate0 libfontconfig1 libgfortran5 libgomp1 204s libgraphite2-3 libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 libjpeg8 204s liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 204s libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 libtcl8.6 204s libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 204s libxft2 libxrender1 libxss1 libxt6t64 r-base-core r-cran-actuar 204s r-cran-expint r-cran-mass unzip x11-common xdg-utils zip 204s 0 upgraded, 47 newly installed, 0 to remove and 0 not upgraded. 204s Need to get 41.1 MB of archives. 204s After this operation, 83.4 MB of additional disk space will be used. 204s Get:1 http://ftpmaster.internal/ubuntu plucky/main arm64 fonts-dejavu-mono all 2.37-8 [502 kB] 205s Get:2 http://ftpmaster.internal/ubuntu plucky/main arm64 fonts-dejavu-core all 2.37-8 [835 kB] 205s Get:3 http://ftpmaster.internal/ubuntu plucky/main arm64 fontconfig-config arm64 2.15.0-2ubuntu1 [37.5 kB] 205s Get:4 http://ftpmaster.internal/ubuntu plucky/main arm64 libfontconfig1 arm64 2.15.0-2ubuntu1 [144 kB] 205s Get:5 http://ftpmaster.internal/ubuntu plucky/main arm64 fontconfig arm64 2.15.0-2ubuntu1 [191 kB] 205s Get:6 http://ftpmaster.internal/ubuntu plucky/main arm64 libblas3 arm64 3.12.1-2 [161 kB] 205s Get:7 http://ftpmaster.internal/ubuntu plucky/main arm64 libpixman-1-0 arm64 0.44.0-3 [197 kB] 206s Get:8 http://ftpmaster.internal/ubuntu plucky/main arm64 libxcb-render0 arm64 1.17.0-2 [16.6 kB] 206s Get:9 http://ftpmaster.internal/ubuntu plucky/main arm64 libxcb-shm0 arm64 1.17.0-2 [5884 B] 206s Get:10 http://ftpmaster.internal/ubuntu plucky/main arm64 libxrender1 arm64 1:0.9.10-1.1build1 [18.8 kB] 206s Get:11 http://ftpmaster.internal/ubuntu plucky/main arm64 libcairo2 arm64 1.18.2-2 [560 kB] 206s Get:12 http://ftpmaster.internal/ubuntu plucky/main arm64 libdatrie1 arm64 0.2.13-3build1 [19.2 kB] 206s Get:13 http://ftpmaster.internal/ubuntu plucky/main arm64 libdeflate0 arm64 1.23-1 [46.2 kB] 206s Get:14 http://ftpmaster.internal/ubuntu plucky/main arm64 libgfortran5 arm64 15-20250222-0ubuntu1 [444 kB] 206s Get:15 http://ftpmaster.internal/ubuntu plucky/main arm64 libgomp1 arm64 15-20250222-0ubuntu1 [146 kB] 206s Get:16 http://ftpmaster.internal/ubuntu plucky/main arm64 libgraphite2-3 arm64 1.3.14-2ubuntu1 [70.6 kB] 206s Get:17 http://ftpmaster.internal/ubuntu plucky/main arm64 libharfbuzz0b arm64 10.2.0-1 [490 kB] 207s Get:18 http://ftpmaster.internal/ubuntu plucky/main arm64 x11-common all 1:7.7+23ubuntu3 [21.7 kB] 207s Get:19 http://ftpmaster.internal/ubuntu plucky/main arm64 libice6 arm64 2:1.1.1-1 [42.3 kB] 207s Get:20 http://ftpmaster.internal/ubuntu plucky/main arm64 libjpeg-turbo8 arm64 2.1.5-3ubuntu2 [165 kB] 207s Get:21 http://ftpmaster.internal/ubuntu plucky/main arm64 libjpeg8 arm64 8c-2ubuntu11 [2148 B] 207s Get:22 http://ftpmaster.internal/ubuntu plucky/main arm64 liblapack3 arm64 3.12.1-2 [2307 kB] 208s Get:23 http://ftpmaster.internal/ubuntu plucky/main arm64 liblerc4 arm64 4.0.0+ds-5ubuntu1 [167 kB] 208s Get:24 http://ftpmaster.internal/ubuntu plucky/main arm64 libthai-data all 0.1.29-2build1 [158 kB] 209s Get:25 http://ftpmaster.internal/ubuntu plucky/main arm64 libthai0 arm64 0.1.29-2build1 [18.2 kB] 209s Get:26 http://ftpmaster.internal/ubuntu plucky/main arm64 libpango-1.0-0 arm64 1.56.2-1 [237 kB] 209s Get:27 http://ftpmaster.internal/ubuntu plucky/main arm64 libpangoft2-1.0-0 arm64 1.56.2-1 [49.5 kB] 209s Get:28 http://ftpmaster.internal/ubuntu plucky/main arm64 libpangocairo-1.0-0 arm64 1.56.2-1 [27.6 kB] 209s Get:29 http://ftpmaster.internal/ubuntu plucky/main arm64 libpaper2 arm64 2.2.5-0.3 [17.3 kB] 209s Get:30 http://ftpmaster.internal/ubuntu plucky/main arm64 libpaper-utils arm64 2.2.5-0.3 [15.4 kB] 209s Get:31 http://ftpmaster.internal/ubuntu plucky/main arm64 libsharpyuv0 arm64 1.5.0-0.1 [16.9 kB] 209s Get:32 http://ftpmaster.internal/ubuntu plucky/main arm64 libsm6 arm64 2:1.2.4-1 [16.4 kB] 209s Get:33 http://ftpmaster.internal/ubuntu plucky/main arm64 libtcl8.6 arm64 8.6.16+dfsg-1 [987 kB] 209s Get:34 http://ftpmaster.internal/ubuntu plucky/main arm64 libjbig0 arm64 2.1-6.1ubuntu2 [29.3 kB] 210s Get:35 http://ftpmaster.internal/ubuntu plucky/main arm64 libwebp7 arm64 1.5.0-0.1 [194 kB] 210s Get:36 http://ftpmaster.internal/ubuntu plucky/main arm64 libtiff6 arm64 4.5.1+git230720-4ubuntu4 [193 kB] 210s Get:37 http://ftpmaster.internal/ubuntu plucky/main arm64 libxft2 arm64 2.3.6-1build1 [44.1 kB] 210s Get:38 http://ftpmaster.internal/ubuntu plucky/main arm64 libxss1 arm64 1:1.2.3-1build3 [7244 B] 210s Get:39 http://ftpmaster.internal/ubuntu plucky/main arm64 libtk8.6 arm64 8.6.16-1 [776 kB] 210s Get:40 http://ftpmaster.internal/ubuntu plucky/main arm64 libxt6t64 arm64 1:1.2.1-1.2build1 [168 kB] 210s Get:41 http://ftpmaster.internal/ubuntu plucky/main arm64 zip arm64 3.0-14ubuntu2 [173 kB] 211s Get:42 http://ftpmaster.internal/ubuntu plucky/main arm64 unzip arm64 6.0-28ubuntu6 [178 kB] 211s Get:43 http://ftpmaster.internal/ubuntu plucky/main arm64 xdg-utils all 1.2.1-2ubuntu1 [66.0 kB] 211s Get:44 http://ftpmaster.internal/ubuntu plucky/universe arm64 r-base-core arm64 4.4.3-1 [28.4 MB] 232s Get:45 http://ftpmaster.internal/ubuntu plucky/universe arm64 r-cran-expint arm64 0.1-8-1 [209 kB] 232s Get:46 http://ftpmaster.internal/ubuntu plucky/universe arm64 r-cran-actuar arm64 3.3-5-1 [1420 kB] 233s Get:47 http://ftpmaster.internal/ubuntu plucky/universe arm64 r-cran-mass arm64 7.3-64-1 [1110 kB] 234s Preconfiguring packages ... 234s Fetched 41.1 MB in 30s (1368 kB/s) 234s Selecting previously unselected package fonts-dejavu-mono. 235s (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 ... 81647 files and directories currently installed.) 235s Preparing to unpack .../00-fonts-dejavu-mono_2.37-8_all.deb ... 235s Unpacking fonts-dejavu-mono (2.37-8) ... 235s Selecting previously unselected package fonts-dejavu-core. 235s Preparing to unpack .../01-fonts-dejavu-core_2.37-8_all.deb ... 235s Unpacking fonts-dejavu-core (2.37-8) ... 235s Selecting previously unselected package fontconfig-config. 235s Preparing to unpack .../02-fontconfig-config_2.15.0-2ubuntu1_arm64.deb ... 235s Unpacking fontconfig-config (2.15.0-2ubuntu1) ... 235s Selecting previously unselected package libfontconfig1:arm64. 235s Preparing to unpack .../03-libfontconfig1_2.15.0-2ubuntu1_arm64.deb ... 235s Unpacking libfontconfig1:arm64 (2.15.0-2ubuntu1) ... 235s Selecting previously unselected package fontconfig. 235s Preparing to unpack .../04-fontconfig_2.15.0-2ubuntu1_arm64.deb ... 235s Unpacking fontconfig (2.15.0-2ubuntu1) ... 235s Selecting previously unselected package libblas3:arm64. 235s Preparing to unpack .../05-libblas3_3.12.1-2_arm64.deb ... 235s Unpacking libblas3:arm64 (3.12.1-2) ... 235s Selecting previously unselected package libpixman-1-0:arm64. 235s Preparing to unpack .../06-libpixman-1-0_0.44.0-3_arm64.deb ... 235s Unpacking libpixman-1-0:arm64 (0.44.0-3) ... 235s Selecting previously unselected package libxcb-render0:arm64. 235s Preparing to unpack .../07-libxcb-render0_1.17.0-2_arm64.deb ... 235s Unpacking libxcb-render0:arm64 (1.17.0-2) ... 235s Selecting previously unselected package libxcb-shm0:arm64. 235s Preparing to unpack .../08-libxcb-shm0_1.17.0-2_arm64.deb ... 235s Unpacking libxcb-shm0:arm64 (1.17.0-2) ... 235s Selecting previously unselected package libxrender1:arm64. 235s Preparing to unpack .../09-libxrender1_1%3a0.9.10-1.1build1_arm64.deb ... 235s Unpacking libxrender1:arm64 (1:0.9.10-1.1build1) ... 235s Selecting previously unselected package libcairo2:arm64. 235s Preparing to unpack .../10-libcairo2_1.18.2-2_arm64.deb ... 235s Unpacking libcairo2:arm64 (1.18.2-2) ... 235s Selecting previously unselected package libdatrie1:arm64. 235s Preparing to unpack .../11-libdatrie1_0.2.13-3build1_arm64.deb ... 235s Unpacking libdatrie1:arm64 (0.2.13-3build1) ... 235s Selecting previously unselected package libdeflate0:arm64. 235s Preparing to unpack .../12-libdeflate0_1.23-1_arm64.deb ... 235s Unpacking libdeflate0:arm64 (1.23-1) ... 235s Selecting previously unselected package libgfortran5:arm64. 235s Preparing to unpack .../13-libgfortran5_15-20250222-0ubuntu1_arm64.deb ... 235s Unpacking libgfortran5:arm64 (15-20250222-0ubuntu1) ... 236s Selecting previously unselected package libgomp1:arm64. 236s Preparing to unpack .../14-libgomp1_15-20250222-0ubuntu1_arm64.deb ... 236s Unpacking libgomp1:arm64 (15-20250222-0ubuntu1) ... 236s Selecting previously unselected package libgraphite2-3:arm64. 236s Preparing to unpack .../15-libgraphite2-3_1.3.14-2ubuntu1_arm64.deb ... 236s Unpacking libgraphite2-3:arm64 (1.3.14-2ubuntu1) ... 236s Selecting previously unselected package libharfbuzz0b:arm64. 236s Preparing to unpack .../16-libharfbuzz0b_10.2.0-1_arm64.deb ... 236s Unpacking libharfbuzz0b:arm64 (10.2.0-1) ... 236s Selecting previously unselected package x11-common. 236s Preparing to unpack .../17-x11-common_1%3a7.7+23ubuntu3_all.deb ... 236s Unpacking x11-common (1:7.7+23ubuntu3) ... 236s Selecting previously unselected package libice6:arm64. 236s Preparing to unpack .../18-libice6_2%3a1.1.1-1_arm64.deb ... 236s Unpacking libice6:arm64 (2:1.1.1-1) ... 236s Selecting previously unselected package libjpeg-turbo8:arm64. 236s Preparing to unpack .../19-libjpeg-turbo8_2.1.5-3ubuntu2_arm64.deb ... 236s Unpacking libjpeg-turbo8:arm64 (2.1.5-3ubuntu2) ... 236s Selecting previously unselected package libjpeg8:arm64. 236s Preparing to unpack .../20-libjpeg8_8c-2ubuntu11_arm64.deb ... 236s Unpacking libjpeg8:arm64 (8c-2ubuntu11) ... 236s Selecting previously unselected package liblapack3:arm64. 236s Preparing to unpack .../21-liblapack3_3.12.1-2_arm64.deb ... 236s Unpacking liblapack3:arm64 (3.12.1-2) ... 236s Selecting previously unselected package liblerc4:arm64. 236s Preparing to unpack .../22-liblerc4_4.0.0+ds-5ubuntu1_arm64.deb ... 236s Unpacking liblerc4:arm64 (4.0.0+ds-5ubuntu1) ... 236s Selecting previously unselected package libthai-data. 236s Preparing to unpack .../23-libthai-data_0.1.29-2build1_all.deb ... 236s Unpacking libthai-data (0.1.29-2build1) ... 236s Selecting previously unselected package libthai0:arm64. 236s Preparing to unpack .../24-libthai0_0.1.29-2build1_arm64.deb ... 236s Unpacking libthai0:arm64 (0.1.29-2build1) ... 236s Selecting previously unselected package libpango-1.0-0:arm64. 236s Preparing to unpack .../25-libpango-1.0-0_1.56.2-1_arm64.deb ... 236s Unpacking libpango-1.0-0:arm64 (1.56.2-1) ... 236s Selecting previously unselected package libpangoft2-1.0-0:arm64. 236s Preparing to unpack .../26-libpangoft2-1.0-0_1.56.2-1_arm64.deb ... 236s Unpacking libpangoft2-1.0-0:arm64 (1.56.2-1) ... 236s Selecting previously unselected package libpangocairo-1.0-0:arm64. 236s Preparing to unpack .../27-libpangocairo-1.0-0_1.56.2-1_arm64.deb ... 236s Unpacking libpangocairo-1.0-0:arm64 (1.56.2-1) ... 236s Selecting previously unselected package libpaper2:arm64. 236s Preparing to unpack .../28-libpaper2_2.2.5-0.3_arm64.deb ... 236s Unpacking libpaper2:arm64 (2.2.5-0.3) ... 236s Selecting previously unselected package libpaper-utils. 236s Preparing to unpack .../29-libpaper-utils_2.2.5-0.3_arm64.deb ... 236s Unpacking libpaper-utils (2.2.5-0.3) ... 236s Selecting previously unselected package libsharpyuv0:arm64. 236s Preparing to unpack .../30-libsharpyuv0_1.5.0-0.1_arm64.deb ... 236s Unpacking libsharpyuv0:arm64 (1.5.0-0.1) ... 236s Selecting previously unselected package libsm6:arm64. 236s Preparing to unpack .../31-libsm6_2%3a1.2.4-1_arm64.deb ... 236s Unpacking libsm6:arm64 (2:1.2.4-1) ... 236s Selecting previously unselected package libtcl8.6:arm64. 236s Preparing to unpack .../32-libtcl8.6_8.6.16+dfsg-1_arm64.deb ... 236s Unpacking libtcl8.6:arm64 (8.6.16+dfsg-1) ... 236s Selecting previously unselected package libjbig0:arm64. 237s Preparing to unpack .../33-libjbig0_2.1-6.1ubuntu2_arm64.deb ... 237s Unpacking libjbig0:arm64 (2.1-6.1ubuntu2) ... 237s Selecting previously unselected package libwebp7:arm64. 237s Preparing to unpack .../34-libwebp7_1.5.0-0.1_arm64.deb ... 237s Unpacking libwebp7:arm64 (1.5.0-0.1) ... 237s Selecting previously unselected package libtiff6:arm64. 237s Preparing to unpack .../35-libtiff6_4.5.1+git230720-4ubuntu4_arm64.deb ... 237s Unpacking libtiff6:arm64 (4.5.1+git230720-4ubuntu4) ... 237s Selecting previously unselected package libxft2:arm64. 237s Preparing to unpack .../36-libxft2_2.3.6-1build1_arm64.deb ... 237s Unpacking libxft2:arm64 (2.3.6-1build1) ... 237s Selecting previously unselected package libxss1:arm64. 237s Preparing to unpack .../37-libxss1_1%3a1.2.3-1build3_arm64.deb ... 237s Unpacking libxss1:arm64 (1:1.2.3-1build3) ... 237s Selecting previously unselected package libtk8.6:arm64. 237s Preparing to unpack .../38-libtk8.6_8.6.16-1_arm64.deb ... 237s Unpacking libtk8.6:arm64 (8.6.16-1) ... 237s Selecting previously unselected package libxt6t64:arm64. 237s Preparing to unpack .../39-libxt6t64_1%3a1.2.1-1.2build1_arm64.deb ... 237s Unpacking libxt6t64:arm64 (1:1.2.1-1.2build1) ... 237s Selecting previously unselected package zip. 237s Preparing to unpack .../40-zip_3.0-14ubuntu2_arm64.deb ... 237s Unpacking zip (3.0-14ubuntu2) ... 237s Selecting previously unselected package unzip. 237s Preparing to unpack .../41-unzip_6.0-28ubuntu6_arm64.deb ... 237s Unpacking unzip (6.0-28ubuntu6) ... 237s Selecting previously unselected package xdg-utils. 237s Preparing to unpack .../42-xdg-utils_1.2.1-2ubuntu1_all.deb ... 237s Unpacking xdg-utils (1.2.1-2ubuntu1) ... 237s Selecting previously unselected package r-base-core. 237s Preparing to unpack .../43-r-base-core_4.4.3-1_arm64.deb ... 237s Unpacking r-base-core (4.4.3-1) ... 237s Selecting previously unselected package r-cran-expint. 237s Preparing to unpack .../44-r-cran-expint_0.1-8-1_arm64.deb ... 237s Unpacking r-cran-expint (0.1-8-1) ... 237s Selecting previously unselected package r-cran-actuar. 237s Preparing to unpack .../45-r-cran-actuar_3.3-5-1_arm64.deb ... 237s Unpacking r-cran-actuar (3.3-5-1) ... 237s Selecting previously unselected package r-cran-mass. 237s Preparing to unpack .../46-r-cran-mass_7.3-64-1_arm64.deb ... 237s Unpacking r-cran-mass (7.3-64-1) ... 237s Setting up libgraphite2-3:arm64 (1.3.14-2ubuntu1) ... 237s Setting up libpixman-1-0:arm64 (0.44.0-3) ... 237s Setting up libsharpyuv0:arm64 (1.5.0-0.1) ... 237s Setting up liblerc4:arm64 (4.0.0+ds-5ubuntu1) ... 237s Setting up libxrender1:arm64 (1:0.9.10-1.1build1) ... 237s Setting up libdatrie1:arm64 (0.2.13-3build1) ... 237s Setting up libxcb-render0:arm64 (1.17.0-2) ... 237s Setting up unzip (6.0-28ubuntu6) ... 237s Setting up x11-common (1:7.7+23ubuntu3) ... 238s Setting up libdeflate0:arm64 (1.23-1) ... 238s Setting up libxcb-shm0:arm64 (1.17.0-2) ... 238s Setting up libgomp1:arm64 (15-20250222-0ubuntu1) ... 238s Setting up libjbig0:arm64 (2.1-6.1ubuntu2) ... 238s Setting up zip (3.0-14ubuntu2) ... 238s Setting up libblas3:arm64 (3.12.1-2) ... 238s update-alternatives: using /usr/lib/aarch64-linux-gnu/blas/libblas.so.3 to provide /usr/lib/aarch64-linux-gnu/libblas.so.3 (libblas.so.3-aarch64-linux-gnu) in auto mode 238s Setting up fonts-dejavu-mono (2.37-8) ... 238s Setting up libtcl8.6:arm64 (8.6.16+dfsg-1) ... 238s Setting up fonts-dejavu-core (2.37-8) ... 238s Setting up libjpeg-turbo8:arm64 (2.1.5-3ubuntu2) ... 238s Setting up libgfortran5:arm64 (15-20250222-0ubuntu1) ... 238s Setting up libwebp7:arm64 (1.5.0-0.1) ... 238s Setting up libharfbuzz0b:arm64 (10.2.0-1) ... 238s Setting up libthai-data (0.1.29-2build1) ... 238s Setting up libxss1:arm64 (1:1.2.3-1build3) ... 238s Setting up libpaper2:arm64 (2.2.5-0.3) ... 238s Setting up xdg-utils (1.2.1-2ubuntu1) ... 238s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 238s Setting up libjpeg8:arm64 (8c-2ubuntu11) ... 238s Setting up libice6:arm64 (2:1.1.1-1) ... 238s Setting up liblapack3:arm64 (3.12.1-2) ... 238s update-alternatives: using /usr/lib/aarch64-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/aarch64-linux-gnu/liblapack.so.3 (liblapack.so.3-aarch64-linux-gnu) in auto mode 238s Setting up fontconfig-config (2.15.0-2ubuntu1) ... 239s Setting up libpaper-utils (2.2.5-0.3) ... 239s Setting up libthai0:arm64 (0.1.29-2build1) ... 239s Setting up libtiff6:arm64 (4.5.1+git230720-4ubuntu4) ... 239s Setting up libfontconfig1:arm64 (2.15.0-2ubuntu1) ... 239s Setting up libsm6:arm64 (2:1.2.4-1) ... 239s Setting up fontconfig (2.15.0-2ubuntu1) ... 241s Regenerating fonts cache... done. 241s Setting up libxft2:arm64 (2.3.6-1build1) ... 241s Setting up libtk8.6:arm64 (8.6.16-1) ... 241s Setting up libpango-1.0-0:arm64 (1.56.2-1) ... 241s Setting up libcairo2:arm64 (1.18.2-2) ... 241s Setting up libxt6t64:arm64 (1:1.2.1-1.2build1) ... 241s Setting up libpangoft2-1.0-0:arm64 (1.56.2-1) ... 241s Setting up libpangocairo-1.0-0:arm64 (1.56.2-1) ... 241s Setting up r-base-core (4.4.3-1) ... 241s Creating config file /etc/R/Renviron with new version 241s Setting up r-cran-mass (7.3-64-1) ... 241s Setting up r-cran-expint (0.1-8-1) ... 241s Setting up r-cran-actuar (3.3-5-1) ... 241s Processing triggers for man-db (2.13.0-1) ... 242s Processing triggers for install-info (7.1.1-1) ... 242s Processing triggers for libc-bin (2.41-1ubuntu2) ... 244s autopkgtest [15:17:37]: test run-unit-test: [----------------------- 244s BEGIN TEST betaint-tests.R 244s 244s R version 4.4.3 (2025-02-28) -- "Trophy Case" 244s Copyright (C) 2025 The R Foundation for Statistical Computing 244s Platform: aarch64-unknown-linux-gnu 244s 244s R is free software and comes with ABSOLUTELY NO WARRANTY. 244s You are welcome to redistribute it under certain conditions. 244s Type 'license()' or 'licence()' for distribution details. 244s 244s R is a collaborative project with many contributors. 244s Type 'contributors()' for more information and 244s 'citation()' on how to cite R or R packages in publications. 244s 244s Type 'demo()' for some demos, 'help()' for on-line help, or 244s 'help.start()' for an HTML browser interface to help. 244s Type 'q()' to quit R. 244s 244s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 244s > ### 244s > ### Tests for the "beta integral" 244s > ### 244s > ### B(a, b; x) = Gamma(a + b) int_0^x t^(a-1) (1 - t)^(b-1) dt 244s > ### 244s > ### Inspired by (and some parts taken from) `tests/d-p-q-r-tests.R` in 244s > ### R sources. 244s > ### 244s > ### AUTHOR: Vincent Goulet with 244s > ### indirect help from the R Core Team 244s > 244s > ## Load the package 244s > library(actuar) 244s 244s Attaching package: ‘actuar’ 244s 244s The following objects are masked from ‘package:stats’: 244s 244s sd, var 244s 244s The following object is masked from ‘package:grDevices’: 244s 244s cm 244s 244s Warning messages: 244s 1: In betaint(0.3, 0, 2) : NaNs produced 244s 2: In betaint(0.3, 2, -2.2) : NaNs produced 244s 3: In betaint(0.3, 2, 0) : NaNs produced 244s > 244s > ## Define a "local" version of the otherwise non-exported function 244s > ## 'betaint'. 244s > betaint <- actuar:::betaint 244s > 244s > ## Special values and utilities. Taken from `tests/d-p-q-r-tests.R`. 244s > xMax <- 1 - .Machine$double.eps 244s > xMin <- .Machine$double.xmin 244s > All.eq <- function(x, y) 244s + { 244s + all.equal.numeric(x, y, tolerance = 64 * .Machine$double.eps, 244s + scale = max(0, mean(abs(x), na.rm = TRUE))) 244s + } 244s > 244s > if(!interactive()) 244s + set.seed(123) 244s > 244s > ## Limiting cases 244s > stopifnot(exprs = { 244s + !is.finite(betaint(0.3, Inf, 2)) 244s + !is.finite(betaint(0.3, Inf, -2.2)) 244s + is.nan (betaint(0.3, 0, 2)) 244s + !is.finite(betaint(0.3, 2, Inf)) 244s + is.nan (betaint(0.3, 2, -2.2)) # a <= 1 + floor(-b) 244s + is.nan (betaint(0.3, 2, 0)) 244s + }) 244s > 244s > ## Tests for cases with b > 0 244s > x <- c(xMin, runif(10), xMax) 244s > b <- 2 244s > for (a in rlnorm(5, 2)) 244s + stopifnot(exprs = { 244s + All.eq(betaint(x, a, b), 244s + gamma(a) * gamma(b) * pbeta(x, a, b)) 244s + }) 244s > 244s > ## Tests for cases with b < 0 244s > b <- -2.2 244s > r <- floor(-b) # r = 2 244s > for (a in 1 + r + rlnorm(5, 2)) 244s + { 244s + s <- (x^(a-1) * (1-x)^b)/b + 244s + ((a-1) * x^(a-2) * (1-x)^(b+1))/(b * (b+1)) + 244s + ((a-1) * (a-2) * x^(a-3) * (1-x)^(b+2))/(b * (b+1) * (b+2)) 244s + stopifnot(exprs = { 244s + all.equal(betaint(x, a, b), 244s + -gamma(a+b) * s + 244s + (a-1)*(a-2)*(a-3) * gamma(a-r-1)/(b*(b+1)*(b+2)) * 244s + gamma(b+r+1)*pbeta(x, a-r-1, b+r+1)) 244s + }) 244s + } 244s > 244s BEGIN TEST dpqr-tests.R 244s 244s R version 4.4.3 (2025-02-28) -- "Trophy Case" 244s Copyright (C) 2025 The R Foundation for Statistical Computing 244s Platform: aarch64-unknown-linux-gnu 244s 244s R is free software and comes with ABSOLUTELY NO WARRANTY. 244s You are welcome to redistribute it under certain conditions. 244s Type 'license()' or 'licence()' for distribution details. 244s 244s R is a collaborative project with many contributors. 244s Type 'contributors()' for more information and 244s 'citation()' on how to cite R or R packages in publications. 244s 244s Type 'demo()' for some demos, 'help()' for on-line help, or 244s 'help.start()' for an HTML browser interface to help. 244s Type 'q()' to quit R. 244s 244s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 244s > ### 244s > ### Tests of functions for continuous and discrete probability 244s > ### distributions. 244s > ### 244s > ### Despite the name of the file, the tests are for [dpqrm,lev] 244s > ### functions (for continuous distributions): 244s > ### 244s > ### d: density or probability mass 244s > ### p: cumulative distribution 244s > ### q: quantile 244s > ### r: random number generation 244s > ### m: moment 244s > ### lev: limited moment 244s > ### 244s > ### Distributions are classified and sorted as in appendix A and 244s > ### appendix B of the 'distributions' package vignette. 244s > ### 244s > ### Inspired by (and some parts taken from) `tests/d-p-q-r-tests.R` in 244s > ### R sources. 244s > ### 244s > ### AUTHOR: Vincent Goulet with 244s > ### indirect help from the R Core Team 244s > 244s > ## Load the package 244s > library(actuar) 244s 244s Attaching package: ‘actuar’ 244s 244s The following objects are masked from ‘package:stats’: 244s 244s sd, var 244s 244s The following object is masked from ‘package:grDevices’: 244s 244s cm 244s 244s > library(expint) # for gammainc 244s > 244s > ## Define a "local" version of the otherwise non-exported function 244s > ## 'betaint'. 244s > betaint <- actuar:::betaint 244s > 244s > ## No warnings, unless explicitly asserted via tools::assertWarning. 244s > options(warn = 2) 244s > assertWarning <- tools::assertWarning 244s > 244s > ## Special values and utilities. Taken from `tests/d-p-q-r-tests.R`. 244s > Meps <- .Machine$double.eps 244s > xMax <- .Machine$double.xmax 244s > xMin <- .Machine$double.xmin 244s > All.eq <- function(x, y) 244s + { 244s + all.equal.numeric(x, y, tolerance = 64 * .Machine$double.eps, 244s + scale = max(0, mean(abs(x), na.rm = TRUE))) 244s + } 244s > 244s > if(!interactive()) 244s + set.seed(123) 244s > 244s > ### 244s > ### CONTINUOUS DISTRIBUTIONS 244s > ### 244s > 244s > ## 244s > ## FELLER-PARETO AND PARETO II, III, IV DISTRIBUTIONS 244s > ## 244s > 244s > ## When reasonable, we also test consistency with the special cases 244s > ## min = 0: 244s > ## 244s > ## Feller-Pareto -> Transformated beta 244s > ## Pareto IV -> Burr 244s > ## Pareto III -> Loglogistic 244s > ## Pareto II -> Pareto 244s > 244s > ## Density: first check that functions return 0 when scale = Inf, and 244s > ## when x = scale = Inf. 244s > stopifnot(exprs = { 244s + dfpareto(c(42, Inf), min = 1, shape1 = 2, shape2 = 3, shape3 = 4, scale = Inf) == c(0, 0) 244s + dpareto4(c(42, Inf), min = 1, shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 244s + dpareto3(c(42, Inf), min = 1, shape = 3, scale = Inf) == c(0, 0) 244s + dpareto2(c(42, Inf), min = 1, shape = 2, scale = Inf) == c(0, 0) 244s + }) 244s > 244s > ## Next test density functions for an array of standard values. 244s > nshpar <- 3 # (maximum) number of shape parameters 244s > min <- round(rnorm(30, 2), 2) 244s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 244s > scpar <- rlnorm(30, 2) # scale parameters 244s > for (i in seq_along(min)) 244s + { 244s + m <- min[i] 244s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 244s + Be <- beta(a, t) 244s + for (s in scpar) 244s + { 244s + x <- rfpareto(100, min = m, shape1 = a, shape2 = g, shape3 = t, scale = s) 244s + y <- (x - m)/s 244s + u <- 1/(1 + y^(-g)) 244s + stopifnot(exprs = { 244s + all.equal(d1 <- dfpareto(x, min = m, 244s + shape1 = a, shape2 = g, shape3 = t, 244s + scale = s), 244s + d2 <- dfpareto(y, min = 0, 244s + shape1 = a, shape2 = g, shape3 = t, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d2, 244s + dtrbeta(y, 244s + shape1 = a, shape2 = g, shape3 = t, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + g * y^(g*t - 1)/(s * Be * (1 + y^g)^(a + t)), 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + g * u^t * (1 - u)^a/((x - m) * Be), 244s + tolerance = 1e-10) 244s + }) 244s + x <- rpareto4(100, min = m, shape1 = a, shape2 = g, scale = s) 244s + y <- (x - m)/s 244s + u <- 1/(1 + y^g) 244s + stopifnot(exprs = { 244s + all.equal(d1 <- dpareto4(x, min = m, 244s + shape1 = a, shape2 = g, 244s + scale = s), 244s + d2 <- dpareto4(y, min = 0, 244s + shape1 = a, shape2 = g, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d2, 244s + dburr(y, 244s + shape1 = a, shape2 = g, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + a * g * y^(g - 1)/(s * (1 + y^g)^(a + 1)), 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + a * g * u^a * (1 - u)/(x - m), 244s + tolerance = 1e-10) 244s + }) 244s + x <- rpareto3(100, min = m, shape = g, scale = s) 244s + y <- (x - m)/s 244s + u <- 1/(1 + y^(-g)) 244s + stopifnot(exprs = { 244s + all.equal(d1 <- dpareto3(x, min = m, 244s + shape = g, 244s + scale = s), 244s + d2 <- dpareto3(y, min = 0, 244s + shape = g, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d2, 244s + dllogis(y, 244s + shape = g, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + g * y^(g - 1)/(s * (1 + y^g)^2), 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + g * u * (1 - u)/(x - m), 244s + tolerance = 1e-10) 244s + }) 244s + x <- rpareto2(100, min = m, shape = a, scale = s) 244s + y <- (x - m)/s 244s + u <- 1/(1 + y) 244s + stopifnot(exprs = { 244s + all.equal(d1 <- dpareto2(x, min = m, 244s + shape = a, 244s + scale = s), 244s + d2 <- dpareto2(y, min = 0, 244s + shape = a, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d2, 244s + dpareto(y, 244s + shape = a, 244s + scale = 1)/s, 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + a/(s * (1 + y)^(a + 1)), 244s + tolerance = 1e-10) 244s + all.equal(d1, 244s + a * u^a * (1 - u)/(x - m), 244s + tolerance = 1e-10) 244s + }) 244s + } 244s + } 245s > 245s > ## Tests on the cumulative distribution function. 245s > ## 245s > ## Note: when shape1 = shape3 = 1, the underlying beta distribution is 245s > ## a uniform. Therefore, pfpareto(x, min, 1, shape2, 1, scale) should 245s > ## return the value of u = v/(1 + v), v = ((x - min)/scale)^shape2. 245s > ## 245s > ## x = 2/Meps = 2^53 (with min = 0, shape2 = scale = 1) is the value 245s > ## where the cdf would jump to 1 if we weren't using the trick to 245s > ## compute the cdf with pbeta(1 - u, ..., lower = FALSE). 245s > scLrg <- 1e300 * c(0.5, 1, 2) 245s > m <- rnorm(1) 245s > stopifnot(exprs = { 245s + pfpareto(Inf, min = 10, 1, 2, 3, scale = xMax) == 1 245s + pfpareto(2^53, min = 0, 1, 1, 1, scale = 1) != 1 245s + pfpareto(2^53 + xMax, min = xMax, 1, 1, 1, scale = 1) != 1 245s + all.equal(pfpareto(xMin + m, min = m, 1, 1, 1, scale = 1), xMin) 245s + all.equal(y <- pfpareto(1e300 + m, min = m, 245s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 245s + shape3 = 1, 245s + scale = scLrg, log = TRUE), 245s + ptrbeta(1e300, 245s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 245s + shape3 = 1, 245s + scale = scLrg, log = TRUE)) 245s + all.equal(y, 245s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 245s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE), 245s + pbeta(c(4/5, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 245s + pbeta(4/5, 3, 1, lower.tail = FALSE, log = TRUE))) 245s + }) 245s > stopifnot(exprs = { 245s + ppareto4(Inf, min = 10, 1, 3, scale = xMax) == 1 245s + ppareto4(2^53, min = 0, 1, 1, scale = 1) != 1 245s + ppareto4(2^53 + xMax, min = xMax, 1, 1, scale = 1) != 1 245s + all.equal(ppareto4(xMin + m, min = m, 1, 1, scale = 1), xMin) 245s + all.equal(y <- ppareto4(1e300 + m, min = m, 245s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 245s + scale = scLrg, log = TRUE), 245s + pburr(1e300, 245s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 246s + scale = scLrg, log = TRUE)) 246s + all.equal(y, 246s + c(log(1 - c(1/3, 1/2, 2/3)^3), 246s + log(1 - c(1/5, 1/2, 4/5)^3))) 246s + }) 246s > stopifnot(exprs = { 246s + ppareto3(Inf, min = 10, 3, scale = xMax) == 1 246s + ppareto3(2^53, min = 0, 1, scale = 1) != 1 246s + ppareto3(2^53 + xMax, min = xMax, 1, scale = 1) != 1 246s + all.equal(ppareto3(xMin + m, min = m, 1, scale = 1), xMin) 246s + all.equal(y <- ppareto3(1e300 + m, min = m, 246s + shape = rep(c(1, 2), each = length(scLrg)), 246s + scale = scLrg, log = TRUE), 246s + pllogis (1e300, 246s + shape = rep(c(1, 2), each = length(scLrg)), 246s + scale = scLrg, log = TRUE)) 246s + all.equal(y, 246s + c(log(c(2/3, 1/2, 1/3)), 246s + log(c(4/5, 1/2, 1/5)))) 246s + }) 246s > stopifnot(exprs = { 246s + ppareto2(Inf, min = 10, 3, scale = xMax) == 1 246s + ppareto2(2^53, min = 0, 1, scale = 1) != 1 246s + ppareto2(2^53 + xMax, min = xMax, 1, scale = 1) != 1 246s + all.equal(ppareto2(xMin + m, min = m, 1, scale = 1), xMin) 246s + all.equal(y <- ppareto2(1e300 + m, min = m, 246s + shape = 3, 246s + scale = scLrg, log = TRUE), 246s + ppareto (1e300, 246s + shape = 3, 246s + scale = scLrg, log = TRUE)) 246s + all.equal(y, 246s + c(log(1 - c(1/3, 1/2, 2/3)^3))) 246s + }) 246s > 246s > ## Also check that distribution functions return 0 when scale = Inf. 246s > stopifnot(exprs = { 246s + pfpareto(x, min = m, shape1 = a, shape2 = g, shape3 = t, scale = Inf) == 0 246s + ppareto4(x, min = m, shape1 = a, shape2 = g, scale = Inf) == 0 246s + ppareto3(x, min = m, shape = g, scale = Inf) == 0 246s + ppareto2(x, min = m, shape = a, scale = Inf) == 0 246s + }) 246s > 246s > ## Tests for first three (positive) moments 246s > ## 246s > ## Simulation of new parameters ensuring that the first three moments 246s > ## exist. 246s > set.seed(123) # reset the seed 246s > nshpar <- 3 # (maximum) number of shape parameters 246s > min <- round(rnorm(30, 2), 2) 246s > shpar <- replicate(30, c(3, 3, 0) + rlnorm(nshpar, 2), simplify = FALSE) 246s > scpar <- rlnorm(30, 2) # scale parameters 246s > for (i in seq_along(min)) 246s + { 246s + m <- min[i] 246s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 246s + Be <- beta(a, t) 246s + Ga <- gamma(a) 246s + for (s in scpar) 246s + { 246s + stopifnot(exprs = { 246s + All.eq(mfpareto(1, min = m, 246s + shape1 = a, shape2 = g, shape3 = t, 246s + scale = s), 246s + m * (Be + (s/m) * beta(t + 1/g, a - 1/g))/Be) 246s + All.eq(mfpareto(2, min = m, 246s + shape1 = a, shape2 = g, shape3 = t, 246s + scale = s), 246s + m^2 * (Be + 2 * (s/m) * beta(t + 1/g, a - 1/g) 246s + + (s/m)^2 * beta(t + 2/g, a - 2/g))/Be) 246s + All.eq(mfpareto(3, min = m, 246s + shape1 = a, shape2 = g, shape3 = t, 246s + scale = s), 246s + m^3 * (Be + 3 * (s/m) * beta(t + 1/g, a - 1/g) 246s + + 3 * (s/m)^2 * beta(t + 2/g, a - 2/g) 246s + + (s/m)^3 * beta(t + 3/g, a - 3/g))/Be) 246s + }) 246s + stopifnot(exprs = { 246s + All.eq(mpareto4(1, min = m, 246s + shape1 = a, shape2 = g, 246s + scale = s), 246s + m * (Ga + (s/m) * gamma(1 + 1/g) * gamma(a - 1/g))/Ga) 246s + All.eq(mpareto4(2, min = m, 246s + shape1 = a, shape2 = g, 246s + scale = s), 246s + m^2 * (Ga + 2 * (s/m) * gamma(1 + 1/g) * gamma(a - 1/g) 246s + + (s/m)^2 * gamma(1 + 2/g) * gamma(a - 2/g))/Ga) 246s + All.eq(mpareto4(3, min = m, 246s + shape1 = a, shape2 = g, 246s + scale = s), 246s + m^3 * (Ga + 3 * (s/m) * gamma(1 + 1/g) * gamma(a - 1/g) 246s + + 3 * (s/m)^2 * gamma(1 + 2/g) * gamma(a - 2/g) 246s + + (s/m)^3 * gamma(1 + 3/g) * gamma(a - 3/g))/Ga) 246s + }) 246s + stopifnot(exprs = { 246s + All.eq(mpareto3(1, min = m, 246s + shape = g, 246s + scale = s), 246s + m * (1 + (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g))) 246s + All.eq(mpareto3(2, min = m, 246s + shape = g, 246s + scale = s), 246s + m^2 * (1 + 2 * (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g) 246s + + (s/m)^2 * gamma(1 + 2/g) * gamma(1 - 2/g))) 246s + All.eq(mpareto3(3, min = m, 246s + shape = g, 246s + scale = s), 246s + m^3 * (1 + 3 * (s/m) * gamma(1 + 1/g) * gamma(1 - 1/g) 246s + + 3 * (s/m)^2 * gamma(1 + 2/g) * gamma(1 - 2/g) 246s + + (s/m)^3 * gamma(1 + 3/g) * gamma(1 - 3/g))) 246s + }) 246s + stopifnot(exprs = { 246s + All.eq(mpareto2(1, min = m, 246s + shape = a, 246s + scale = s), 246s + m * (Ga + (s/m) * gamma(1 + 1) * gamma(a - 1))/Ga) 246s + All.eq(mpareto2(2, min = m, 246s + shape = a, 246s + scale = s), 246s + m^2 * (Ga + 2 * (s/m) * gamma(1 + 1) * gamma(a - 1) 246s + + (s/m)^2 * gamma(1 + 2) * gamma(a - 2))/Ga) 246s + All.eq(mpareto2(3, min = m, 246s + shape = a, 246s + scale = s), 246s + m^3 * (Ga + 3 * (s/m) * gamma(1 + 1) * gamma(a - 1) 246s + + 3 * (s/m)^2 * gamma(1 + 2) * gamma(a - 2) 246s + + (s/m)^3 * gamma(1 + 3) * gamma(a - 3))/Ga) 246s + }) 246s + } 246s + } 246s > 246s > ## Tests for first three limited moments 246s > ## 246s > ## Limits are taken from quantiles of each distribution. 246s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) 246s > for (i in seq_along(min)) 246s + { 246s + m <- min[i] 246s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 246s + Ga <- gamma(a) 246s + Gt <- gamma(t) 246s + for (s in scpar) 246s + { 246s + limit <- qfpareto(q, min = m, 246s + shape1 = a, shape2 = g, shape3 = t, 246s + scale = s) 246s + y <- (limit - m)/s 246s + u <- 1/(1 + y^(-g)) 246s + stopifnot(exprs = { 246s + All.eq(levfpareto(limit, order = 1, min = m, 246s + shape1 = a, shape2 = g, shape3 = t, 246s + scale = s), 246s + m * (betaint(u, t, a) + (s/m) * betaint(u, t + 1/g, a - 1/g))/(Ga * Gt) + 246s + limit * pbeta(u, t, a, lower = FALSE)) 246s + All.eq(levfpareto(limit, order = 2, min = m, 246s + shape1 = a, shape2 = g, shape3 = t, 246s + scale = s), 246s + m^2 * (betaint(u, t, a) + 2 * (s/m) * betaint(u, t + 1/g, a - 1/g) 246s + + (s/m)^2 * betaint(u, t + 2/g, a - 2/g))/(Ga * Gt) + 246s + limit^2 * pbeta(u, t, a, lower = FALSE)) 246s + All.eq(levfpareto(limit, order = 3, min = m, 246s + shape1 = a, shape2 = g, shape3 = t, 246s + scale = s), 246s + m^3 * (betaint(u, t, a) + 3 * (s/m) * betaint(u, t + 1/g, a - 1/g) 246s + + 3 * (s/m)^2 * betaint(u, t + 2/g, a - 2/g) 246s + + (s/m)^3 * betaint(u, t + 3/g, a - 3/g))/(Ga * Gt) + 246s + limit^3 * pbeta(u, t, a, lower = FALSE)) 246s + }) 246s + limit <- qpareto4(q, min = m, 246s + shape1 = a, shape2 = g, 246s + scale = s) 246s + y <- (limit - m)/s 246s + u <- 1/(1 + y^g) 246s + u1m <- 1/(1 + y^(-g)) 246s + stopifnot(exprs = { 246s + All.eq(levpareto4(limit, order = 1, min = m, 246s + shape1 = a, shape2 = g, 246s + scale = s), 246s + m * (betaint(u1m, 1, a) + (s/m) * betaint(u1m, 1 + 1/g, a - 1/g))/Ga + 246s + limit * u^a) 246s + All.eq(levpareto4(limit, order = 2, min = m, 246s + shape1 = a, shape2 = g, 246s + scale = s), 246s + m^2 * (betaint(u1m, 1, a) + 2 * (s/m) * betaint(u1m, 1 + 1/g, a - 1/g) 246s + + (s/m)^2 * betaint(u1m, 1 + 2/g, a - 2/g))/Ga + 246s + limit^2 * u^a) 246s + All.eq(levpareto4(limit, order = 3, min = m, 246s + shape1 = a, shape2 = g, 246s + scale = s), 246s + m^3 * (betaint(u1m, 1, a) + 3 * (s/m) * betaint(u1m, 1 + 1/g, a - 1/g) 246s + + 3 * (s/m)^2 * betaint(u1m, 1 + 2/g, a - 2/g) 246s + + (s/m)^3 * betaint(u1m, 1 + 3/g, a - 3/g))/Ga + 246s + limit^3 * u^a) 246s + }) 246s + limit <- qpareto3(q, min = m, 246s + shape = g, 246s + scale = s) 246s + y <- (limit - m)/s 246s + u <- 1/(1 + y^(-g)) 246s + u1m <- 1/(1 + y^g) 246s + stopifnot(exprs = { 246s + All.eq(levpareto3(limit, order = 1, min = m, 246s + shape = g, 246s + scale = s), 246s + m * (u + (s/m) * betaint(u, 1 + 1/g, 1 - 1/g)) + 246s + limit * u1m) 246s + All.eq(levpareto3(limit, order = 2, min = m, 246s + shape = g, 246s + scale = s), 246s + m^2 * (u + 2 * (s/m) * betaint(u, 1 + 1/g, 1 - 1/g) 246s + + (s/m)^2 * betaint(u, 1 + 2/g, 1 - 2/g)) + 246s + limit^2 * u1m) 246s + All.eq(levpareto3(limit, order = 3, min = m, 246s + shape = g, 246s + scale = s), 246s + m^3 * (u + 3 * (s/m) * betaint(u, 1 + 1/g, 1 - 1/g) 246s + + 3 * (s/m)^2 * betaint(u, 1 + 2/g, 1 - 2/g) 246s + + (s/m)^3 * betaint(u, 1 + 3/g, 1 - 3/g)) + 246s + limit^3 * u1m) 246s + }) 246s + limit <- qpareto2(q, min = m, 246s + shape = a, 246s + scale = s) 246s + y <- (limit - m)/s 246s + u <- 1/(1 + y) 246s + u1m <- 1/(1 + y^(-1)) 246s + stopifnot(exprs = { 246s + All.eq(levpareto2(limit, order = 1, min = m, 246s + shape = a, 246s + scale = s), 246s + m * (betaint(u1m, 1, a) + (s/m) * betaint(u1m, 1 + 1, a - 1))/Ga + 246s + limit * u^a) 246s + All.eq(levpareto2(limit, order = 2, min = m, 246s + shape = a, 246s + scale = s), 246s + m^2 * (betaint(u1m, 1, a) + 2 * (s/m) * betaint(u1m, 1 + 1, a - 1) 246s + + (s/m)^2 * betaint(u1m, 1 + 2, a - 2))/Ga + 246s + limit^2 * u^a) 246s + All.eq(levpareto2(limit, order = 3, min = m, 246s + shape = a, 246s + scale = s), 246s + m^3 * (betaint(u1m, 1, a) + 3 * (s/m) * betaint(u1m, 1 + 1, a - 1) 246s + + 3 * (s/m)^2 * betaint(u1m, 1 + 2, a - 2) 246s + + (s/m)^3 * betaint(u1m, 1 + 3, a - 3))/Ga + 246s + limit^3 * u^a) 246s + }) 246s + } 246s + } 247s > 247s > ## 247s > ## TRANSFORMED BETA FAMILY 247s > ## 247s > 247s > ## Density: first check that functions return 0 when scale = Inf, and 247s > ## when x = scale = Inf. 247s > stopifnot(exprs = { 247s + dtrbeta (c(42, Inf), shape1 = 2, shape2 = 3, shape3 = 4, scale = Inf) == c(0, 0) 247s + dburr (c(42, Inf), shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 247s + dllogis (c(42, Inf), shape = 3, scale = Inf) == c(0, 0) 247s + dparalogis (c(42, Inf), shape = 2, scale = Inf) == c(0, 0) 247s + dgenpareto (c(42, Inf), shape1 = 2, shape2 = 4, scale = Inf) == c(0, 0) 247s + dpareto (c(42, Inf), shape = 2, scale = Inf) == c(0, 0) 247s + dinvburr (c(42, Inf), shape1 = 4, shape2 = 3, scale = Inf) == c(0, 0) 247s + dinvpareto (c(42, Inf), shape = 4, scale = Inf) == c(0, 0) 247s + dinvparalogis(c(42, Inf), shape = 4, scale = Inf) == c(0, 0) 247s + }) 247s > 247s > ## Next test density functions for an array of standard values. 247s > set.seed(123) # reset the seed 247s > nshpar <- 3 # (maximum) number of shape parameters 247s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 247s > scpar <- rlnorm(30, 2) # scale parameters 247s > for (i in seq_along(shpar)) 247s + { 247s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 247s + Be <- beta(a, t) 247s + for (s in scpar) 247s + { 247s + x <- rtrbeta(100, shape1 = a, shape2 = g, shape3 = t, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^(-g)) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dtrbeta(x, shape1 = a, shape2 = g, shape3 = t, 247s + scale = s), 247s + d2 <- dtrbeta(y, shape1 = a, shape2 = g, shape3 = t, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + g * y^(g*t - 1)/(s * Be * (1 + y^g)^(a + t)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + g * u^t * (1 - u)^a/(x * Be), 247s + tolerance = 1e-10) 247s + }) 247s + x <- rburr(100, shape1 = a, shape2 = g, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^g) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dburr(x, shape1 = a, shape2 = g, 247s + scale = s), 247s + d2 <- dburr(y, shape1 = a, shape2 = g, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + a * g * y^(g - 1)/(s * (1 + y^g)^(a + 1)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + a * g * u^a * (1 - u)/x, 247s + tolerance = 1e-10) 247s + }) 247s + x <- rllogis(100, shape = g, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^(-g)) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dllogis(x, shape = g, 247s + scale = s), 247s + d2 <- dllogis(y, shape = g, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + g * y^(g - 1)/(s * (1 + y^g)^2), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + g * u * (1 - u)/x, 247s + tolerance = 1e-10) 247s + }) 247s + x <- rparalogis(100, shape = a, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^a) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dparalogis(x, shape = a, 247s + scale = s), 247s + d2 <- dparalogis(y, shape = a, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + a^2 * y^(a - 1)/(s * (1 + y^a)^(a + 1)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + a^2 * u^a * (1 - u)/x, 247s + tolerance = 1e-10) 247s + }) 247s + x <- rgenpareto(100, shape1 = a, shape2 = t, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^(-1)) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dgenpareto(x, shape1 = a, shape2 = t, 247s + scale = s), 247s + d2 <- dgenpareto(y, shape1 = a, shape2 = t, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + y^(t - 1)/(s * Be * (1 + y)^(a + t)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + u^t * (1 - u)^a/(x * Be), 247s + tolerance = 1e-10) 247s + }) 247s + x <- rpareto(100, shape = a, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dpareto(x, shape = a, 247s + scale = s), 247s + d2 <- dpareto(y, shape = a, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + a/(s * (1 + y)^(a + 1)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + a * u^a * (1 - u)/x, 247s + tolerance = 1e-10) 247s + }) 247s + x <- rpareto1(100, min = s, shape = a) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dpareto1(x, min = s, shape = a), 247s + a * s^a/(x^(a + 1)), 247s + tolerance = 1e-10) 247s + }) 247s + x <- rinvburr(100, shape1 = t, shape2 = g, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^(-g)) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dinvburr(x, shape1 = t, shape2 = g, 247s + scale = s), 247s + d2 <- dinvburr(y, shape1 = t, shape2 = g, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + t * g * y^(g*t - 1)/(s * (1 + y^g)^(t + 1)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + t * g * u^t * (1 - u)/x, 247s + tolerance = 1e-10) 247s + }) 247s + x <- rinvpareto(100, shape = t, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^(-1)) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dinvpareto(x, shape = t, 247s + scale = s), 247s + d2 <- dinvpareto(y, shape = t, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + t * y^(t - 1)/(s * (1 + y)^(t + 1)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + t * u^t * (1 - u)/x, 247s + tolerance = 1e-10) 247s + }) 247s + x <- rinvparalogis(100, shape = t, scale = s) 247s + y <- x/s 247s + u <- 1/(1 + y^(-t)) 247s + stopifnot(exprs = { 247s + all.equal(d1 <- dinvparalogis(x, shape = t, 247s + scale = s), 247s + d2 <- dinvparalogis(y, shape = t, 247s + scale = 1)/s, 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + t^2 * y^(t^2 - 1)/(s * (1 + y^t)^(t + 1)), 247s + tolerance = 1e-10) 247s + all.equal(d1, 247s + t^2 * u^t * (1 - u)/x, 247s + tolerance = 1e-10) 247s + }) 247s + } 247s + } 249s > 249s > ## Tests on the cumulative distribution function. 249s > ## 249s > ## Note: when shape1 = shape3 = 1, the underlying beta distribution is 249s > ## a uniform. Therefore, ptrbeta(x, 1, shape2, 1, scale) should return 249s > ## the value of u = v/(1 + v), v = (x/scale)^shape2. 249s > ## 249s > ## x = 2/Meps = 2^53 (with, shape2 = scale = 1) is the value where the 249s > ## cdf would jump to 1 if we weren't using the trick to compute the 249s > ## cdf with pbeta(1 - u, ..., lower = FALSE). 249s > scLrg <- 1e300 * c(0.5, 1, 2) 249s > stopifnot(exprs = { 249s + ptrbeta(Inf, 1, 2, 3, scale = xMax) == 1 249s + ptrbeta(2^53, 1, 1, 1, scale = 1) != 1 249s + all.equal(ptrbeta(xMin, 1, 1, 1, scale = 1), xMin) 249s + all.equal(ptrbeta(1e300, 249s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 249s + shape3 = 1, 249s + scale = scLrg, log = TRUE), 249s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 249s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE), 249s + pbeta(c(4/5, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 249s + pbeta(4/5, 3, 1, lower.tail = FALSE, log = TRUE))) 249s + }) 249s > stopifnot(exprs = { 249s + pburr(Inf, 1, 3, scale = xMax) == 1 249s + pburr(2^53, 1, 1, scale = 1) != 1 249s + all.equal(pburr(xMin, 1, 1, scale = 1), xMin) 249s + all.equal(pburr(1e300, 249s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 249s + scale = scLrg, log = TRUE), 249s + c(log(1 - c(1/3, 1/2, 2/3)^3), 249s + log(1 - c(1/5, 1/2, 4/5)^3))) 249s + }) 249s > stopifnot(exprs = { 249s + pllogis(Inf, 3, scale = xMax) == 1 249s + pllogis(2^53, 1, scale = 1) != 1 249s + all.equal(pllogis(xMin, 1, scale = 1), xMin) 249s + all.equal(pllogis(1e300, 249s + shape = rep(c(1, 2), each = length(scLrg)), 249s + scale = scLrg, log = TRUE), 249s + c(log(c(2/3, 1/2, 1/3)), 249s + log(c(4/5, 1/2, 1/5)))) 249s + }) 249s > stopifnot(exprs = { 249s + pparalogis(Inf, 3, scale = xMax) == 1 249s + pparalogis(2^53, 1, scale = 1) != 1 249s + all.equal(pparalogis(xMin, 1, scale = 1), xMin) 249s + all.equal(pparalogis(1e300, 249s + shape = rep(c(2, 3), each = length(scLrg)), 249s + scale = scLrg, log = TRUE), 249s + c(log(1 - c(1/5, 1/2, 4/5)^2), 249s + log(1 - c(1/9, 1/2, 8/9)^3))) 249s + }) 249s > stopifnot(exprs = { 249s + pgenpareto(Inf, 1, 3, scale = xMax) == 1 249s + pgenpareto(2^53, 1, 1, scale = 1) != 1 249s + all.equal(pgenpareto(xMin, 1, 1, scale = 1), xMin) 249s + all.equal(pgenpareto(1e300, 249s + shape1 = 3, shape2 = 1, 249s + scale = scLrg, log = TRUE), 249s + c(pbeta(c(2/3, 1/2), 1, 3, lower.tail = TRUE, log = TRUE), 249s + pbeta(2/3, 3, 1, lower.tail = FALSE, log = TRUE))) 249s + }) 249s > stopifnot(exprs = { 249s + ppareto(Inf, 3, scale = xMax) == 1 249s + ppareto(2^53, 1, scale = 1) != 1 249s + all.equal(ppareto(xMin, 1, scale = 1), xMin) 249s + all.equal(ppareto(1e300, 249s + shape = 3, 249s + scale = scLrg, log = TRUE), 249s + c(log(1 - c(1/3, 1/2, 2/3)^3))) 249s + }) 249s > stopifnot(exprs = { 249s + ppareto1(Inf, 3, min = xMax) == 1 249s + ppareto1(2^53, 1, min = 1) != 1 249s + all.equal(ppareto1(xMin, 1, min = 1), xMin) 249s + all.equal(ppareto1(1e300, 249s + shape = 3, 249s + min = 1e300 * c(0.001, 0.1, 0.5), log = TRUE), 249s + c(log(1 - c(0.001, 0.1, 0.5)^3))) 249s + }) 249s > stopifnot(exprs = { 249s + pinvburr(Inf, 1, 3, scale = xMax) == 1 249s + pinvburr(2^53, 1, 1, scale = 1) != 1 249s + all.equal(pinvburr(xMin, 1, 1, scale = 1), xMin) 249s + all.equal(pinvburr(1e300, 249s + shape1 = 3, shape2 = rep(c(1, 2), each = length(scLrg)), 249s + scale = scLrg, log = TRUE), 249s + c(log(c(2/3, 1/2, 1/3)^3), 249s + log(c(4/5, 1/2, 1/5)^3))) 249s + }) 249s > stopifnot(exprs = { 249s + pinvpareto(Inf, 3, scale = xMax) == 1 249s + pinvpareto(2^53, 1, scale = 1) != 1 249s + all.equal(pinvpareto(xMin, 1, scale = 1), xMin) 249s + all.equal(pinvpareto(1e300, 249s + shape = 3, 249s + scale = scLrg, log = TRUE), 249s + c(log(c(2/3, 1/2, 1/3)^3))) 249s + }) 249s > stopifnot(exprs = { 249s + pinvparalogis(Inf, 3, scale = xMax) == 1 249s + pinvparalogis(2^53, 1, scale = 1) != 1 249s + all.equal(pinvparalogis(xMin, 1, scale = 1), xMin) 249s + all.equal(pinvparalogis(1e300, 249s + shape = rep(c(2, 3), each = length(scLrg)), 249s + scale = scLrg, log = TRUE), 249s + c(log(c(4/5, 1/2, 1/5)^2), 249s + log(c(8/9, 1/2, 1/9)^3))) 249s + }) 249s > 249s > ## Also check that distribution functions return 0 when scale = Inf. 249s > stopifnot(exprs = { 249s + ptrbeta (x, shape1 = a, shape2 = g, shape3 = t, scale = Inf) == 0 249s + pburr (x, shape1 = a, shape2 = g, scale = Inf) == 0 249s + pllogis (x, shape = g, scale = Inf) == 0 249s + pparalogis (x, shape = a, scale = Inf) == 0 249s + pgenpareto (x, shape1 = a, shape2 = t, scale = Inf) == 0 249s + ppareto (x, shape = a, scale = Inf) == 0 249s + pinvburr (x, shape1 = t, shape2 = g, scale = Inf) == 0 249s + pinvpareto (x, shape = t, scale = Inf) == 0 249s + pinvparalogis(x, shape = t, scale = Inf) == 0 249s + }) 249s > 249s > ## Tests for first three positive moments and first two negative 249s > ## moments. 249s > ## 249s > ## Simulation of new parameters ensuring that said moments exist. 249s > set.seed(123) # reset the seed 249s > nshpar <- 3 # (maximum) number of shape parameters 249s > shpar <- replicate(30, c(3, 3, 3) + rlnorm(nshpar, 2), simplify = FALSE) 249s > scpar <- rlnorm(30, 2) # scale parameters 249s > k <- c(-2, -1, 1, 2, 3) # orders 249s > for (i in seq_along(shpar)) 249s + { 249s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 249s + Be <- beta(a, t) 249s + Ga <- gamma(a) 249s + for (s in scpar) 249s + { 249s + stopifnot(exprs = { 249s + All.eq(mtrbeta(k, shape1 = a, shape2 = g, shape3 = t, scale = s), 249s + s^k * beta(t + k/g, a - k/g)/Be) 249s + All.eq(mburr(k, shape1 = a, shape2 = g, scale = s), 249s + s^k * gamma(1 + k/g) * gamma(a - k/g)/Ga) 249s + All.eq(mllogis(k, shape = g, scale = s), 249s + s^k * gamma(1 + k/g) * gamma(1 - k/g)) 249s + All.eq(mparalogis(k, shape = a, scale = s), 249s + s^k * gamma(1 + k/a) * gamma(a - k/a)/Ga) 249s + All.eq(mgenpareto(k, shape1 = a, shape2 = t, scale = s), 249s + s^k * beta(t + k, a - k)/Be) 249s + All.eq(mpareto(k[k > -1], shape = a, scale = s), 249s + s^k[k > -1] * gamma(1 + k[k > -1]) * gamma(a - k[k > -1])/Ga) 249s + All.eq(mpareto1(k, shape = a, min = s), 249s + s^k * a/(a - k)) 249s + All.eq(minvburr(k, shape1 = a, shape2 = g, scale = s), 249s + s^k * gamma(a + k/g) * gamma(1 - k/g)/Ga) 249s + All.eq(minvpareto(k[k < 1], shape = a, scale = s), 249s + s^k[k < 1] * gamma(a + k[k < 1]) * gamma(1 - k[k < 1])/Ga) 249s + All.eq(minvparalogis(k, shape = a, scale = s), 249s + s^k * gamma(a + k/a) * gamma(1 - k/a)/Ga) 249s + }) 249s + } 249s + } 250s > 250s > ## Tests for first three positive limited moments and first two 250s > ## negative limited moments. 250s > ## 250s > ## Limits are taken from quantiles of each distribution. 250s > order <- c(-2, -1, 1, 2, 3) # orders 250s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 250s > for (i in seq_along(shpar)) 250s + { 250s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 250s + Ga <- gamma(a) 250s + Gt <- gamma(t) 250s + for (s in scpar) 250s + { 250s + limit <- qtrbeta(q, shape1 = a, shape2 = g, shape3 = t, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^(-g)) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levtrbeta(limit, order = k, shape1 = a, shape2 = g, shape3 = t, scale = s), 250s + s^k * betaint(u, t + k/g, a - k/g)/(Ga * Gt) + 250s + limit^k * pbeta(u, t, a, lower = FALSE)) 250s + }) 250s + limit <- qburr(q, shape1 = a, shape2 = g, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^g) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levburr(limit, order = k, shape1 = a, shape2 = g, scale = s), 250s + s^k * betaint(1 - u, 1 + k/g, a - k/g)/Ga + 250s + limit^k * u^a) 250s + }) 250s + limit <- qllogis(q, shape = g, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^(-g)) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levllogis(limit, order = k, shape = g, scale = s), 250s + s^k * betaint(u, 1 + k/g, 1 - k/g) + 250s + limit^k * (1 - u)) 250s + }) 250s + limit <- qparalogis(q, shape = a, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^a) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levparalogis(limit, order = k, shape = a, scale = s), 250s + s^k * betaint(1 - u, 1 + k/a, a - k/a)/Ga + 250s + limit^k * u^a) 250s + }) 250s + limit <- qgenpareto(q, shape1 = a, shape2 = t, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^(-1)) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levgenpareto(limit, order = k, shape1 = a, shape2 = t, scale = s), 250s + s^k * betaint(u, t + k, a - k)/(Ga * Gt) + 250s + limit^k * pbeta(u, t, a, lower = FALSE)) 250s + }) 250s + limit <- qpareto(q, shape = a, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y) 250s + for (k in order[order > -1]) 250s + stopifnot(exprs = { 250s + All.eq(levpareto(limit, order = k, shape = a, scale = s), 250s + s^k * betaint(1 - u, 1 + k, a - k)/Ga + 250s + limit^k * u^a) 250s + }) 250s + limit <- qpareto1(q, shape = a, min = s) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levpareto1(limit, order = k, shape = a, min = s), 250s + s^k * a/(a - k) - k * s^a/((a - k) * limit^(a - k))) 250s + }) 250s + limit <- qinvburr(q, shape1 = a, shape2 = g, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^(-g)) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levinvburr(limit, order = k, shape1 = a, shape2 = g, scale = s), 250s + s^k * betaint(u, a + k/g, 1 - k/g)/Ga + 250s + limit^k * (1 - u^a)) 250s + }) 250s + limit <- qinvpareto(q, shape = a, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^(-1)) 250s + for (k in order[order < 1]) 250s + stopifnot(exprs = { 250s + All.eq(levinvpareto(limit, order = k, shape = a, scale = s), 250s + s^k * a * 250s + sapply(u, 250s + function(upper) 250s + integrate(function(x) x^(a+k-1) * (1-x)^(-k), 250s + lower = 0, upper = upper)$value) + 250s + limit^k * (1 - u^a)) 250s + }) 250s + limit <- qinvparalogis(q, shape = a, scale = s) 250s + y <- limit/s 250s + u <- 1/(1 + y^(-a)) 250s + for (k in order) 250s + stopifnot(exprs = { 250s + All.eq(levinvparalogis(limit, order = k, shape = a, scale = s), 250s + s^k * betaint(u, a + k/a, 1 - k/a)/Ga + 250s + limit^k * (1 - u^a)) 250s + }) 250s + } 250s + } 253s > 253s > ## 253s > ## TRANSFORMED GAMMA AND INVERSE TRANSFORMED GAMMA FAMILIES 253s > ## 253s > 253s > ## Density: first check that functions return 0 when scale = Inf, and 253s > ## when x = scale = Inf (transformed gamma), or when scale = 0 and 253s > ## when x = scale = 0 (inverse distributions). 253s > stopifnot(exprs = { 253s + dtrgamma (c(42, Inf), shape1 = 2, shape2 = 3, scale = Inf) == c(0, 0) 253s + dinvtrgamma(c(42, 0), shape1 = 2, shape2 = 3, scale = 0) == c(0, 0) 253s + dinvgamma (c(42, 0), shape = 2, scale = 0) == c(0, 0) 253s + dinvweibull(c(42, 0), shape = 3, scale = 0) == c(0, 0) 253s + dinvexp (c(42, 0), scale = 0) == c(0, 0) 253s + }) 253s > 253s > ## Tests on the density 253s > set.seed(123) # reset the seed 253s > nshpar <- 2 # (maximum) number of shape parameters 253s > shpar <- replicate(30, rgamma(nshpar, 5), simplify = FALSE) 253s > scpar <- rlnorm(30, 2) # scale parameters 253s > for (i in seq_along(shpar)) 253s + { 253s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 253s + Ga <- gamma(a) 253s + for (s in scpar) 253s + { 253s + x <- rtrgamma(100, shape1 = a, shape2 = t, scale = s) 253s + y <- x/s 253s + u <- y^t 253s + stopifnot(exprs = { 253s + all.equal(d1 <- dtrgamma(x, shape1 = a, shape2 = t, 253s + scale = s), 253s + d2 <- dtrgamma(y, shape1 = a, shape2 = t, 253s + scale = 1)/s, 253s + tolerance = 1e-10) 253s + all.equal(d2, 253s + t/(Ga * s^(a * t)) * x^(a * t - 1) * exp(-u), 253s + tolerance = 1e-10) 253s + all.equal(d1, 253s + t/(Ga * x) * u^a * exp(-u), 253s + tolerance = 1e-10) 253s + }) 253s + x <- rinvtrgamma(100, shape1 = a, shape2 = t, scale = s) 253s + y <- x/s 253s + u <- y^(-t) 253s + stopifnot(exprs = { 253s + all.equal(d1 <- dinvtrgamma(x, shape1 = a, shape2 = t, 253s + scale = s), 253s + d2 <- dinvtrgamma(y, shape1 = a, shape2 = t, 253s + scale = 1)/s, 253s + tolerance = 1e-10) 253s + all.equal(d2, 253s + t * s^(a * t)/(Ga * x^(a * t + 1)) * exp(-u), 253s + tolerance = 1e-10) 253s + all.equal(d1, 253s + t/(Ga * x) * u^a * exp(-u), 253s + tolerance = 1e-10) 253s + }) 253s + x <- rinvgamma(100, shape = a, scale = s) 253s + y <- x/s 253s + u <- y^(-1) 253s + stopifnot(exprs = { 253s + all.equal(d1 <- dinvgamma(x, shape = a, scale = s), 253s + d2 <- dinvgamma(y, shape = a, scale = 1)/s, 253s + tolerance = 1e-10) 253s + all.equal(d2, 253s + s^a/(Ga * x^(a + 1)) * exp(-u), 253s + tolerance = 1e-10) 253s + all.equal(d1, 253s + 1/(Ga * x) * u^a * exp(-u), 253s + tolerance = 1e-10) 253s + }) 253s + x <- rinvweibull(100, shape = t, scale = s) 253s + y <- x/s 253s + u <- y^(-t) 253s + stopifnot(exprs = { 253s + all.equal(d1 <- dinvweibull(x, shape = t, scale = s), 253s + d2 <- dinvweibull(y, shape = t, scale = 1)/s, 253s + tolerance = 1e-10) 253s + all.equal(d2, 253s + t * s^t/x^(t + 1) * exp(-u), 253s + tolerance = 1e-10) 253s + all.equal(d1, 253s + t/x * u * exp(-u), 253s + tolerance = 1e-10) 253s + }) 253s + x <- rinvexp(100, scale = s) 253s + y <- x/s 253s + u <- y^(-1) 253s + stopifnot(exprs = { 253s + all.equal(d1 <- dinvexp(x, scale = s), 253s + d2 <- dinvexp(y, scale = 1)/s, 253s + tolerance = 1e-10) 253s + all.equal(d2, 253s + s/x^2 * exp(-u), 253s + tolerance = 1e-10) 253s + all.equal(d1, 253s + 1/x * u * exp(-u), 253s + tolerance = 1e-10) 253s + }) 253s + } 253s + } 254s > 254s > ## Tests on the cumulative distribution function. 254s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf) 254s > stopifnot(exprs = { 254s + ptrgamma(Inf, 2, 3, scale = xMax) == 1 254s + ptrgamma(xMax, 2, 3, scale = xMax) == pgamma(1, 2, 1) 254s + ptrgamma(xMin, 2, 1, scale = 1) == pgamma(xMin, 2, 1) 254s + all.equal(ptrgamma(1e300, shape1 = 2, shape2 = 1, scale = scLrg, log = TRUE), 254s + pgamma(c(5e299, 1e+298, 10, 1, 0.1, 0.01, 1e-7, 1e+300/xMax, 0), 254s + 2, 1, log = TRUE)) 254s + }) 254s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, 0) 254s > stopifnot(exprs = { 254s + pinvtrgamma(Inf, 2, 3, scale = xMax) == 1 254s + pinvtrgamma(xMax, 2, 3, scale = xMax) == pgamma(1, 2, 1, lower = FALSE) 254s + pinvtrgamma(xMin, 2, 1, scale = 1) == pgamma(1/xMin, 2, 1, lower = FALSE) 254s + all.equal(pinvtrgamma(1e300, shape1 = 2, shape2 = 1, scale = scLrg, log = TRUE), 254s + pgamma(c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0), 254s + 2, 1, lower = FALSE, log = TRUE)) 254s + }) 254s > stopifnot(exprs = { 254s + pinvgamma(Inf, 2, scale = xMax) == 1 254s + pinvgamma(xMax, 2, scale = xMax) == pgamma(1, 2, 1, lower = FALSE) 254s + pinvgamma(xMin, 2, scale = 1) == pgamma(1/xMin, 2, 1, lower = FALSE) 254s + all.equal(pinvgamma(1e300, shape = 2, scale = scLrg, log = TRUE), 254s + pgamma(c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0), 254s + 2, 1, lower = FALSE, log = TRUE)) 254s + }) 254s > stopifnot(exprs = { 254s + pinvweibull(Inf, 3, scale = xMax) == 1 254s + pinvweibull(xMax, 3, scale = xMax) == exp(-1) 254s + pinvweibull(xMin, 1, scale = 1) == exp(-1/xMin) 254s + all.equal(pinvweibull(1e300, shape = 1, scale = scLrg, log = TRUE), 254s + -c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0)) 254s + }) 254s > stopifnot(exprs = { 254s + pinvexp(Inf, 3, scale = xMax) == 1 254s + pinvexp(xMax, 3, scale = xMax) == exp(-1) 254s + pinvexp(xMin, 1, scale = 1) == exp(-1/xMin) 254s + all.equal(pinvexp(1e300, scale = scLrg, log = TRUE), 254s + -c(2e-300, 1e-298, 0.1, 1, 10, 100, 1e+7, xMax/1e+300, 0)) 254s + }) 254s > 254s > ## Tests for first three positive moments and first two negative 254s > ## moments. (Including for the Gamma, Weibull and Exponential 254s > ## distributions of base R.) 254s > ## 254s > ## Simulation of new parameters ensuring that said moments exist. 254s > set.seed(123) # reset the seed 254s > nshpar <- 2 # (maximum) number of shape parameters 254s > shpar <- replicate(30, c(3, 3) + rlnorm(nshpar, 2), simplify = FALSE) 254s > scpar <- rlnorm(30, 2) # scale parameters 254s > k <- c(-2, -1, 1, 2, 3) # orders 254s > for (i in seq_along(shpar)) 254s + { 254s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 254s + Ga <- gamma(a) 254s + for (s in scpar) 254s + { 254s + stopifnot(exprs = { 254s + All.eq(mtrgamma(k, shape1 = a, shape2 = t, scale = s), 254s + s^k * gamma(a + k/t)/Ga) 254s + All.eq(mgamma(k, shape = a, scale = s), 254s + s^k * gamma(a + k)/Ga) 254s + All.eq(mweibull(k, shape = t, scale = s), 254s + s^k * gamma(1 + k/t)) 254s + All.eq(mexp(k[k > -1], rate = 1/s), 254s + s^k[k > -1] * gamma(1 + k[k > -1])) 254s + All.eq(minvtrgamma(k, shape1 = a, shape2 = t, scale = s), 254s + s^k * gamma(a - k/t)/Ga) 254s + All.eq(minvgamma(k, shape = a, scale = s), 254s + s^k * gamma(a - k)/Ga) 254s + All.eq(minvweibull(k, shape = t, scale = s), 254s + s^k * gamma(1 - k/t)) 254s + All.eq(minvexp(k[k < 1], scale = s), 254s + s^k[k < 1] * gamma(1 - k[k < 1])) 254s + }) 254s + } 254s + } 254s > 254s > ## Tests for first three positive limited moments and first two 254s > ## negative limited moments. (Including for the Gamma, Weibull and 254s > ## Exponential distributions of base R.) 254s > ## 254s > ## Limits are taken from quantiles of each distribution. 254s > order <- c(-2, -1, 1, 2, 3) # orders 254s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 254s > for (i in seq_along(shpar)) 254s + { 254s + a <- shpar[[c(i, 1)]]; t <- shpar[[c(i, 2)]] 254s + Ga <- gamma(a) 254s + for (s in scpar) 254s + { 254s + limit <- qtrgamma(q, shape1 = a, shape2 = t, scale = s) 254s + y <- limit/s 254s + u <- y^t 254s + for (k in order) 254s + stopifnot(exprs = { 254s + All.eq(levtrgamma(limit, order = k, shape1 = a, shape2 = t, scale = s), 254s + s^k * gamma(a + k/t)/Ga * pgamma(u, a + k/t, scale = 1) + 254s + limit^k * pgamma(u, a, scale = 1, lower = FALSE)) 254s + }) 254s + limit <- qgamma(q, shape = a, scale = s) 254s + y <- limit/s 254s + for (k in order) 254s + stopifnot(exprs = { 254s + All.eq(levgamma(limit, order = k, shape = a, scale = s), 254s + s^k * gamma(a + k)/Ga * pgamma(y, a + k, scale = 1) + 254s + limit^k * pgamma(y, a, scale = 1, lower = FALSE)) 254s + }) 254s + limit <- qweibull(q, shape = t, scale = s) 254s + y <- limit/s 254s + u <- y^t 254s + for (k in order) 254s + stopifnot(exprs = { 254s + All.eq(levweibull(limit, order = k, shape = t, scale = s), 254s + s^k * gamma(1 + k/t) * pgamma(u, 1 + k/t, scale = 1) + 254s + limit^k * pgamma(u, 1, scale = 1, lower = FALSE)) 254s + }) 254s + limit <- qexp(q, rate = 1/s) 255s + y <- limit/s 255s + for (k in order[order > -1]) 255s + stopifnot(exprs = { 255s + All.eq(levexp(limit, order = k, rate = 1/s), 255s + s^k * gamma(1 + k) * pgamma(y, 1 + k, scale = 1) + 255s + limit^k * pgamma(y, 1, scale = 1, lower = FALSE)) 255s + }) 255s + limit <- qinvtrgamma(q, shape1 = a, shape2 = t, scale = s) 255s + y <- limit/s 255s + u <- y^(-t) 255s + for (k in order) 255s + stopifnot(exprs = { 255s + All.eq(levinvtrgamma(limit, order = k, shape1 = a, shape2 = t, scale = s), 255s + s^k * (gammainc(a - k/t, u)/Ga) + 255s + limit^k * pgamma(u, a, scale = 1)) 255s + }) 255s + limit <- qinvgamma(q, shape = a, scale = s) 255s + y <- limit/s 255s + u <- y^(-1) 255s + for (k in order) 255s + stopifnot(exprs = { 255s + All.eq(levinvgamma(limit, order = k, shape = a, scale = s), 255s + s^k * (gammainc(a - k, u)/Ga) + 255s + limit^k * pgamma(u, a, scale = 1)) 255s + }) 255s + limit <- qinvweibull(q, shape = t, scale = s) 255s + y <- limit/s 255s + u <- y^(-t) 255s + for (k in order) 255s + stopifnot(exprs = { 255s + All.eq(levinvweibull(limit, order = k, shape = t, scale = s), 255s + s^k * gammainc(1 - k/t, u) + 255s + limit^k * (-expm1(-u))) 255s + }) 255s + limit <- qinvexp(q, scale = s) 255s + y <- limit/s 255s + u <- y^(-1) 255s + for (k in order) 255s + stopifnot(exprs = { 255s + All.eq(levinvexp(limit, order = k, scale = s), 255s + s^k * gammainc(1 - k, u) + 255s + limit^k * (-expm1(-u))) 255s + }) 255s + } 255s + } 257s > 257s > ## 257s > ## OTHER DISTRIBUTIONS 257s > ## 257s > 257s > ## Distributions in this category are quite different, so let's treat 257s > ## them separately. 257s > 257s > ## LOGGAMMA 257s > 257s > ## Tests on the density. 257s > stopifnot(exprs = { 257s + dlgamma(c(42, Inf), shapelog = 2, ratelog = 0) == c(0, 0) 257s + }) 257s > assertWarning(stopifnot(exprs = { 257s + is.nan(dlgamma(c(0, 42, Inf), shapelog = 2, ratelog = Inf)) 257s + })) 257s > x <- rlgamma(100, shapelog = 2, ratelog = 1) 257s > for(a in round(rlnorm(30), 2)) 257s + { 257s + Ga <- gamma(a) 257s + for(r in round(rlnorm(30), 2)) 257s + stopifnot(exprs = { 257s + All.eq(dlgamma(x, shapelog = a, ratelog = r), 257s + r^a * (log(x))^(a - 1)/(Ga * x^(r + 1))) 257s + }) 257s + } 257s > 257s > ## Tests on the cumulative distribution function. 257s > assertWarning(stopifnot(exprs = { 257s + is.nan(plgamma(Inf, 1, ratelog = Inf)) 257s + is.nan(plgamma(Inf, Inf, ratelog = Inf)) 257s + })) 257s > scLrg <- log(c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf)) 257s > stopifnot(exprs = { 257s + plgamma(Inf, 2, ratelog = xMax) == 1 257s + plgamma(xMax, 2, ratelog = 0) == 0 257s + all.equal(plgamma(1e300, 2, ratelog = 1/scLrg, log = TRUE), 257s + pgamma(log(1e300), 2, scale = scLrg, log = TRUE)) 257s + }) 257s > 257s > ## Tests for first three positive moments and first two negative 257s > ## moments. 257s > k <- c(-2, -1, 1, 2, 3) # orders 257s > for(a in round(rlnorm(30), 2)) 257s + { 257s + Ga <- gamma(a) 257s + for(r in 3 + round(rlnorm(30), 2)) 257s + stopifnot(exprs = { 257s + All.eq(mlgamma(k, shapelog = a, ratelog = r), 257s + (1 - k/r)^(-a)) 257s + }) 257s + } 257s > 257s > ## Tests for first three positive limited moments and first two 257s > ## negative limited moments. 257s > order <- c(-2, -1, 1, 2, 3) # orders 257s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 257s > for(a in round(rlnorm(30), 2)) 257s + { 257s + Ga <- gamma(a) 257s + for(r in 3 + round(rlnorm(30), 2)) 257s + { 257s + limit <- qlgamma(q, shapelog = a, ratelog = r) 257s + for (k in order) 257s + { 257s + u <- log(limit) 257s + stopifnot(exprs = { 257s + All.eq(levlgamma(limit, order = k, shapelog = a, ratelog = r), 257s + (1 - k/r)^(-a) * pgamma((r - k) * u, a, scale = 1) + 257s + limit^k * pgamma(r * u, a, scale = 1,lower = FALSE)) 257s + }) 257s + } 257s + } 257s + } 257s > 257s > ## GUMBEL 257s > 257s > ## Tests on the density. 257s > stopifnot(exprs = { 257s + dgumbel(c(1, 3, Inf), alpha = 2, scale = Inf) == c(0, 0, 0) 257s + dgumbel(c(1, 2, 3), alpha = 2, scale = 0) == c(0, Inf, 0) 257s + dgumbel(c(-Inf, Inf), alpha = 1, scale = 1) == c(0, 0) 257s + dgumbel(1, alpha = Inf, scale = 1) == 0 257s + }) 257s > assertWarning(stopifnot(exprs = { 257s + is.nan(dgumbel(Inf, alpha = Inf, scale = 1)) 257s + is.nan(dgumbel(-Inf, alpha = -Inf, scale = 1)) 257s + is.nan(dgumbel(Inf, alpha = 1, scale = -1)) 257s + is.nan(dgumbel(1, alpha = 1, scale = -1)) 257s + is.nan(dgumbel(1, alpha = Inf, scale = -1)) 257s + })) 257s > x <- rgumbel(100, alpha = 2, scale = 5) 257s > for(a in round(rlnorm(30), 2)) 257s + { 257s + Ga <- gamma(a) 257s + for(s in round(rlnorm(30), 2)) 257s + { 257s + u <- (x - a)/s 257s + stopifnot(exprs = { 257s + All.eq(dgumbel(x, alpha = a, scale = s), 257s + exp(-(u + exp(-u)))/s) 257s + }) 257s + } 257s + } 257s > 257s > ## Tests on the cumulative distribution function. 257s > assertWarning(stopifnot(exprs = { 257s + is.nan(pgumbel(Inf, alpha = Inf, scale = 1)) 257s + is.nan(pgumbel(-Inf, alpha = -Inf, scale = 1)) 257s + is.nan(pgumbel(Inf, alpha = 1, scale = -1)) 257s + is.nan(pgumbel(1, alpha = 1, scale = -1)) 257s + is.nan(pgumbel(1, alpha = Inf, scale = -1)) 257s + })) 257s > scLrg <- c(2, 100, 1e300 * c(0.1, 1, 10, 100), 1e307, xMax, Inf) 257s > stopifnot(exprs = { 257s + pgumbel(c(-Inf, Inf), 2, scale = xMax) == c(0, 1) 257s + pgumbel(c(xMin, xMax), 2, scale = 0) == c(0, 1) 257s + all.equal(pgumbel(1e300, 0, scale = scLrg, log = TRUE), 258s + -exp(-c(5e299, 1e+298, 10, 1, 0.1, 0.01, 1e-7, 1e+300/xMax, 0))) 258s + }) 258s > 258s > ## Test the first two moments, the only ones implemented. 258s > assertWarning(stopifnot(exprs = { 258s + is.nan(mgumbel(c(-2, -1, 3, 4), alpha = 2, scale = 5)) 258s + })) 258s > stopifnot(exprs = { 258s + All.eq(mgumbel(1, alpha = 2, scale = 5), 258s + 2 + 5 * 0.577215664901532860606512090082) 258s + All.eq(mgumbel(2, alpha = 2, scale = 5), 258s + pi^2 * 25/6 + (2 + 5 * 0.577215664901532860606512090082)^2) 258s + }) 258s > 258s > ## INVERSE GAUSSIAN 258s > 258s > ## Tests on the density. 258s > stopifnot(exprs = { 258s + dinvgauss(c(1, 3, Inf), mean = 2, dispersion = Inf) == c(0, 0, 0) 258s + dinvgauss(c(0, 42, Inf), mean = 2, dispersion = 0) == c(Inf, 0, 0) 258s + dinvgauss(c(0, Inf), mean = 1, dispersion = 1) == c(0, 0) 258s + dinvgauss(1, mean = Inf, dispersion = 2) == dinvgamma(1, 0.5, scale = 0.25) 258s + }) 258s > assertWarning(stopifnot(exprs = { 258s + is.nan(dinvgauss(-Inf, mean = -1, dispersion = 1)) 258s + is.nan(dinvgauss(Inf, mean = 1, dispersion = -1)) 258s + is.nan(dinvgauss(1, mean = 1, dispersion = -1)) 258s + is.nan(dinvgauss(1, mean = Inf, dispersion = -1)) 258s + })) 258s > x <- rinvgauss(100, mean = 2, dispersion = 5) 258s > for(mu in round(rlnorm(30), 2)) 258s + { 258s + for(phi in round(rlnorm(30), 2)) 258s + stopifnot(exprs = { 258s + All.eq(dinvgauss(x, mean = mu, dispersion = phi), 258s + 1/sqrt(2*pi*phi*x^3) * exp(-((x/mu - 1)^2)/(2*phi*x))) 258s + }) 258s + } 258s > 258s > ## Tests on the cumulative distribution function. 258s > assertWarning(stopifnot(exprs = { 258s + is.nan(pinvgauss(-Inf, mean = -Inf, dispersion = 1)) 258s + is.nan(pinvgauss(Inf, mean = 1, dispersion = -1)) 258s + is.nan(pinvgauss(1, mean = Inf, dispersion = -1)) 258s + })) 258s > x <- c(1:50, 10^c(3:10, 20, 50, 150, 250)) 258s > sqx <- sqrt(x) 258s > stopifnot(exprs = { 258s + pinvgauss(c(0, Inf), mean = 2, dispersion = xMax) == c(0, 1) 258s + pinvgauss(c(0, xMax), mean = xMax, dispersion = 0) == c(0, 1) 258s + all.equal(pinvgauss(x, 1, dispersion = 1, log = TRUE), 258s + log(pnorm(sqx - 1/sqx) + exp(2) * pnorm(-sqx - 1/sqx))) 258s + }) 258s > 258s > ## Tests for small value of 'shape'. Added for the patch in 4294e9c. 258s > q <- runif(100) 258s > stopifnot(exprs = { 258s + all.equal(q, 258s + pinvgauss(qinvgauss(q, 0.1, 1e-2), 0.1, 1e-2)) 258s + all.equal(q, 258s + pinvgauss(qinvgauss(q, 0.1, 1e-6), 0.1, 1e-6)) 258s + }) 258s > 258s > ## Tests for first three positive, integer moments. 258s > k <- 1:3 258s > for(mu in round(rlnorm(30), 2)) 258s + { 258s + for(phi in round(rlnorm(30), 2)) 258s + stopifnot(exprs = { 258s + All.eq(minvgauss(k, mean = mu, dispersion = phi), 258s + c(mu, 258s + mu^2 * (1 + phi * mu), 258s + mu^3 * (1 + 3 * phi * mu + 3 * (phi * mu)^2))) 258s + }) 258s + } 258s > 258s > ## Tests for limited expected value. 258s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 258s > for(mu in round(rlnorm(30), 2)) 258s + { 258s + for(phi in round(rlnorm(30), 2)) 258s + { 258s + limit <- qinvgauss(q, mean = mu, dispersion = phi) 258s + stopifnot(exprs = { 258s + All.eq(levinvgauss(limit, mean = mu, dispersion = phi), 258s + mu * (pnorm((limit/mu - 1)/sqrt(phi * limit)) - 258s + exp(2/phi/mu) * pnorm(-(limit/mu + 1)/sqrt(phi * limit))) + 258s + limit * pinvgauss(limit, mean = mu, dispersion = phi, lower = FALSE)) 258s + }) 258s + } 258s + } 258s > 258s > ## GENERALIZED BETA 258s > stopifnot(exprs = { 258s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 0, shape3 = 3, scale = 5) == c(Inf, 0, Inf) 258s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 0, shape3 = 0, scale = 5) == c(Inf, 0, Inf) 258s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = 2, shape3 = 0, scale = 5) == c(Inf, 0, 0) 258s + dgenbeta(c(0, 2.5, 5), shape1 = 0, shape2 = Inf, shape3 = 3, scale = 5) == c(Inf, 0, 0) 258s + dgenbeta(c(0, 2.5, 5), shape1 = 1, shape2 = Inf, shape3 = 3, scale = 5) == c(Inf, 0, 0) 258s + dgenbeta(c(0, 2.5, 5), shape1 = Inf, shape2 = Inf, shape3 = 3, scale = 5) == c(0, Inf, 0) 258s + dgenbeta(c(0, 2.5, 5), shape1 = Inf, shape2 = Inf, shape3 = Inf, scale = 5) == c(0, 0, Inf) 258s + }) 258s > nshpar <- 3 # number of shape parameters 258s > shpar <- replicate(30, rlnorm(nshpar, 2), simplify = FALSE) 258s > scpar <- rlnorm(30, 2) # scale parameters 258s > for (i in seq_along(shpar)) 258s + { 258s + a <- shpar[[c(i, 1)]]; b <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 258s + Be <- beta(a, b) 258s + for (s in scpar) 258s + { 258s + u <- rbeta(100, a, b) 258s + y <- u^(1/t) 258s + x <- s * y 258s + stopifnot(exprs = { 258s + all.equal(d1 <- dgenbeta(x, shape1 = a, shape2 = b, shape3 = t, 258s + scale = s), 258s + d2 <- dgenbeta(y, shape1 = a, shape2 = b, shape3 = t, 258s + scale = 1)/s, 258s + tolerance = 1e-10) 258s + all.equal(d1, 258s + t * y^(a*t - 1) * (1 - y^t)^(b - 1)/(s * Be), 258s + tolerance = 1e-10) 258s + all.equal(d1, 258s + t * u^a * (1 - u)^(b - 1)/(x * Be), 258s + tolerance = 1e-10) 258s + }) 258s + } 258s + } 258s > 258s > ## Tests on the cumulative distribution function. 258s > scLrg <- 1e300 * c(0.5, 1, 2, 4) 258s > stopifnot(exprs = { 258s + all.equal(pgenbeta(1e300, 258s + shape1 = 3, shape2 = 1, 258s + shape3 = rep(c(1, 2), each = length(scLrg)), 258s + scale = scLrg, log = TRUE), 258s + c(0, pbeta(c(1, 1/2, 1/4), 3, 1, log = TRUE), 258s + 0, pbeta(c(1, 1/4, 1/16), 3, 1, log = TRUE))) 258s + }) 258s > 258s > ## Tests for first three positive moments and first two negative 258s > ## moments. 258s > ## 258s > ## Simulation of new parameters ensuring that said moments exist. 258s > set.seed(123) # reset the seed 258s > nshpar <- 3 # number of shape parameters 258s > shpar <- replicate(30, sqrt(c(3, 0, 3)) + rlnorm(nshpar, 2), simplify = FALSE) 258s > scpar <- rlnorm(30, 2) # scale parameters 258s > k <- c(-2, -1, 1, 2, 3) # orders 258s > for (i in seq_along(shpar)) 258s + { 258s + a <- shpar[[c(i, 1)]]; b <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 258s + Be <- beta(a, b) 258s + for (s in scpar) 258s + stopifnot(exprs = { 258s + All.eq(mgenbeta(k, shape1 = a, shape2 = b, shape3 = t, scale = s), 258s + s^k * beta(a + k/t, b)/Be) 258s + }) 258s + } 258s > 258s > ## Tests for first three positive limited moments and first two 258s > ## negative limited moments. 258s > ## 258s > ## Simulation of new parameters ensuring that said moments exist. 258s > order <- c(-2, -1, 1, 2, 3) # orders 258s > q <- c(0.25, 0.50, 0.75, 0.9, 0.95) # quantiles 258s > for (i in seq_along(shpar)) 258s + { 258s + a <- shpar[[c(i, 1)]]; g <- shpar[[c(i, 2)]]; t <- shpar[[c(i, 3)]] 258s + Be <- beta(a, b) 258s + for (s in scpar) 258s + { 258s + limit <- qgenbeta(q, shape1 = a, shape2 = b, shape3 = t, scale = s) 258s + u <- (limit/s)^t 258s + for (k in order) 258s + stopifnot(exprs = { 258s + All.eq(levgenbeta(limit, order = k, shape1 = a, shape2 = b, shape3 = t, scale = s), 258s + s^k * beta(a + k/t, b)/Be * pbeta(u, a + k/t, b) + 258s + limit^k * pbeta(u, a, b, lower = FALSE)) 258s + }) 258s + } 258s + } 258s > 258s > ## 258s > ## RANDOM NUMBERS (all continuous distributions) 258s > ## 258s > set.seed(123) 258s > n <- 20 258s > m <- rnorm(1) 258s > 258s > ## Generate variates 258s > Rfpareto <- rfpareto(n, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > Rpareto4 <- rpareto4(n, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 258s > Rpareto3 <- rpareto3(n, min = m, shape = 1.5, scale = 2) 258s > Rpareto2 <- rpareto2(n, min = m, shape = 0.8, scale = 2) 258s > Rtrbeta <- rtrbeta (n, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > Rburr <- rburr (n, shape1 = 0.8, shape2 = 1.5, scale = 2) 258s > Rllogis <- rllogis (n, shape = 1.5, scale = 2) 258s > Rparalogis <- rparalogis (n, shape = 0.8, scale = 2) 258s > Rgenpareto <- rgenpareto (n, shape1 = 0.8, shape2 = 2, scale = 2) 258s > Rpareto <- rpareto (n, shape = 0.8, scale = 2) 258s > Rpareto1 <- rpareto1 (n, shape = 0.8, min = 2) 258s > Rinvburr <- rinvburr (n, shape1 = 1.5, shape2 = 2, scale = 2) 258s > Rinvpareto <- rinvpareto (n, shape = 2, scale = 2) 258s > Rinvparalogis <- rinvparalogis(n, shape = 2, scale = 2) 258s > Rtrgamma <- rtrgamma (n, shape1 = 2, shape2 = 3, scale = 5) 258s > Rinvtrgamma <- rinvtrgamma (n, shape1 = 2, shape2 = 3, scale = 5) 258s > Rinvgamma <- rinvgamma (n, shape = 2, scale = 5) 258s > Rinvweibull <- rinvweibull (n, shape = 3, scale = 5) 258s > Rinvexp <- rinvexp (n, scale = 5) 258s > Rlgamma <- rlgamma(n, shapelog = 1.5, ratelog = 5) 258s > Rgumbel <- rgumbel(n, alpha = 2, scale = 5) 258s > Rinvgauss <- rinvgauss(n, mean = 2, dispersion = 5) 258s > Rgenbeta <- rgenbeta(n, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > 258s > ## Compute quantiles 258s > Pfpareto <- pfpareto(Rfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > Ppareto4 <- ppareto4(Rpareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 258s > Ppareto3 <- ppareto3(Rpareto3, min = m, shape = 1.5, scale = 2) 258s > Ppareto2 <- ppareto2(Rpareto2, min = m, shape = 0.8, scale = 2) 258s > Ptrbeta <- ptrbeta (Rtrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > Pburr <- pburr (Rburr, shape1 = 0.8, shape2 = 1.5, scale = 2) 258s > Pllogis <- pllogis (Rllogis, shape = 1.5, scale = 2) 258s > Pparalogis <- pparalogis (Rparalogis, shape = 0.8, scale = 2) 258s > Pgenpareto <- pgenpareto (Rgenpareto, shape1 = 0.8, shape2 = 2, scale = 2) 258s > Ppareto <- ppareto (Rpareto, shape = 0.8, scale = 2) 258s > Ppareto1 <- ppareto1 (Rpareto1, shape = 0.8, min = 2) 258s > Pinvburr <- pinvburr (Rinvburr, shape1 = 1.5, shape2 = 2, scale = 2) 258s > Pinvpareto <- pinvpareto (Rinvpareto, shape = 2, scale = 2) 258s > Pinvparalogis <- pinvparalogis(Rinvparalogis, shape = 2, scale = 2) 258s > Ptrgamma <- ptrgamma (Rtrgamma, shape1 = 2, shape2 = 3, scale = 5) 258s > Pinvtrgamma <- pinvtrgamma (Rinvtrgamma, shape1 = 2, shape2 = 3, scale = 5) 258s > Pinvgamma <- pinvgamma (Rinvgamma, shape = 2, scale = 5) 258s > Pinvweibull <- pinvweibull (Rinvweibull, shape = 3, scale = 5) 258s > Pinvexp <- pinvexp (Rinvexp, scale = 5) 258s > Plgamma <- plgamma(Rlgamma, shapelog = 1.5, ratelog = 5) 258s > Pgumbel <- pgumbel(Rgumbel, alpha = 2, scale = 5) 258s > Pinvgauss <- pinvgauss(Rinvgauss, mean = 2, dispersion = 5) 258s > Pgenbeta <- pgenbeta(Rgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > 258s > ## Just compute pdf 258s > Dfpareto <- dfpareto(Rfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > Dpareto4 <- dpareto4(Rpareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2) 258s > Dpareto3 <- dpareto3(Rpareto3, min = m, shape = 1.5, scale = 2) 258s > Dpareto2 <- dpareto2(Rpareto2, min = m, shape = 0.8, scale = 2) 258s > Dtrbeta <- dtrbeta (Rtrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > Dburr <- dburr (Rburr, shape1 = 0.8, shape2 = 1.5, scale = 2) 258s > Dllogis <- dllogis (Rllogis, shape = 1.5, scale = 2) 258s > Dparalogis <- dparalogis (Rparalogis, shape = 0.8, scale = 2) 258s > Dgenpareto <- dgenpareto (Rgenpareto, shape1 = 0.8, shape2 = 2, scale = 2) 258s > Dpareto <- dpareto (Rpareto, shape = 0.8, scale = 2) 258s > Dpareto1 <- dpareto1 (Rpareto1, shape = 0.8, min = 2) 258s > Dinvburr <- dinvburr (Rinvburr, shape1 = 1.5, shape2 = 2, scale = 2) 258s > Dinvpareto <- dinvpareto (Rinvpareto, shape = 2, scale = 2) 258s > Dinvparalogis <- dinvparalogis(Rinvparalogis, shape = 2, scale = 2) 258s > Dtrgamma <- dtrgamma (Rtrgamma, shape1 = 2, shape2 = 3, scale = 5) 258s > Dinvtrgamma <- dinvtrgamma (Rinvtrgamma, shape1 = 2, shape2 = 3, scale = 5) 258s > Dinvgamma <- dinvgamma (Rinvtrgamma, shape = 2, scale = 5) 258s > Dinvweibull <- dinvweibull (Rinvweibull, shape = 3, scale = 5) 258s > Dinvexp <- dinvexp (Rinvexp, scale = 5) 258s > Dlgamma <- dlgamma(Rlgamma, shapelog = 1.5, ratelog = 5) 258s > Dgumbel <- dgumbel(Rgumbel, alpha = 2, scale = 5) 258s > Dinvgauss <- dinvgauss(Rinvgauss, mean = 2, dispersion = 5) 258s > Dgenbeta <- dgenbeta(Rgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2) 258s > 258s > ## Check q(p(.)) identity 258s > stopifnot(exprs = { 258s + All.eq(Rfpareto, qfpareto(Pfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 258s + All.eq(Rpareto4, qpareto4(Ppareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2)) 258s + All.eq(Rpareto3, qpareto3(Ppareto3, min = m, shape = 1.5, scale = 2)) 258s + All.eq(Rpareto2, qpareto2(Ppareto2, min = m, shape = 0.8, scale = 2)) 258s + All.eq(Rtrbeta, qtrbeta (Ptrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 258s + All.eq(Rburr, qburr (Pburr, shape1 = 0.8, shape2 = 1.5, scale = 2)) 258s + All.eq(Rllogis, qllogis (Pllogis, shape = 1.5, scale = 2)) 258s + All.eq(Rparalogis, qparalogis (Pparalogis, shape = 0.8, scale = 2)) 258s + All.eq(Rgenpareto, qgenpareto (Pgenpareto, shape1 = 0.8, shape2 = 2, scale = 2)) 258s + All.eq(Rpareto, qpareto (Ppareto, shape = 0.8, scale = 2)) 258s + All.eq(Rpareto1, qpareto1 (Ppareto1, shape = 0.8, min = 2)) 258s + All.eq(Rinvburr, qinvburr (Pinvburr, shape1 = 1.5, shape2 = 2, scale = 2)) 258s + All.eq(Rinvpareto, qinvpareto (Pinvpareto, shape = 2, scale = 2)) 258s + All.eq(Rinvparalogis, qinvparalogis(Pinvparalogis, shape = 2, scale = 2)) 258s + All.eq(Rtrgamma, qtrgamma (Ptrgamma, shape1 = 2, shape2 = 3, scale = 5)) 258s + All.eq(Rinvtrgamma, qinvtrgamma (Pinvtrgamma, shape1 = 2, shape2 = 3, scale = 5)) 258s + All.eq(Rinvgamma, qinvgamma (Pinvgamma, shape = 2, scale = 5)) 258s + All.eq(Rinvweibull, qinvweibull (Pinvweibull, shape = 3, scale = 5)) 258s + All.eq(Rinvexp, qinvexp (Pinvexp, scale = 5)) 258s + All.eq(Rlgamma, qlgamma(Plgamma, shapelog = 1.5, ratelog = 5)) 258s + All.eq(Rgumbel, qgumbel(Pgumbel, alpha = 2, scale = 5)) 258s + All.eq(Rinvgauss, qinvgauss(Pinvgauss, mean = 2, dispersion = 5)) 258s + All.eq(Rgenbeta, qgenbeta(Pgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 258s + }) 258s > 258s > ## Check q(p(.)) identity for special cases 258s > stopifnot(exprs = { 258s + All.eq(Rfpareto - m, qtrbeta(Pfpareto, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2)) 258s + All.eq(Rpareto4 - m, qburr (Ppareto4, shape1 = 0.8, shape2 = 1.5, scale = 2)) 258s + All.eq(Rpareto3 - m, qllogis(Ppareto3, shape = 1.5, scale = 2)) 258s + All.eq(Rpareto2 - m, qpareto(Ppareto2, shape = 0.8, scale = 2)) 258s + }) 258s > 258s > ## Check q(p(.)) identity with upper tail 258s > stopifnot(exprs = { 258s + All.eq(Rfpareto, qfpareto(1 - Pfpareto, min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 258s + All.eq(Rpareto4, qpareto4(1 - Ppareto4, min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE)) 258s + All.eq(Rpareto3, qpareto3(1 - Ppareto3, min = m, shape = 1.5, scale = 2, lower = FALSE)) 258s + All.eq(Rpareto2, qpareto2(1 - Ppareto2, min = m, shape = 0.8, scale = 2, lower = FALSE)) 258s + All.eq(Rtrbeta, qtrbeta (1 - Ptrbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 258s + All.eq(Rburr, qburr (1 - Pburr, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE)) 258s + All.eq(Rllogis, qllogis (1 - Pllogis, shape = 1.5, scale = 2, lower = FALSE)) 258s + All.eq(Rparalogis, qparalogis (1 - Pparalogis, shape = 0.8, scale = 2, lower = FALSE)) 258s + All.eq(Rgenpareto, qgenpareto (1 - Pgenpareto, shape1 = 0.8, shape2 = 2, scale = 2, lower = FALSE)) 258s + All.eq(Rpareto, qpareto (1 - Ppareto, shape = 0.8, scale = 2, lower = FALSE)) 258s + All.eq(Rpareto1, qpareto1 (1 - Ppareto1, shape = 0.8, min = 2, lower = FALSE)) 258s + All.eq(Rinvburr, qinvburr (1 - Pinvburr, shape1 = 1.5, shape2 = 2, scale = 2, lower = FALSE)) 258s + All.eq(Rinvpareto, qinvpareto (1 - Pinvpareto, shape = 2, scale = 2, lower = FALSE)) 258s + All.eq(Rinvparalogis, qinvparalogis(1 - Pinvparalogis, shape = 2, scale = 2, lower = FALSE)) 258s + All.eq(Rtrgamma, qtrgamma (1 - Ptrgamma, shape1 = 2, shape2 = 3, scale = 5, lower = FALSE)) 258s + All.eq(Rinvtrgamma, qinvtrgamma (1 - Pinvtrgamma, shape1 = 2, shape2 = 3, scale = 5, lower = FALSE)) 258s + All.eq(Rinvgamma, qinvgamma (1 - Pinvgamma, shape = 2, scale = 5, lower = FALSE)) 258s + All.eq(Rinvweibull, qinvweibull (1 - Pinvweibull, shape = 3, scale = 5, lower = FALSE)) 258s + All.eq(Rinvexp, qinvexp (1 - Pinvexp, scale = 5, lower = FALSE)) 258s + All.eq(Rlgamma, qlgamma(1 - Plgamma, shapelog = 1.5, ratelog = 5, lower = FALSE)) 258s + All.eq(Rgumbel, qgumbel(1 - Pgumbel, alpha = 2, scale = 5, lower = FALSE)) 258s + All.eq(Rinvgauss, qinvgauss(1 - Pinvgauss, mean = 2, dispersion = 5, lower = FALSE)) 258s + All.eq(Rgenbeta, qgenbeta(1 - Pgenbeta, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE)) 258s + }) 258s > 258s > ## Check q(p(., log), log) identity 258s > stopifnot(exprs = { 258s + All.eq(Rfpareto, qfpareto(log(Pfpareto), min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 258s + All.eq(Rpareto4, qpareto4(log(Ppareto4), min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, log = TRUE)) 258s + All.eq(Rpareto3, qpareto3(log(Ppareto3), min = m, shape = 1.5, scale = 2, log = TRUE)) 258s + All.eq(Rpareto2, qpareto2(log(Ppareto2), min = m, shape = 0.8, scale = 2, log = TRUE)) 258s + All.eq(Rtrbeta, qtrbeta (log(Ptrbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 258s + All.eq(Rburr, qburr (log(Pburr), shape1 = 0.8, shape2 = 1.5, scale = 2, log = TRUE)) 258s + All.eq(Rllogis, qllogis (log(Pllogis), shape = 1.5, scale = 2, log = TRUE)) 258s + All.eq(Rparalogis, qparalogis (log(Pparalogis), shape = 0.8, scale = 2, log = TRUE)) 258s + All.eq(Rgenpareto, qgenpareto (log(Pgenpareto), shape1 = 0.8, shape2 = 2, scale = 2, log = TRUE)) 258s + All.eq(Rpareto, qpareto (log(Ppareto), shape = 0.8, scale = 2, log = TRUE)) 258s + All.eq(Rpareto1, qpareto1 (log(Ppareto1), shape = 0.8, min = 2, log = TRUE)) 258s + All.eq(Rinvburr, qinvburr (log(Pinvburr), shape1 = 1.5, shape2 = 2, scale = 2, log = TRUE)) 258s + All.eq(Rinvpareto, qinvpareto (log(Pinvpareto), shape = 2, scale = 2, log = TRUE)) 258s + All.eq(Rinvparalogis, qinvparalogis(log(Pinvparalogis), shape = 2, scale = 2, log = TRUE)) 258s + All.eq(Rtrgamma, qtrgamma (log(Ptrgamma), shape1 = 2, shape2 = 3, scale = 5, log = TRUE)) 258s + All.eq(Rinvtrgamma, qinvtrgamma (log(Pinvtrgamma), shape1 = 2, shape2 = 3, scale = 5, log = TRUE)) 258s + All.eq(Rinvgamma, qinvgamma (log(Pinvgamma), shape = 2, scale = 5, log = TRUE)) 258s + All.eq(Rinvweibull, qinvweibull (log(Pinvweibull), shape = 3, scale = 5, log = TRUE)) 258s + All.eq(Rinvexp, qinvexp (log(Pinvexp), scale = 5, log = TRUE)) 258s + All.eq(Rlgamma, qlgamma(log(Plgamma), shapelog = 1.5, ratelog = 5, log = TRUE)) 258s + All.eq(Rgumbel, qgumbel(log(Pgumbel), alpha = 2, scale = 5, log = TRUE)) 258s + All.eq(Rinvgauss, qinvgauss(log(Pinvgauss), mean = 2, dispersion = 5, log = TRUE)) 258s + All.eq(Rgenbeta, qgenbeta(log(Pgenbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, log = TRUE)) 258s + }) 258s > 258s > ## Check q(p(., log), log) identity with upper tail 258s > stopifnot(exprs = { 258s + All.eq(Rfpareto, qfpareto(log1p(-Pfpareto), min = m, shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rpareto4, qpareto4(log1p(-Ppareto4), min = m, shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rpareto3, qpareto3(log1p(-Ppareto3), min = m, shape = 1.5, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rpareto2, qpareto2(log1p(-Ppareto2), min = m, shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rtrbeta, qtrbeta (log1p(-Ptrbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rburr, qburr (log1p(-Pburr), shape1 = 0.8, shape2 = 1.5, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rllogis, qllogis (log1p(-Pllogis), shape = 1.5, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rparalogis, qparalogis (log1p(-Pparalogis), shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rgenpareto, qgenpareto (log1p(-Pgenpareto), shape1 = 0.8, shape2 = 2, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rpareto, qpareto (log1p(-Ppareto), shape = 0.8, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rpareto1, qpareto1 (log1p(-Ppareto1), shape = 0.8, min = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvburr, qinvburr (log1p(-Pinvburr), shape1 = 1.5, shape2 = 2, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvpareto, qinvpareto (log1p(-Pinvpareto), shape = 2, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvparalogis, qinvparalogis(log1p(-Pinvparalogis), shape = 2, scale = 2, lower = FALSE, log = TRUE)) 258s + All.eq(Rtrgamma, qtrgamma (log1p(-Ptrgamma), shape1 = 2, shape2 = 3, scale = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvtrgamma, qinvtrgamma (log1p(-Pinvtrgamma), shape1 = 2, shape2 = 3, scale = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvgamma, qinvgamma (log1p(-Pinvgamma), shape = 2, scale = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvweibull, qinvweibull (log1p(-Pinvweibull), shape = 3, scale = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvexp, qinvexp (log1p(-Pinvexp), scale = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rlgamma, qlgamma(log1p(-Plgamma), shapelog = 1.5, ratelog = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rgumbel, qgumbel(log1p(-Pgumbel), alpha = 2, scale = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rinvgauss, qinvgauss(log1p(-Pinvgauss), mean = 2, dispersion = 5, lower = FALSE, log = TRUE)) 258s + All.eq(Rgenbeta, qgenbeta(log1p(-Pgenbeta), shape1 = 0.8, shape2 = 1.5, shape3 = 2, scale = 2, lower = FALSE, log = TRUE)) 258s + }) 258s > 258s > 258s > ### 258s > ### DISCRETE DISTRIBUTIONS 258s > ### 258s > 258s > ## Reset seed 258s > set.seed(123) 258s > 258s > ## Define a small function to compute probabilities for the (a, b, 1) 258s > ## family of discrete distributions using the recursive relation 258s > ## 258s > ## p[k] = (a + b/k)p[k - 1], k = 2, 3, ... 258s > ## 258s > ## for a, b and p[1] given. 258s > dab1 <- function(x, a, b, p1) 258s + { 258s + x <- floor(x) 258s + if (x < 1) 258s + stop("recursive computations possible for x >= 2 only") 258s + for (k in seq(2, length.out = x - 1)) 258s + { 258s + p2 <- (a + b/k) * p1 258s + p1 <- p2 258s + } 258s + p1 258s + } 258s > 258s > ## ZERO-TRUNCATED (a, b, 1) CLASS 258s > 258s > ## Tests on the probability mass function: 258s > ## 258s > ## 1. probability is 0 at x = 0; 258s > ## 2. pmf satisfies the recursive relation 258s > lambda <- rlnorm(30, 2) # Poisson parameters 258s > r <- lambda # size for negative binomial 258s > prob <- runif(30) # probs 258s > size <- round(lambda) # size for binomial 258s > stopifnot(exprs = { 258s + dztpois(0, lambda) == 0 258s + dztnbinom(0, r, prob) == 0 258s + dztgeom(0, prob) == 0 258s + dztbinom(0, size, prob) == 0 258s + dlogarithmic(0, prob) == 0 258s + }) 258s > 258s > x <- sapply(size, sample, size = 1) 258s > stopifnot(exprs = { 258s + All.eq(dztpois(x, lambda), 258s + mapply(dab1, x, 258s + a = 0, 258s + b = lambda, 258s + p1 = lambda/(exp(lambda) - 1))) 258s + All.eq(dztnbinom(x, r, prob), 258s + mapply(dab1, x, 258s + a = 1 - prob, 258s + b = (r - 1) * (1 - prob), 258s + p1 = r * prob^r * (1 - prob)/(1 - prob^r))) 258s + All.eq(dztgeom(x, prob), 258s + mapply(dab1, x, 258s + a = 1 - prob, 258s + b = 0, 258s + p1 = prob)) 258s + All.eq(dztbinom(x, size, prob), 258s + mapply(dab1, x, 258s + a = -prob/(1 - prob), 258s + b = (size + 1) * prob/(1 - prob), 258s + p1 = size * prob * (1 - prob)^(size - 1)/(1 - (1 - prob)^size))) 258s + All.eq(dlogarithmic(x, prob), 258s + mapply(dab1, x, 258s + a = prob, 258s + b = -prob, 258s + p1 = -prob/log1p(-prob))) 258s + }) 258s > 258s > ## Tests on cumulative distribution function. 258s > for (l in lambda) 258s + stopifnot(exprs = { 258s + all.equal(cumsum(dztpois(0:20, l)), 258s + pztpois(0:20, l), 258s + tolerance = 1e-8) 258s + }) 258s > for (i in seq_along(r)) 258s + stopifnot(exprs = { 258s + all.equal(cumsum(dztnbinom(0:20, r[i], prob[i])), 258s + pztnbinom(0:20, r[i], prob[i]), 258s + tolerance = 1e-8) 258s + }) 258s > for (i in seq_along(r)) 258s + stopifnot(exprs = { 258s + all.equal(cumsum(dztgeom(0:20, prob[i])), 258s + pztgeom(0:20, prob[i]), 258s + tolerance = 1e-8) 258s + }) 258s > for (i in seq_along(size)) 258s + stopifnot(exprs = { 258s + all.equal(cumsum(dztbinom(0:20, size[i], prob[i])), 258s + pztbinom(0:20, size[i], prob[i]), 258s + tolerance = 1e-8) 258s + }) 258s > for (p in prob) 258s + stopifnot(exprs = { 258s + all.equal(cumsum(dlogarithmic(0:20, p)), 258s + plogarithmic(0:20, p), 258s + tolerance = 1e-8) 258s + }) 258s > 258s > ## ZERO-MODIFIED (a, b, 1) CLASS 258s > 258s > ## Tests on the probability mass function: 258s > ## 258s > ## 1. probability is p0 at x = 0 (trivial, but...); 258s > ## 2. pmf satisfies the recursive relation 258s > lambda <- rlnorm(30, 2) # Poisson parameters 258s > r <- lambda # size for negative binomial 258s > prob <- runif(30) # probs 258s > size <- round(lambda) # size for binomial 258s > p0 <- runif(30) # probs at 0 258s > stopifnot(exprs = { 258s + dzmpois(0, lambda, p0) == p0 258s + dzmnbinom(0, r, prob, p0) == p0 258s + dzmgeom(0, prob, p0) == p0 258s + dzmbinom(0, size, prob, p0) == p0 258s + dzmlogarithmic(0, prob, p0) == p0 258s + }) 258s > 258s > x <- sapply(size, sample, size = 1) 258s > stopifnot(exprs = { 258s + All.eq(dzmpois(x, lambda, p0), 258s + mapply(dab1, x, 258s + a = 0, 258s + b = lambda, 258s + p1 = (1 - p0) *lambda/(exp(lambda) - 1))) 258s + All.eq(dzmnbinom(x, r, prob, p0), 258s + mapply(dab1, x, 258s + a = 1 - prob, 258s + b = (r - 1) * (1 - prob), 258s + p1 = (1 - p0) * r * prob^r * (1 - prob)/(1 - prob^r))) 258s + All.eq(dzmgeom(x, prob, p0), 258s + mapply(dab1, x, 258s + a = 1 - prob, 258s + b = 0, 258s + p1 = (1 - p0) * prob)) 258s + All.eq(dzmbinom(x, size, prob, p0), 258s + mapply(dab1, x, 258s + a = -prob/(1 - prob), 258s + b = (size + 1) * prob/(1 - prob), 258s + p1 = (1 - p0) * size * prob * (1 - prob)^(size - 1)/(1 - (1 - prob)^size))) 258s + All.eq(dzmlogarithmic(x, prob, p0), 258s + mapply(dab1, x, 258s + a = prob, 258s + b = -prob, 258s + p1 = -(1 - p0) * prob/log1p(-prob))) 258s + }) 258s > 258s > ## Tests on cumulative distribution function. 258s > for (i in seq_along(lambda)) 258s + stopifnot(exprs = { 258s + all.equal(cumsum(dzmpois(0:20, lambda[i], p0 = p0[i])), 258s + pzmpois(0:20, lambda[i], p0 = p0[i]), 258s + tolerance = 1e-8) 258s + }) 258s > for (i in seq_along(r)) 258s + stopifnot(exprs = { 258s + all.equal(cumsum(dzmnbinom(0:20, r[i], prob[i], p0[i])), 258s + pzmnbinom(0:20, r[i], prob[i], p0[i]), 258s + tolerance = 1e-8) 258s + }) 259s > for (i in seq_along(r)) 259s + stopifnot(exprs = { 259s + all.equal(cumsum(dzmgeom(0:20, prob[i], p0[i])), 259s + pzmgeom(0:20, prob[i], p0[i]), 259s + tolerance = 1e-8) 259s + }) 259s > for (i in seq_along(size)) 259s + stopifnot(exprs = { 259s + all.equal(cumsum(dzmbinom(0:20, size[i], prob[i], p0[i])), 259s + pzmbinom(0:20, size[i], prob[i], p0[i]), 259s + tolerance = 1e-8) 259s + }) 259s > for (i in seq_along(prob)) 259s + stopifnot(exprs = { 259s + all.equal(cumsum(dzmlogarithmic(0:20, prob[i], p0[i])), 259s + pzmlogarithmic(0:20, prob[i], p0[i]), 259s + tolerance = 1e-8) 259s + }) 259s > 259s > ## POISSON-INVERSE GAUSSIAN 259s > 259s > ## Reset seed 259s > set.seed(123) 259s > 259s > ## Define a small function to compute probabilities for the PIG 259s > ## directly using the Bessel function. 259s > dpigBK <- function(x, mu, phi) 259s + { 259s + M_LN2 <- 0.693147180559945309417232121458 259s + M_SQRT_2dPI <- 0.225791352644727432363097614947 259s + 259s + phimu <- phi * mu 259s + lphi <- log(phi) 259s + y <- x - 0.5 259s + 259s + logA = -lphi/2 - M_SQRT_2dPI 259s + logB = (M_LN2 + lphi + log1p(1/(2 * phimu * mu)))/2; 259s + 259s + exp(logA + 1/phimu - lfactorial(x) - y * logB) * 259s + besselK(exp(logB - lphi), y) 259s + } 259s > 259s > ## Tests on the probability mass function. 259s > mu <- rlnorm(30, 2) 259s > phi <- rlnorm(30, 2) 259s > x <- 0:100 259s > for (i in seq_along(phi)) 259s + { 259s + stopifnot(exprs = { 259s + all.equal(dpoisinvgauss(x, mean = mu[i], dispersion = phi[i]), 259s + dpigBK(x, mu[i], phi[i])) 259s + all.equal(dpoisinvgauss(x, mean = Inf, dispersion = phi[i]), 259s + dpigBK(x, Inf, phi[i])) 259s + }) 259s + } 259s > 259s > ## Tests on cumulative distribution function. 259s > for (i in seq_along(phi)) 259s + stopifnot(exprs = { 259s + all.equal(cumsum(dpoisinvgauss(0:20, mu[i], phi[i])), 259s + ppoisinvgauss(0:20, mu[i], phi[i]), 259s + tolerance = 1e-8) 259s + all.equal(cumsum(dpoisinvgauss(0:20, Inf, phi[i])), 259s + ppoisinvgauss(0:20, Inf, phi[i]), 259s + tolerance = 1e-8) 259s + }) 259s > 259s > ## 259s > ## RANDOM NUMBERS (all discrete distributions) 259s > ## 259s > set.seed(123) 259s > n <- 20 259s > 259s > ## Generate variates. 259s > ## 259s > ## For zero-modified distributions, we simulate two sets of values: 259s > ## one with p0m < p0 (suffix 'p0lt') and one with p0m > p0 (suffix 259s > ## 'p0gt'). 259s > Rztpois <- rztpois (n, lambda = 12) 259s > Rztnbinom <- rztnbinom (n, size = 7, prob = 0.01) 259s > Rztgeom <- rztgeom (n, prob = pi/16) 259s > Rztbinom <- rztbinom (n, size = 55, prob = pi/16) 259s > Rlogarithmic <- rlogarithmic(n, prob = 0.99) 259s > Rzmpoisp0lt <- rzmpois (n, lambda = 6, p0 = 0.001) 259s > Rzmpoisp0gt <- rzmpois (n, lambda = 6, p0 = 0.010) 259s > Rzmnbinomp0lt <- rzmnbinom (n, size = 7, prob = 0.8, p0 = 0.01) 259s > Rzmnbinomp0gt <- rzmnbinom (n, size = 7, prob = 0.8, p0 = 0.40) 259s > Rzmgeomp0lt <- rzmgeom (n, prob = pi/16, p0 = 0.01) 259s > Rzmgeomp0gt <- rzmgeom (n, prob = pi/16, p0 = 0.40) 259s > Rzmbinomp0lt <- rzmbinom (n, size = 12, prob = pi/16, p0 = 0.01) 259s > Rzmbinomp0gt <- rzmbinom (n, size = 12, prob = pi/16, p0 = 0.12) 259s > Rzmlogarithmicp0lt <- rzmlogarithmic(n, prob = 0.99, p0 = 0.05) 259s > Rzmlogarithmicp0gt <- rzmlogarithmic(n, prob = 0.99, p0 = 0.55) 259s > Rpoisinvgauss <- rpoisinvgauss(n, mean = 12, dispersion = 0.1) 259s > RpoisinvgaussInf <- rpoisinvgauss(n, mean = Inf, dispersion = 1.1) 259s > 259s > ## Compute quantiles 259s > Pztpois <- pztpois (Rztpois, lambda = 12) 259s > Pztnbinom <- pztnbinom (Rztnbinom, size = 7, prob = 0.01) 259s > Pztgeom <- pztgeom (Rztgeom, prob = pi/16) 259s > Pztbinom <- pztbinom (Rztbinom, size = 55, prob = pi/16) 259s > Plogarithmic <- plogarithmic(Rlogarithmic, prob = 0.99) 259s > Pzmpoisp0lt <- pzmpois (Rzmpoisp0lt, lambda = 6, p0 = 0.001) 259s > Pzmpoisp0gt <- pzmpois (Rzmpoisp0gt, lambda = 6, p0 = 0.010) 259s > Pzmnbinomp0lt <- pzmnbinom (Rzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 259s > Pzmnbinomp0gt <- pzmnbinom (Rzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 259s > Pzmgeomp0lt <- pzmgeom (Rzmgeomp0lt, prob = pi/16, p0 = 0.01) 259s > Pzmgeomp0gt <- pzmgeom (Rzmgeomp0gt, prob = pi/16, p0 = 0.40) 259s > Pzmbinomp0lt <- pzmbinom (Rzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 259s > Pzmbinomp0gt <- pzmbinom (Rzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 259s > Pzmlogarithmicp0lt <- pzmlogarithmic(Rzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 259s > Pzmlogarithmicp0gt <- pzmlogarithmic(Rzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 259s > Ppoisinvgauss <- ppoisinvgauss(Rpoisinvgauss, mean = 12, dispersion = 0.1) 259s > PpoisinvgaussInf <- ppoisinvgauss(RpoisinvgaussInf, mean = Inf, dispersion = 1.1) 259s > 259s > ## Just compute pmf 259s > Dztpois <- dztpois (Rztpois, lambda = 12) 259s > Dztnbinom <- dztnbinom (Rztnbinom, size = 7, prob = 0.01) 259s > Dztgeom <- dztgeom (Rztgeom, prob = pi/16) 259s > Dztbinom <- dztbinom (Rztbinom, size = 55, prob = pi/16) 259s > Dlogarithmic <- dlogarithmic(Rlogarithmic, prob = pi/16) 259s > Dzmpoisp0lt <- dzmpois (Rzmpoisp0lt, lambda = 6, p0 = 0.001) 259s > Dzmpoisp0gt <- dzmpois (Rzmpoisp0gt, lambda = 6, p0 = 0.010) 259s > Dzmnbinomp0lt <- dzmnbinom (Rzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 259s > Dzmnbinomp0gt <- dzmnbinom (Rzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 259s > Dzmgeomp0lt <- dzmgeom (Rzmgeomp0lt, prob = pi/16, p0 = 0.01) 259s > Dzmgeomp0gt <- dzmgeom (Rzmgeomp0gt, prob = pi/16, p0 = 0.40) 259s > Dzmbinomp0lt <- dzmbinom (Rzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 259s > Dzmbinomp0gt <- dzmbinom (Rzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 259s > Dzmlogarithmicp0lt <- dzmlogarithmic(Rzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 259s > Dzmlogarithmicp0gt <- dzmlogarithmic(Rzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 259s > Dpoisinvgauss <- dpoisinvgauss(Rpoisinvgauss, mean = 12, dispersion = 0.1) 259s > DpoisinvgaussInf <- dpoisinvgauss(RpoisinvgaussInf, mean = Inf, dispersion = 1.1) 259s > 259s > ## Check q(p(.)) identity 259s > stopifnot(exprs = { 259s + Rztpois == qztpois (Pztpois, lambda = 12) 259s + Rztnbinom == qztnbinom (Pztnbinom, size = 7, prob = 0.01) 259s + Rztgeom == qztgeom (Pztgeom, prob = pi/16) 259s + Rztbinom == qztbinom (Pztbinom, size = 55, prob = pi/16) 259s + Rlogarithmic == qlogarithmic(Plogarithmic, prob = 0.99) 259s + Rzmpoisp0lt == qzmpois (Pzmpoisp0lt, lambda = 6, p0 = 0.001) 259s + Rzmpoisp0gt == qzmpois (Pzmpoisp0gt, lambda = 6, p0 = 0.010) 259s + Rzmnbinomp0lt == qzmnbinom (Pzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01) 259s + Rzmnbinomp0gt == qzmnbinom (Pzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40) 259s + Rzmgeomp0lt == qzmgeom (Pzmgeomp0lt, prob = pi/16, p0 = 0.01) 259s + Rzmgeomp0gt == qzmgeom (Pzmgeomp0gt, prob = pi/16, p0 = 0.40) 259s + Rzmbinomp0lt == qzmbinom (Pzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01) 259s + Rzmbinomp0gt == qzmbinom (Pzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12) 259s + Rzmlogarithmicp0lt == qzmlogarithmic(Pzmlogarithmicp0lt, prob = 0.99, p0 = 0.05) 259s + Rzmlogarithmicp0gt == qzmlogarithmic(Pzmlogarithmicp0gt, prob = 0.99, p0 = 0.55) 259s + Rpoisinvgauss == qpoisinvgauss(Ppoisinvgauss, mean = 12, dispersion = 0.1) 259s + RpoisinvgaussInf == qpoisinvgauss(PpoisinvgaussInf, mean = Inf, dispersion = 1.1) 259s + }) 260s > 260s > ## Check q(p(.)) identity with upper tail 260s > stopifnot(exprs = { 260s + Rztpois == qztpois (1 - Pztpois, lambda = 12, lower = FALSE) 260s + Rztnbinom == qztnbinom (1 - Pztnbinom, size = 7, prob = 0.01, lower = FALSE) 260s + Rztgeom == qztgeom (1 - Pztgeom, prob = pi/16, lower = FALSE) 260s + Rztbinom == qztbinom (1 - Pztbinom, size = 55, prob = pi/16, lower = FALSE) 260s + Rlogarithmic == qlogarithmic(1 - Plogarithmic, prob = 0.99, lower = FALSE) 260s + Rzmpoisp0lt == qzmpois (1 - Pzmpoisp0lt, lambda = 6, p0 = 0.001, lower = FALSE) 260s + Rzmpoisp0gt == qzmpois (1 - Pzmpoisp0gt, lambda = 6, p0 = 0.010, lower = FALSE) 260s + Rzmnbinomp0lt == qzmnbinom (1 - Pzmnbinomp0lt, size = 7, prob = 0.8, p0 = 0.01, lower = FALSE) 260s + Rzmnbinomp0gt == qzmnbinom (1 - Pzmnbinomp0gt, size = 7, prob = 0.8, p0 = 0.40, lower = FALSE) 260s + Rzmgeomp0lt == qzmgeom (1 - Pzmgeomp0lt, prob = pi/16, p0 = 0.01, lower = FALSE) 260s + Rzmgeomp0gt == qzmgeom (1 - Pzmgeomp0gt, prob = pi/16, p0 = 0.40, lower = FALSE) 260s + Rzmbinomp0lt == qzmbinom (1 - Pzmbinomp0lt, size = 12, prob = pi/16, p0 = 0.01, lower = FALSE) 260s + Rzmbinomp0gt == qzmbinom (1 - Pzmbinomp0gt, size = 12, prob = pi/16, p0 = 0.12, lower = FALSE) 260s + Rzmlogarithmicp0lt == qzmlogarithmic(1 - Pzmlogarithmicp0lt, prob = 0.99, p0 = 0.05, lower = FALSE) 260s + Rzmlogarithmicp0gt == qzmlogarithmic(1 - Pzmlogarithmicp0gt, prob = 0.99, p0 = 0.55, lower = FALSE) 260s + Rpoisinvgauss == qpoisinvgauss(1 - Ppoisinvgauss, mean = 12, dispersion = 0.1, lower = FALSE) 260s + RpoisinvgaussInf == qpoisinvgauss(1 - PpoisinvgaussInf, mean = Inf, dispersion = 1.1, lower = FALSE) 260s + }) 261s > 261s > ## Check q(p(., log), log) identity 261s > stopifnot(exprs = { 261s + Rztpois == qztpois (log(Pztpois), lambda = 12, log = TRUE) 261s + Rztnbinom == qztnbinom (log(Pztnbinom), size = 7, prob = 0.01, log = TRUE) 261s + Rztgeom == qztgeom (log(Pztgeom), prob = pi/16, log = TRUE) 261s + Rztbinom == qztbinom (log(Pztbinom), size = 55, prob = pi/16, log = TRUE) 261s + Rlogarithmic == qlogarithmic(log(Plogarithmic), prob = 0.99, log = TRUE) 261s + Rzmpoisp0lt == qzmpois (log(Pzmpoisp0lt), lambda = 6, p0 = 0.001, log = TRUE) 261s + Rzmpoisp0gt == qzmpois (log(Pzmpoisp0gt), lambda = 6, p0 = 0.010, log = TRUE) 261s + Rzmnbinomp0lt == qzmnbinom (log(Pzmnbinomp0lt), size = 7, prob = 0.8, p0 = 0.01, log = TRUE) 261s + Rzmnbinomp0gt == qzmnbinom (log(Pzmnbinomp0gt), size = 7, prob = 0.8, p0 = 0.40, log = TRUE) 261s + Rzmgeomp0lt == qzmgeom (log(Pzmgeomp0lt), prob = pi/16, p0 = 0.01, log = TRUE) 261s + Rzmgeomp0gt == qzmgeom (log(Pzmgeomp0gt), prob = pi/16, p0 = 0.40, log = TRUE) 261s + Rzmbinomp0lt == qzmbinom (log(Pzmbinomp0lt), size = 12, prob = pi/16, p0 = 0.01, log = TRUE) 261s + Rzmbinomp0gt == qzmbinom (log(Pzmbinomp0gt), size = 12, prob = pi/16, p0 = 0.12, log = TRUE) 261s + Rzmlogarithmicp0lt == qzmlogarithmic(log(Pzmlogarithmicp0lt), prob = 0.99, p0 = 0.05, log = TRUE) 261s + Rzmlogarithmicp0gt == qzmlogarithmic(log(Pzmlogarithmicp0gt), prob = 0.99, p0 = 0.55, log = TRUE) 261s + Rpoisinvgauss == qpoisinvgauss(log(Ppoisinvgauss), mean = 12, dispersion = 0.1, log = TRUE) 261s + RpoisinvgaussInf == qpoisinvgauss(log(PpoisinvgaussInf), mean = Inf, dispersion = 1.1, log = TRUE) 261s + }) 262s > 262s > ## Check q(p(., log), log) identity with upper tail 262s > stopifnot(exprs = { 262s + Rztpois == qztpois (log1p(-Pztpois), lambda = 12, lower = FALSE, log = TRUE) 262s + Rztnbinom == qztnbinom (log1p(-Pztnbinom), size = 7, prob = 0.01, lower = FALSE, log = TRUE) 262s + Rztgeom == qztgeom (log1p(-Pztgeom), prob = pi/16, lower = FALSE, log = TRUE) 262s + Rztbinom == qztbinom (log1p(-Pztbinom), size = 55, prob = pi/16, lower = FALSE, log = TRUE) 262s + Rlogarithmic == qlogarithmic(log1p(-Plogarithmic), prob = 0.99, lower = FALSE, log = TRUE) 262s + Rzmpoisp0lt == qzmpois (log1p(-Pzmpoisp0lt), lambda = 6, p0 = 0.001, lower = FALSE, log = TRUE) 262s + Rzmpoisp0gt == qzmpois (log1p(-Pzmpoisp0gt), lambda = 6, p0 = 0.010, lower = FALSE, log = TRUE) 262s + Rzmnbinomp0lt == qzmnbinom (log1p(-Pzmnbinomp0lt), size = 7, prob = 0.8, p0 = 0.01, lower = FALSE, log = TRUE) 262s + Rzmnbinomp0gt == qzmnbinom (log1p(-Pzmnbinomp0gt), size = 7, prob = 0.8, p0 = 0.40, lower = FALSE, log = TRUE) 262s + Rzmgeomp0lt == qzmgeom (log1p(-Pzmgeomp0lt), prob = pi/16, p0 = 0.01, lower = FALSE, log = TRUE) 262s + Rzmgeomp0gt == qzmgeom (log1p(-Pzmgeomp0gt), prob = pi/16, p0 = 0.40, lower = FALSE, log = TRUE) 262s + Rzmbinomp0lt == qzmbinom (log1p(-Pzmbinomp0lt), size = 12, prob = pi/16, p0 = 0.01, lower = FALSE, log = TRUE) 262s + Rzmbinomp0gt == qzmbinom (log1p(-Pzmbinomp0gt), size = 12, prob = pi/16, p0 = 0.12, lower = FALSE, log = TRUE) 262s + Rzmlogarithmicp0lt == qzmlogarithmic(log1p(-Pzmlogarithmicp0lt), prob = 0.99, p0 = 0.05, lower = FALSE, log = TRUE) 262s + Rzmlogarithmicp0gt == qzmlogarithmic(log1p(-Pzmlogarithmicp0gt), prob = 0.99, p0 = 0.55, lower = FALSE, log = TRUE) 262s + Rpoisinvgauss == qpoisinvgauss(log1p(-Ppoisinvgauss), mean = 12, dispersion = 0.1, lower = FALSE, log = TRUE) 262s + RpoisinvgaussInf == qpoisinvgauss(log1p(-PpoisinvgaussInf), mean = Inf, dispersion = 1.1, lower = FALSE, log = TRUE) 262s + }) 263s > 263s BEGIN TEST rcompound-tests.R 263s 263s R version 4.4.3 (2025-02-28) -- "Trophy Case" 263s Copyright (C) 2025 The R Foundation for Statistical Computing 263s Platform: aarch64-unknown-linux-gnu 263s 263s R is free software and comes with ABSOLUTELY NO WARRANTY. 263s You are welcome to redistribute it under certain conditions. 263s Type 'license()' or 'licence()' for distribution details. 263s 263s R is a collaborative project with many contributors. 263s Type 'contributors()' for more information and 263s 'citation()' on how to cite R or R packages in publications. 263s 263s Type 'demo()' for some demos, 'help()' for on-line help, or 263s 'help.start()' for an HTML browser interface to help. 263s Type 'q()' to quit R. 263s 263s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 263s > ### 263s > ### Tests for the simulation of compound models with 'rcompound' and 263s > ### 'rcomppois'. 263s > ### 263s > ### AUTHOR: Vincent Goulet 263s > 263s > ## Load the package 263s > library(actuar) 263s > 263s > ## Copy of tools::assertError. 263s > assertError <- tools::assertError 263s 263s Attaching package: ‘actuar’ 263s 263s The following objects are masked from ‘package:stats’: 263s 263s sd, var 263s 263s The following object is masked from ‘package:grDevices’: 263s 263s cm 263s 263s > 263s > ### 263s > ### Tests for rcompound 263s > ### 263s > 263s > ## Test the function itself with various types of arguments. 263s > n <- 20 263s > fmodel <- expression(rnbinom(2, 0.8)) 263s > smodel <- expression(rgamma(2, 1)) 263s > set.seed(123) 263s > x <- numeric(n) 263s > N <- rnbinom(n, 2, 0.8) 263s > y <- rgamma(sum(N), 2, 1) 263s > x[which(N != 0)] <- tapply(y, rep(seq_len(n), N), sum) 263s > stopifnot(exprs = { 263s + identical(x, { 263s + set.seed(123) 263s + rcompound(n, rnbinom(2, 0.8), rgamma(2, 1)) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + rcompound(n, rnbinom(2, 0.8), expression(rgamma(2, 1))) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + rcompound(n, expression(rnbinom(2, 0.8)), rgamma(2, 1)) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + rcompound(n, fmodel, smodel) 263s + }) 263s + }) 263s > 263s > ## Test the calling environment, that is that arguments are correctly 263s > ## identified when 'rcompound' is called inside another function. 263s > n <- 20 263s > lambda <- 2 263s > smodel <- expression(rgamma(2, 1)) 263s > set.seed(123) 263s > x <- rcompound(n, rpois(2), rgamma(2, 1)) 263s > f <- function(n, p, model.sev) 263s + { 263s + ## safe way to pass down the arguments 263s + model.freq <- substitute(rpois(p), list(p = p)) 263s + model.sev <- substitute(model.sev) 263s + if (is.name(model.sev)) 263s + model.sev <- eval.parent(model.sev) 263s + rcompound(n, model.freq, model.sev) 263s + } 263s > g1 <- function(n, p, s, r) 263s + rcompound(n, rpois(p), rgamma(s, r)) 263s > g2 <- function(n, p, s, r) 263s + rcompound(n, expression(rpois(p)), expression(rgamma(s, r))) 263s > h <- function(n, p, model.sev) 263s + { 263s + ## safe way to pass down the arguments 263s + model.sev <- substitute(model.sev) 263s + if (is.name(model.sev)) 263s + model.sev <- eval.parent(model.sev) 263s + f(n, p, model.sev) 263s + } 263s > stopifnot(exprs = { 263s + identical(x, { 263s + set.seed(123) 263s + f(n, 2, rgamma(2, 1)) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + f(n, lambda, expression(rgamma(2, 1))) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + f(n, lambda, smodel) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + g1(n, lambda, 2, 1) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + g2(n, lambda, 2, 1) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + h(n, 2, rgamma(2, 1)) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + h(n, lambda, smodel) 263s + }) 263s + }) 263s > 263s > ## Test invalid arguments. 263s > assertError(rcompound(-1, rpois(2), rgamma(2, 1))) 263s > 263s > 263s > ### 263s > ### Tests for rcomppois 263s > ### 263s > 263s > ## Test the function itself with various types of arguments. 263s > n <- 20 263s > lambda <- 2 263s > smodel <- expression(rgamma(2, 1)) 263s > set.seed(123) 263s > x <- numeric(n) 263s > N <- rpois(n, 2) 263s > y <- rgamma(sum(N), 2, 1) 263s > x[which(N != 0)] <- tapply(y, rep(seq_len(n), N), sum) 263s > stopifnot(exprs = { 263s + identical(x, { 263s + set.seed(123) 263s + rcomppois(n, 2, rgamma(2, 1)) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + rcomppois(n, lambda, expression(rgamma(2, 1))) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + rcomppois(n, lambda, smodel) 263s + }) 263s + }) 263s > 263s > ## Test the calling environment, that is that arguments are correctly 263s > ## identified when 'rcomppois' is called inside another function. 263s > n <- 20 263s > lambda <- 2 263s > smodel <- expression(rgamma(2, 1)) 263s > set.seed(123) 263s > x <- rcomppois(n, lambda, smodel) 263s > f <- function(n, p, model) 263s + { 263s + ## safe way to pass down all sorts of 'model' objects 263s + model <- substitute(model) 263s + if (is.name(model)) 263s + model <- eval.parent(model) 263s + rcomppois(n, p, model) 263s + } 263s > g1 <- function(n, p, s, r) 263s + rcomppois(n, p, rgamma(s, r)) 263s > g2 <- function(n, p, s, r) 263s + rcomppois(n, p, expression(rgamma(s, r))) 263s > h <- function(n, p, model) 263s + { 263s + ## safe way to pass down all sorts of 'model' objects 263s + model <- substitute(model) 263s + if (is.name(model)) 263s + model <- eval.parent(model) 263s + f(n, p, model) 263s + } 263s > stopifnot(exprs = { 263s + identical(x, { 263s + set.seed(123) 263s + f(n, 2, rgamma(2, 1)) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + f(n, lambda, expression(rgamma(2, 1))) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + f(n, lambda, smodel) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + g1(n, 2, 2, 1) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + g2(n, 2, 2, 1) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + h(n, 2, rgamma(2, 1)) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + h(n, lambda, smodel) 263s + }) 263s + }) 263s > 263s > ## Test invalid arguments. 263s > assertError(rcomppois(-1, lambda, smodel)) 263s > assertError(rcomppois(n, -1, smodel)) 263s > assertError(rcomppois(n, c(3, -1), smodel)) 263s > 263s BEGIN TEST rmixture-tests.R 263s 263s R version 4.4.3 (2025-02-28) -- "Trophy Case" 263s Copyright (C) 2025 The R Foundation for Statistical Computing 263s Platform: aarch64-unknown-linux-gnu 263s 263s R is free software and comes with ABSOLUTELY NO WARRANTY. 263s You are welcome to redistribute it under certain conditions. 263s Type 'license()' or 'licence()' for distribution details. 263s 263s R is a collaborative project with many contributors. 263s Type 'contributors()' for more information and 263s 'citation()' on how to cite R or R packages in publications. 263s 263s Type 'demo()' for some demos, 'help()' for on-line help, or 263s 'help.start()' for an HTML browser interface to help. 263s Type 'q()' to quit R. 263s 263s > ### actuar: Actuarial Functions and Heavy Tailed Distributions 263s > ### 263s > ### Tests for the simulation of discrete mixtures with 'rmixture'. 263s > ### 263s > ### AUTHOR: Vincent Goulet 263s > 263s > ## Load the package 263s > library(actuar) 263s 263s Attaching package: ‘actuar’ 263s 263s The following objects are masked from ‘package:stats’: 263s 263s sd, var 263s 263s The following object is masked from ‘package:grDevices’: 263s 263s cm 263s 263s > 263s > ## Copy of tools::assertError. 263s > assertError <- tools::assertError 263s > 263s > ## Set common values for the tests 263s > n <- 20 263s > bmodels <- expression(rexp(1/20), 263s + rlnorm(3.6, 0.6), 263s + rpareto(shape = 4, scale = 240)) 263s > 263s > ## Function to inject the number of variates in an expression and 263s > ## evaluate it. 263s > f <- function(n, expr) 263s + { 263s + expr$n <- n 263s + eval(expr) 263s + } 263s > 263s > ## Test a "normal" case (with data that is not reshuffled). 263s > set.seed(123) 263s > probs <- c(2, 3, 5)/10 263s > nj <- rmultinom(1, n, prob = probs) 263s > x <- c(f(nj[1], bmodels[[1]]), f(nj[2], bmodels[[2]]), f(nj[3], bmodels[[3]])) 263s > set.seed(123) 263s > stopifnot(exprs = { 263s + identical(x, rmixture(n, probs, bmodels, shuffle = FALSE)) 263s + }) 263s > 263s > ## Test recycling of the probability vector. 263s > set.seed(123) 263s > probs <- 1 263s > nj <- rmultinom(1, n, prob = rep_len(probs, 3)) 263s > x <- c(f(nj[1], bmodels[[1]]), f(nj[2], bmodels[[2]]), f(nj[3], bmodels[[3]])) 263s > set.seed(123) 263s > stopifnot(exprs = { 263s + identical(x, rmixture(n, probs, bmodels, shuffle = FALSE)) 263s + }) 263s > 263s > ## Test recycling of the models vector. 263s > set.seed(123) 263s > probs <- c(2, 3, 5) 263s > nj <- rmultinom(1, n, prob = probs) 263s > x <- f(n, bmodels[[1]]) 263s > set.seed(123) 263s > stopifnot(exprs = { 263s + identical(x, rmixture(n, probs, bmodels[1], shuffle = FALSE)) 263s + }) 263s > 263s > ## Test special cases. 263s > stopifnot(exprs = { 263s + identical(numeric(0), rmixture(0, probs, bmodels)) 263s + identical(2L, length(rmixture(c(n, n), probs, bmodels))) 263s + }) 263s > 263s > ## Test the calling environment, that is that arguments are correctly 263s > ## identified when 'rmixture' is called inside another function. 263s > set.seed(123) 263s > probs <- c(2, 3, 5)/10 263s > x <- rmixture(n, probs, bmodels) 263s > f <- function(n, p, model) 263s + rmixture(n, p, model) 263s > g <- function(n, p, m, q) 263s + rmixture(n, p, expression(rexp(m[1]), rlnorm(m[2], q[2]), rpareto(m[3], q[3]))) 263s > h <- function(n, p, model) 263s + f(n, c(p[1], p[2], p[3]), 263s + c(model[1], model[2], model[3])) 263s > k <- function(n, p, m, q) 263s + { 263s + ## Pathological case where the models expression does not evaluate 263s + ## in the frame of 'rmixture' as 'm' and 'q' will not be bound. 263s + ## The fix is to substitute variables by their values. 263s + models <- substitute(expression(rexp(m[1]), rlnorm(m[2], q[2]), rpareto(m[3], q[3])), 263s + list(m = m, q = q)) 263s + 263s + f(n, p, eval(models)) 263s + } 263s > stopifnot(exprs = { 263s + identical(x, { 263s + set.seed(123) 263s + f(n, probs, bmodels) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + f(n, c(probs[1], probs[2], probs[3]), 263s + c(bmodels[1], bmodels[2], bmodels[3])) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + g(n, p = probs, 263s + m = c(eval(bmodels[[c(1, 2)]]), eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(3, 2)]])), 263s + q = c(NA, eval(bmodels[[c(2, 3)]]), eval(bmodels[[c(3, 3)]]))) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + h(n, probs, 263s + expression(rexp(eval(bmodels[[c(1, 2)]])), 263s + rlnorm(eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(2, 3)]])), 263s + rpareto(shape = eval(bmodels[[c(3, 2)]]), scale = eval(bmodels[[c(3, 3)]])))) 263s + }) 263s + identical(x, { 263s + set.seed(123) 263s + k(n, p = probs, 263s + m = c(eval(bmodels[[c(1, 2)]]), eval(bmodels[[c(2, 2)]]), eval(bmodels[[c(3, 2)]])), 263s + q = c(NA, eval(bmodels[[c(2, 3)]]), eval(bmodels[[c(3, 3)]]))) 263s + }) 263s + }) 263s > 263s > ## Finally, test invalid arguments. 263s > assertError(rmixture(-1, probs, bmodels)) 263s > assertError(rmixture(c(3, -1), probs, bmodels)) 263s > assertError(rmixture(n, numeric(0), bmodels)) 263s > assertError(rmixture(n, 0, bmodels)) 263s > assertError(rmixture(n, c(0, 0), bmodels)) 263s > assertError(rmixture(n, probs, c(rexp(2), rexp(7)))) 263s > 263s autopkgtest [15:17:56]: test run-unit-test: -----------------------] 264s autopkgtest [15:17:57]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 264s run-unit-test PASS 264s autopkgtest [15:17:57]: test pkg-r-autopkgtest: preparing testbed 265s Reading package lists... 265s Building dependency tree... 265s Reading state information... 265s Starting pkgProblemResolver with broken count: 0 265s Starting 2 pkgProblemResolver with broken count: 0 265s Done 266s The following NEW packages will be installed: 266s build-essential cpp cpp-14 cpp-14-aarch64-linux-gnu cpp-aarch64-linux-gnu 266s dctrl-tools g++ g++-14 g++-14-aarch64-linux-gnu g++-aarch64-linux-gnu gcc 266s gcc-14 gcc-14-aarch64-linux-gnu gcc-aarch64-linux-gnu gfortran gfortran-14 266s gfortran-14-aarch64-linux-gnu gfortran-aarch64-linux-gnu icu-devtools 266s libasan8 libblas-dev libbz2-dev libcc1-0 libdeflate-dev libgcc-14-dev 266s libgfortran-14-dev libhwasan0 libicu-dev libisl23 libitm1 libjpeg-dev 266s libjpeg-turbo8-dev libjpeg8-dev liblapack-dev liblsan0 liblzma-dev libmpc3 266s libncurses-dev libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix3 266s libpkgconf3 libpng-dev libreadline-dev libstdc++-14-dev libtirpc-dev 266s libtsan2 libubsan1 pkg-r-autopkgtest pkgconf pkgconf-bin r-base-dev 266s zlib1g-dev 266s 0 upgraded, 54 newly installed, 0 to remove and 0 not upgraded. 266s Need to get 92.7 MB of archives. 266s After this operation, 334 MB of additional disk space will be used. 266s Get:1 http://ftpmaster.internal/ubuntu plucky/main arm64 libisl23 arm64 0.27-1 [676 kB] 267s Get:2 http://ftpmaster.internal/ubuntu plucky/main arm64 libmpc3 arm64 1.3.1-1build2 [56.8 kB] 267s Get:3 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp-14-aarch64-linux-gnu arm64 14.2.0-17ubuntu3 [10.6 MB] 275s Get:4 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp-14 arm64 14.2.0-17ubuntu3 [1028 B] 275s Get:5 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp-aarch64-linux-gnu arm64 4:14.2.0-1ubuntu1 [5558 B] 275s Get:6 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp arm64 4:14.2.0-1ubuntu1 [22.4 kB] 275s Get:7 http://ftpmaster.internal/ubuntu plucky/main arm64 libcc1-0 arm64 15-20250222-0ubuntu1 [44.2 kB] 275s Get:8 http://ftpmaster.internal/ubuntu plucky/main arm64 libitm1 arm64 15-20250222-0ubuntu1 [28.0 kB] 275s Get:9 http://ftpmaster.internal/ubuntu plucky/main arm64 libasan8 arm64 15-20250222-0ubuntu1 [2924 kB] 278s Get:10 http://ftpmaster.internal/ubuntu plucky/main arm64 liblsan0 arm64 15-20250222-0ubuntu1 [1319 kB] 278s Get:11 http://ftpmaster.internal/ubuntu plucky/main arm64 libtsan2 arm64 15-20250222-0ubuntu1 [2694 kB] 280s Get:12 http://ftpmaster.internal/ubuntu plucky/main arm64 libubsan1 arm64 15-20250222-0ubuntu1 [1178 kB] 281s Get:13 http://ftpmaster.internal/ubuntu plucky/main arm64 libhwasan0 arm64 15-20250222-0ubuntu1 [1642 kB] 282s Get:14 http://ftpmaster.internal/ubuntu plucky/main arm64 libgcc-14-dev arm64 14.2.0-17ubuntu3 [2593 kB] 284s Get:15 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc-14-aarch64-linux-gnu arm64 14.2.0-17ubuntu3 [20.9 MB] 288s Get:16 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc-14 arm64 14.2.0-17ubuntu3 [526 kB] 288s Get:17 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc-aarch64-linux-gnu arm64 4:14.2.0-1ubuntu1 [1200 B] 288s Get:18 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc arm64 4:14.2.0-1ubuntu1 [4998 B] 288s Get:19 http://ftpmaster.internal/ubuntu plucky/main arm64 libstdc++-14-dev arm64 14.2.0-17ubuntu3 [2499 kB] 288s Get:20 http://ftpmaster.internal/ubuntu plucky/main arm64 g++-14-aarch64-linux-gnu arm64 14.2.0-17ubuntu3 [12.1 MB] 290s Get:21 http://ftpmaster.internal/ubuntu plucky/main arm64 g++-14 arm64 14.2.0-17ubuntu3 [21.8 kB] 290s Get:22 http://ftpmaster.internal/ubuntu plucky/main arm64 g++-aarch64-linux-gnu arm64 4:14.2.0-1ubuntu1 [956 B] 290s Get:23 http://ftpmaster.internal/ubuntu plucky/main arm64 g++ arm64 4:14.2.0-1ubuntu1 [1080 B] 290s Get:24 http://ftpmaster.internal/ubuntu plucky/main arm64 build-essential arm64 12.10ubuntu1 [4932 B] 290s Get:25 http://ftpmaster.internal/ubuntu plucky/main arm64 dctrl-tools arm64 2.24-3build3 [103 kB] 290s Get:26 http://ftpmaster.internal/ubuntu plucky/main arm64 libgfortran-14-dev arm64 14.2.0-17ubuntu3 [498 kB] 290s Get:27 http://ftpmaster.internal/ubuntu plucky/main arm64 gfortran-14-aarch64-linux-gnu arm64 14.2.0-17ubuntu3 [11.4 MB] 291s Get:28 http://ftpmaster.internal/ubuntu plucky/main arm64 gfortran-14 arm64 14.2.0-17ubuntu3 [13.6 kB] 291s Get:29 http://ftpmaster.internal/ubuntu plucky/main arm64 gfortran-aarch64-linux-gnu arm64 4:14.2.0-1ubuntu1 [1022 B] 291s Get:30 http://ftpmaster.internal/ubuntu plucky/main arm64 gfortran arm64 4:14.2.0-1ubuntu1 [1166 B] 291s Get:31 http://ftpmaster.internal/ubuntu plucky/main arm64 icu-devtools arm64 76.1-1ubuntu2 [213 kB] 291s Get:32 http://ftpmaster.internal/ubuntu plucky/main arm64 libblas-dev arm64 3.12.1-2 [126 kB] 291s Get:33 http://ftpmaster.internal/ubuntu plucky/main arm64 libbz2-dev arm64 1.0.8-6 [36.1 kB] 291s Get:34 http://ftpmaster.internal/ubuntu plucky/main arm64 libdeflate-dev arm64 1.23-1 [53.7 kB] 291s Get:35 http://ftpmaster.internal/ubuntu plucky/main arm64 libicu-dev arm64 76.1-1ubuntu2 [12.2 MB] 291s Get:36 http://ftpmaster.internal/ubuntu plucky/main arm64 libjpeg-turbo8-dev arm64 2.1.5-3ubuntu2 [306 kB] 291s Get:37 http://ftpmaster.internal/ubuntu plucky/main arm64 libjpeg8-dev arm64 8c-2ubuntu11 [1484 B] 291s Get:38 http://ftpmaster.internal/ubuntu plucky/main arm64 libjpeg-dev arm64 8c-2ubuntu11 [1482 B] 291s Get:39 http://ftpmaster.internal/ubuntu plucky/main arm64 liblapack-dev arm64 3.12.1-2 [4439 kB] 292s Get:40 http://ftpmaster.internal/ubuntu plucky/main arm64 libncurses-dev arm64 6.5+20250216-2 [389 kB] 292s Get:41 http://ftpmaster.internal/ubuntu plucky/main arm64 libpcre2-16-0 arm64 10.45-1 [222 kB] 292s Get:42 http://ftpmaster.internal/ubuntu plucky/main arm64 libpcre2-32-0 arm64 10.45-1 [210 kB] 292s Get:43 http://ftpmaster.internal/ubuntu plucky/main arm64 libpcre2-posix3 arm64 10.45-1 [7084 B] 292s Get:44 http://ftpmaster.internal/ubuntu plucky/main arm64 libpcre2-dev arm64 10.45-1 [768 kB] 292s Get:45 http://ftpmaster.internal/ubuntu plucky/main arm64 libpkgconf3 arm64 1.8.1-4 [31.4 kB] 292s Get:46 http://ftpmaster.internal/ubuntu plucky/main arm64 zlib1g-dev arm64 1:1.3.dfsg+really1.3.1-1ubuntu1 [894 kB] 292s Get:47 http://ftpmaster.internal/ubuntu plucky/main arm64 libpng-dev arm64 1.6.47-1 [269 kB] 292s Get:48 http://ftpmaster.internal/ubuntu plucky/main arm64 libreadline-dev arm64 8.2-6 [179 kB] 292s Get:49 http://ftpmaster.internal/ubuntu plucky/main arm64 liblzma-dev arm64 5.6.4-1 [180 kB] 292s Get:50 http://ftpmaster.internal/ubuntu plucky/main arm64 pkgconf-bin arm64 1.8.1-4 [20.9 kB] 292s Get:51 http://ftpmaster.internal/ubuntu plucky/main arm64 pkgconf arm64 1.8.1-4 [16.7 kB] 292s Get:52 http://ftpmaster.internal/ubuntu plucky/main arm64 libtirpc-dev arm64 1.3.4+ds-1.3 [201 kB] 292s Get:53 http://ftpmaster.internal/ubuntu plucky/universe arm64 r-base-dev all 4.4.3-1 [4176 B] 292s Get:54 http://ftpmaster.internal/ubuntu plucky/universe arm64 pkg-r-autopkgtest all 20231212ubuntu1 [6448 B] 292s Fetched 92.7 MB in 26s (3630 kB/s) 292s Selecting previously unselected package libisl23:arm64. 292s (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 ... 84025 files and directories currently installed.) 292s Preparing to unpack .../00-libisl23_0.27-1_arm64.deb ... 292s Unpacking libisl23:arm64 (0.27-1) ... 292s Selecting previously unselected package libmpc3:arm64. 292s Preparing to unpack .../01-libmpc3_1.3.1-1build2_arm64.deb ... 292s Unpacking libmpc3:arm64 (1.3.1-1build2) ... 292s Selecting previously unselected package cpp-14-aarch64-linux-gnu. 292s Preparing to unpack .../02-cpp-14-aarch64-linux-gnu_14.2.0-17ubuntu3_arm64.deb ... 292s Unpacking cpp-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 293s Selecting previously unselected package cpp-14. 293s Preparing to unpack .../03-cpp-14_14.2.0-17ubuntu3_arm64.deb ... 293s Unpacking cpp-14 (14.2.0-17ubuntu3) ... 293s Selecting previously unselected package cpp-aarch64-linux-gnu. 293s Preparing to unpack .../04-cpp-aarch64-linux-gnu_4%3a14.2.0-1ubuntu1_arm64.deb ... 293s Unpacking cpp-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 293s Selecting previously unselected package cpp. 293s Preparing to unpack .../05-cpp_4%3a14.2.0-1ubuntu1_arm64.deb ... 293s Unpacking cpp (4:14.2.0-1ubuntu1) ... 293s Selecting previously unselected package libcc1-0:arm64. 293s Preparing to unpack .../06-libcc1-0_15-20250222-0ubuntu1_arm64.deb ... 293s Unpacking libcc1-0:arm64 (15-20250222-0ubuntu1) ... 293s Selecting previously unselected package libitm1:arm64. 293s Preparing to unpack .../07-libitm1_15-20250222-0ubuntu1_arm64.deb ... 293s Unpacking libitm1:arm64 (15-20250222-0ubuntu1) ... 293s Selecting previously unselected package libasan8:arm64. 293s Preparing to unpack .../08-libasan8_15-20250222-0ubuntu1_arm64.deb ... 293s Unpacking libasan8:arm64 (15-20250222-0ubuntu1) ... 293s Selecting previously unselected package liblsan0:arm64. 293s Preparing to unpack .../09-liblsan0_15-20250222-0ubuntu1_arm64.deb ... 293s Unpacking liblsan0:arm64 (15-20250222-0ubuntu1) ... 293s Selecting previously unselected package libtsan2:arm64. 293s Preparing to unpack .../10-libtsan2_15-20250222-0ubuntu1_arm64.deb ... 293s Unpacking libtsan2:arm64 (15-20250222-0ubuntu1) ... 293s Selecting previously unselected package libubsan1:arm64. 293s Preparing to unpack .../11-libubsan1_15-20250222-0ubuntu1_arm64.deb ... 293s Unpacking libubsan1:arm64 (15-20250222-0ubuntu1) ... 293s Selecting previously unselected package libhwasan0:arm64. 293s Preparing to unpack .../12-libhwasan0_15-20250222-0ubuntu1_arm64.deb ... 293s Unpacking libhwasan0:arm64 (15-20250222-0ubuntu1) ... 293s Selecting previously unselected package libgcc-14-dev:arm64. 293s Preparing to unpack .../13-libgcc-14-dev_14.2.0-17ubuntu3_arm64.deb ... 293s Unpacking libgcc-14-dev:arm64 (14.2.0-17ubuntu3) ... 293s Selecting previously unselected package gcc-14-aarch64-linux-gnu. 293s Preparing to unpack .../14-gcc-14-aarch64-linux-gnu_14.2.0-17ubuntu3_arm64.deb ... 293s Unpacking gcc-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 294s Selecting previously unselected package gcc-14. 294s Preparing to unpack .../15-gcc-14_14.2.0-17ubuntu3_arm64.deb ... 294s Unpacking gcc-14 (14.2.0-17ubuntu3) ... 294s Selecting previously unselected package gcc-aarch64-linux-gnu. 294s Preparing to unpack .../16-gcc-aarch64-linux-gnu_4%3a14.2.0-1ubuntu1_arm64.deb ... 294s Unpacking gcc-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 294s Selecting previously unselected package gcc. 294s Preparing to unpack .../17-gcc_4%3a14.2.0-1ubuntu1_arm64.deb ... 294s Unpacking gcc (4:14.2.0-1ubuntu1) ... 294s Selecting previously unselected package libstdc++-14-dev:arm64. 294s Preparing to unpack .../18-libstdc++-14-dev_14.2.0-17ubuntu3_arm64.deb ... 294s Unpacking libstdc++-14-dev:arm64 (14.2.0-17ubuntu3) ... 294s Selecting previously unselected package g++-14-aarch64-linux-gnu. 294s Preparing to unpack .../19-g++-14-aarch64-linux-gnu_14.2.0-17ubuntu3_arm64.deb ... 294s Unpacking g++-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 294s Selecting previously unselected package g++-14. 294s Preparing to unpack .../20-g++-14_14.2.0-17ubuntu3_arm64.deb ... 294s Unpacking g++-14 (14.2.0-17ubuntu3) ... 294s Selecting previously unselected package g++-aarch64-linux-gnu. 294s Preparing to unpack .../21-g++-aarch64-linux-gnu_4%3a14.2.0-1ubuntu1_arm64.deb ... 294s Unpacking g++-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 295s Selecting previously unselected package g++. 295s Preparing to unpack .../22-g++_4%3a14.2.0-1ubuntu1_arm64.deb ... 295s Unpacking g++ (4:14.2.0-1ubuntu1) ... 295s Selecting previously unselected package build-essential. 295s Preparing to unpack .../23-build-essential_12.10ubuntu1_arm64.deb ... 295s Unpacking build-essential (12.10ubuntu1) ... 295s Selecting previously unselected package dctrl-tools. 295s Preparing to unpack .../24-dctrl-tools_2.24-3build3_arm64.deb ... 295s Unpacking dctrl-tools (2.24-3build3) ... 295s Selecting previously unselected package libgfortran-14-dev:arm64. 295s Preparing to unpack .../25-libgfortran-14-dev_14.2.0-17ubuntu3_arm64.deb ... 295s Unpacking libgfortran-14-dev:arm64 (14.2.0-17ubuntu3) ... 295s Selecting previously unselected package gfortran-14-aarch64-linux-gnu. 295s Preparing to unpack .../26-gfortran-14-aarch64-linux-gnu_14.2.0-17ubuntu3_arm64.deb ... 295s Unpacking gfortran-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 295s Selecting previously unselected package gfortran-14. 295s Preparing to unpack .../27-gfortran-14_14.2.0-17ubuntu3_arm64.deb ... 295s Unpacking gfortran-14 (14.2.0-17ubuntu3) ... 295s Selecting previously unselected package gfortran-aarch64-linux-gnu. 295s Preparing to unpack .../28-gfortran-aarch64-linux-gnu_4%3a14.2.0-1ubuntu1_arm64.deb ... 295s Unpacking gfortran-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 295s Selecting previously unselected package gfortran. 295s Preparing to unpack .../29-gfortran_4%3a14.2.0-1ubuntu1_arm64.deb ... 295s Unpacking gfortran (4:14.2.0-1ubuntu1) ... 295s Selecting previously unselected package icu-devtools. 295s Preparing to unpack .../30-icu-devtools_76.1-1ubuntu2_arm64.deb ... 295s Unpacking icu-devtools (76.1-1ubuntu2) ... 295s Selecting previously unselected package libblas-dev:arm64. 295s Preparing to unpack .../31-libblas-dev_3.12.1-2_arm64.deb ... 295s Unpacking libblas-dev:arm64 (3.12.1-2) ... 295s Selecting previously unselected package libbz2-dev:arm64. 295s Preparing to unpack .../32-libbz2-dev_1.0.8-6_arm64.deb ... 295s Unpacking libbz2-dev:arm64 (1.0.8-6) ... 295s Selecting previously unselected package libdeflate-dev:arm64. 295s Preparing to unpack .../33-libdeflate-dev_1.23-1_arm64.deb ... 295s Unpacking libdeflate-dev:arm64 (1.23-1) ... 295s Selecting previously unselected package libicu-dev:arm64. 295s Preparing to unpack .../34-libicu-dev_76.1-1ubuntu2_arm64.deb ... 295s Unpacking libicu-dev:arm64 (76.1-1ubuntu2) ... 296s Selecting previously unselected package libjpeg-turbo8-dev:arm64. 296s Preparing to unpack .../35-libjpeg-turbo8-dev_2.1.5-3ubuntu2_arm64.deb ... 296s Unpacking libjpeg-turbo8-dev:arm64 (2.1.5-3ubuntu2) ... 296s Selecting previously unselected package libjpeg8-dev:arm64. 296s Preparing to unpack .../36-libjpeg8-dev_8c-2ubuntu11_arm64.deb ... 296s Unpacking libjpeg8-dev:arm64 (8c-2ubuntu11) ... 296s Selecting previously unselected package libjpeg-dev:arm64. 296s Preparing to unpack .../37-libjpeg-dev_8c-2ubuntu11_arm64.deb ... 296s Unpacking libjpeg-dev:arm64 (8c-2ubuntu11) ... 296s Selecting previously unselected package liblapack-dev:arm64. 296s Preparing to unpack .../38-liblapack-dev_3.12.1-2_arm64.deb ... 296s Unpacking liblapack-dev:arm64 (3.12.1-2) ... 296s Selecting previously unselected package libncurses-dev:arm64. 296s Preparing to unpack .../39-libncurses-dev_6.5+20250216-2_arm64.deb ... 296s Unpacking libncurses-dev:arm64 (6.5+20250216-2) ... 296s Selecting previously unselected package libpcre2-16-0:arm64. 296s Preparing to unpack .../40-libpcre2-16-0_10.45-1_arm64.deb ... 296s Unpacking libpcre2-16-0:arm64 (10.45-1) ... 296s Selecting previously unselected package libpcre2-32-0:arm64. 296s Preparing to unpack .../41-libpcre2-32-0_10.45-1_arm64.deb ... 296s Unpacking libpcre2-32-0:arm64 (10.45-1) ... 296s Selecting previously unselected package libpcre2-posix3:arm64. 296s Preparing to unpack .../42-libpcre2-posix3_10.45-1_arm64.deb ... 296s Unpacking libpcre2-posix3:arm64 (10.45-1) ... 296s Selecting previously unselected package libpcre2-dev:arm64. 296s Preparing to unpack .../43-libpcre2-dev_10.45-1_arm64.deb ... 296s Unpacking libpcre2-dev:arm64 (10.45-1) ... 296s Selecting previously unselected package libpkgconf3:arm64. 296s Preparing to unpack .../44-libpkgconf3_1.8.1-4_arm64.deb ... 296s Unpacking libpkgconf3:arm64 (1.8.1-4) ... 296s Selecting previously unselected package zlib1g-dev:arm64. 296s Preparing to unpack .../45-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_arm64.deb ... 296s Unpacking zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 296s Selecting previously unselected package libpng-dev:arm64. 296s Preparing to unpack .../46-libpng-dev_1.6.47-1_arm64.deb ... 296s Unpacking libpng-dev:arm64 (1.6.47-1) ... 296s Selecting previously unselected package libreadline-dev:arm64. 296s Preparing to unpack .../47-libreadline-dev_8.2-6_arm64.deb ... 296s Unpacking libreadline-dev:arm64 (8.2-6) ... 296s Selecting previously unselected package liblzma-dev:arm64. 296s Preparing to unpack .../48-liblzma-dev_5.6.4-1_arm64.deb ... 296s Unpacking liblzma-dev:arm64 (5.6.4-1) ... 297s Selecting previously unselected package pkgconf-bin. 297s Preparing to unpack .../49-pkgconf-bin_1.8.1-4_arm64.deb ... 297s Unpacking pkgconf-bin (1.8.1-4) ... 297s Selecting previously unselected package pkgconf:arm64. 297s Preparing to unpack .../50-pkgconf_1.8.1-4_arm64.deb ... 297s Unpacking pkgconf:arm64 (1.8.1-4) ... 297s Selecting previously unselected package libtirpc-dev:arm64. 297s Preparing to unpack .../51-libtirpc-dev_1.3.4+ds-1.3_arm64.deb ... 297s Unpacking libtirpc-dev:arm64 (1.3.4+ds-1.3) ... 297s Selecting previously unselected package r-base-dev. 297s Preparing to unpack .../52-r-base-dev_4.4.3-1_all.deb ... 297s Unpacking r-base-dev (4.4.3-1) ... 297s Selecting previously unselected package pkg-r-autopkgtest. 297s Preparing to unpack .../53-pkg-r-autopkgtest_20231212ubuntu1_all.deb ... 297s Unpacking pkg-r-autopkgtest (20231212ubuntu1) ... 297s Setting up libjpeg-turbo8-dev:arm64 (2.1.5-3ubuntu2) ... 297s Setting up libncurses-dev:arm64 (6.5+20250216-2) ... 297s Setting up libreadline-dev:arm64 (8.2-6) ... 297s Setting up libpcre2-16-0:arm64 (10.45-1) ... 297s Setting up libpcre2-32-0:arm64 (10.45-1) ... 297s Setting up libtirpc-dev:arm64 (1.3.4+ds-1.3) ... 297s Setting up libpkgconf3:arm64 (1.8.1-4) ... 297s Setting up libmpc3:arm64 (1.3.1-1build2) ... 297s Setting up icu-devtools (76.1-1ubuntu2) ... 297s Setting up pkgconf-bin (1.8.1-4) ... 297s Setting up liblzma-dev:arm64 (5.6.4-1) ... 297s Setting up libubsan1:arm64 (15-20250222-0ubuntu1) ... 297s Setting up zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 297s Setting up libpcre2-posix3:arm64 (10.45-1) ... 297s Setting up libhwasan0:arm64 (15-20250222-0ubuntu1) ... 297s Setting up libasan8:arm64 (15-20250222-0ubuntu1) ... 297s Setting up libtsan2:arm64 (15-20250222-0ubuntu1) ... 297s Setting up libjpeg8-dev:arm64 (8c-2ubuntu11) ... 297s Setting up libisl23:arm64 (0.27-1) ... 297s Setting up libdeflate-dev:arm64 (1.23-1) ... 297s Setting up libicu-dev:arm64 (76.1-1ubuntu2) ... 297s Setting up libcc1-0:arm64 (15-20250222-0ubuntu1) ... 297s Setting up liblsan0:arm64 (15-20250222-0ubuntu1) ... 297s Setting up libblas-dev:arm64 (3.12.1-2) ... 297s update-alternatives: using /usr/lib/aarch64-linux-gnu/blas/libblas.so to provide /usr/lib/aarch64-linux-gnu/libblas.so (libblas.so-aarch64-linux-gnu) in auto mode 297s Setting up dctrl-tools (2.24-3build3) ... 297s Setting up libitm1:arm64 (15-20250222-0ubuntu1) ... 297s Setting up libbz2-dev:arm64 (1.0.8-6) ... 297s Setting up libpcre2-dev:arm64 (10.45-1) ... 297s Setting up libpng-dev:arm64 (1.6.47-1) ... 297s Setting up libjpeg-dev:arm64 (8c-2ubuntu11) ... 297s Setting up pkgconf:arm64 (1.8.1-4) ... 297s Setting up liblapack-dev:arm64 (3.12.1-2) ... 297s update-alternatives: using /usr/lib/aarch64-linux-gnu/lapack/liblapack.so to provide /usr/lib/aarch64-linux-gnu/liblapack.so (liblapack.so-aarch64-linux-gnu) in auto mode 297s Setting up cpp-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 297s Setting up libgcc-14-dev:arm64 (14.2.0-17ubuntu3) ... 297s Setting up libstdc++-14-dev:arm64 (14.2.0-17ubuntu3) ... 297s Setting up libgfortran-14-dev:arm64 (14.2.0-17ubuntu3) ... 297s Setting up cpp-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 297s Setting up cpp-14 (14.2.0-17ubuntu3) ... 297s Setting up cpp (4:14.2.0-1ubuntu1) ... 297s Setting up gcc-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 297s Setting up gcc-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 297s Setting up g++-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 297s Setting up gcc-14 (14.2.0-17ubuntu3) ... 297s Setting up gfortran-14-aarch64-linux-gnu (14.2.0-17ubuntu3) ... 297s Setting up g++-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 297s Setting up gfortran-aarch64-linux-gnu (4:14.2.0-1ubuntu1) ... 297s Setting up g++-14 (14.2.0-17ubuntu3) ... 297s Setting up gfortran-14 (14.2.0-17ubuntu3) ... 297s Setting up gcc (4:14.2.0-1ubuntu1) ... 297s Setting up g++ (4:14.2.0-1ubuntu1) ... 297s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 297s Setting up build-essential (12.10ubuntu1) ... 297s Setting up gfortran (4:14.2.0-1ubuntu1) ... 297s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 297s 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 297s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 297s 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 297s Setting up r-base-dev (4.4.3-1) ... 297s Setting up pkg-r-autopkgtest (20231212ubuntu1) ... 297s Processing triggers for libc-bin (2.41-1ubuntu2) ... 297s Processing triggers for man-db (2.13.0-1) ... 298s Processing triggers for install-info (7.1.1-1) ... 299s autopkgtest [15:18:32]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 299s autopkgtest [15:18:32]: test pkg-r-autopkgtest: [----------------------- 300s Test: Try to load the R library actuar 300s 300s R version 4.4.3 (2025-02-28) -- "Trophy Case" 300s Copyright (C) 2025 The R Foundation for Statistical Computing 300s Platform: aarch64-unknown-linux-gnu 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 > library('actuar') 300s 300s Attaching package: ‘actuar’ 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 300s > 300s > 300s Other tests are currently unsupported! 300s They will be progressively added. 300s autopkgtest [15:18:33]: test pkg-r-autopkgtest: -----------------------] 301s autopkgtest [15:18:34]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 301s pkg-r-autopkgtest PASS 301s autopkgtest [15:18:34]: @@@@@@@@@@@@@@@@@@@@ summary 301s run-unit-test PASS 301s pkg-r-autopkgtest PASS 320s nova [W] Using flock in prodstack6-arm64 320s Creating nova instance adt-plucky-arm64-r-cran-actuar-20250315-151333-juju-7f2275-prod-proposed-migration-environment-2-5be40fbf-9208-403a-92c2-e29185e254b4 from image adt/ubuntu-plucky-arm64-server-20250315.img (UUID bd6e766c-b51f-4b53-86d6-23aa4d18f524)... 320s nova [W] Timed out waiting for dab071d9-5e25-4f0f-bd4a-c6b535cc19a4 to get deleted.