* using log directory 'd:/Rcompile/CRANpkg/local/4.3/copula.Rcheck' * using R version 4.3.3 (2024-02-29 ucrt) * using platform: x86_64-w64-mingw32 (64-bit) * R was compiled by gcc.exe (GCC) 12.3.0 GNU Fortran (GCC) 12.3.0 * running under: Windows Server 2022 x64 (build 20348) * using session charset: UTF-8 * using option '--no-vignettes' * checking for file 'copula/DESCRIPTION' ... OK * this is package 'copula' version '1.1-3' * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking whether package 'copula' can be installed ... OK * used C compiler: 'gcc.exe (GCC) 12.3.0' * checking installed package size ... NOTE installed size is 7.6Mb sub-directories of 1Mb or more: R 2.1Mb doc 3.5Mb * checking package directory ... OK * checking 'build' directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... [3s] OK * checking whether the package can be loaded with stated dependencies ... [3s] OK * checking whether the package can be unloaded cleanly ... [3s] OK * checking whether the namespace can be loaded with stated dependencies ... [3s] OK * checking whether the namespace can be unloaded cleanly ... [3s] OK * checking loading without being on the library search path ... [3s] OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [70s] OK * checking Rd files ... [4s] OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of 'data' directory ... OK * checking data for non-ASCII characters ... [0s] OK * checking data for ASCII and uncompressed saves ... OK * checking R/sysdata.rda ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking compilation flags in Makevars ... OK * checking for GNU extensions in Makefiles ... OK * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK * checking use of PKG_*FLAGS in Makefiles ... OK * checking pragmas in C/C++ headers and code ... OK * checking compiled code ... OK * checking sizes of PDF files under 'inst/doc' ... OK * checking installed files from 'inst/doc' ... OK * checking files in 'vignettes' ... OK * checking examples ... [113s] OK * checking for unstated dependencies in 'tests' ... OK * checking tests ... [86s] ERROR Running 'Stirling-etc.R' [6s] Running 'copula-play.R' [21s] Running 'dC-dc-ex.R' [3s] Running 'estim-ex.R' [6s] Running 'explicitCop-ex.R' [13s] Running 'fitting-ex.R' [13s] Running 'fixedPar-ex.R' [6s] Running 'ggraph-tst.R' [8s] Running 'khoudraji-ex.R' [11s] Running 'misc.R' Running the tests in 'tests/khoudraji-ex.R' failed. Complete output: > ## Copyright (C) 2016 Marius Hofert, Ivan Kojadinovic, Martin Maechler, and Jun Yan > ## > ## This program is free software; you can redistribute it and/or modify it under > ## the terms of the GNU General Public License as published by the Free Software > ## Foundation; either version 3 of the License, or (at your option) any later > ## version. > ## > ## This program is distributed in the hope that it will be useful, but WITHOUT > ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS > ## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more > ## details. > ## > ## You should have received a copy of the GNU General Public License along with > ## this program; if not, see . > > ## Khoudraji Copula > > library(copula) > isExplicit <- copula:::isExplicit > (doExtras <- copula:::doExtras()) [1] FALSE > > ## if(!dev.interactive(orNone=TRUE)) pdf("khoudraji-ex.pdf") > > ################################################################################ > ## An explicit Khoudraji copula constructed from claytonCopula and indepCoula > ## with one fixed shape parameter > kcf <- khoudrajiCopula(copula2 = claytonCopula(6), + shapes = fixParam(c(0.4, 0.95), c(FALSE, TRUE))) > kcf Khoudraji copula, dim. d = 2, constructed from Independence copula Clayton copula Dimension: 2 Parameters (partly fixed, see ':='): c2.alpha = 6.00 shape1 = 0.40 shape2 := 0.95 > stopifnot( + all.equal(getTheta(kcf, freeOnly = FALSE, named = TRUE) -> th., + c(c2.alpha = 6, shape1 = 0.4, shape2 = 0.95)), + identical(getTheta(kcf, named = TRUE), th.[1:2])) > > ## kcf@exprdist$cdf > stopifnot(isExplicit(kcf)) > > set.seed(123) > u <- rCopula(20, kcf) > > ## cdf/pdf from explicit expression versus from algorithmic implementation > max(abs(pCopula(u, kcf) - copula:::pKhoudrajiCopula(u, kcf))) [1] 0 > max(abs(dCopula(u, kcf) - copula:::dKhoudrajiBivCopula(u, kcf))) [1] 3.375078e-14 > > ################################################################################ > ## A nested Khoudraji copula from kcf and a gumbelCopula, still explicit > k_kcf_g <- khoudrajiCopula(kcf, gumbelCopula(2), + shapes = fixParam(c(.2, .9), c(TRUE, TRUE))) > k_kcf_g Khoudraji copula, dim. d = 2, constructed from Khoudraji copula constructed from Independence copula Clayton copula Gumbel copula Dimension: 2 Parameters (partly fixed, see ':='): c1.c2.alpha = 6.00 c1.shape1 = 0.40 c1.shape2 := 0.95 c2.alpha = 2.00 shape1 := 0.20 shape2 := 0.90 > stopifnot(isExplicit(k_kcf_g)) > getTheta(k_kcf_g, freeOnly = FALSE, named = TRUE) c1.c2.alpha c1.shape1 c1.shape2 c2.alpha shape1 shape2 6.00 0.40 0.95 2.00 0.20 0.90 > getTheta(k_kcf_g, named = TRUE) c1.c2.alpha c1.shape1 c2.alpha 6.0 0.4 2.0 > > ## k_kcf_g@exprdist$cdf > set.seed(456) > U <- rCopula(100000, k_kcf_g) > > ## check cdf/pdf with C.n and kde2d > require(MASS) Loading required package: MASS > u <- as.matrix(expand.grid((1:9)/10, (1:9)/10)) > ## cdf versus C.n > max(abs(pCopula(u, k_kcf_g) - C.n(u, U))) ## < 0.0001) [1] 0.0009825071 > ## pdf versus kde2d > kde <- kde2d(U[,1], U[,2], n = 9, lims = c(0.1, 0.9, 0.1, 0.9)) > max(abs(dCopula(u, k_kcf_g) / c(kde$z) - 1)) ## relative difference < 0.13 [1] 0.1231915 > > ################################################################################ > ## one more nesting: kcf and k_kcf_g > monster <- khoudrajiCopula(kcf, k_kcf_g, + shapes = fixParam(c(.9, .1), c(TRUE, FALSE))) > monster; validObject(monster) Khoudraji copula, dim. d = 2, constructed from Khoudraji copula constructed from Independence copula Clayton copula Khoudraji copula constructed from Khoudraji copula constructed from Independence copula Clayton copula Gumbel copula Dimension: 2 Parameters (partly fixed, see ':='): c1.c2.alpha = 6.00 c1.shape1 = 0.40 c1.shape2 := 0.95 c2.c1.c2.alpha = 6.00 c2.c1.shape1 = 0.40 c2.c1.shape2 := 0.95 c2.c2.alpha = 2.00 c2.shape1 := 0.20 c2.shape2 := 0.90 shape1 := 0.90 shape2 = 0.10 [1] TRUE > stopifnot(isExplicit(monster)) > > (th.mA <- getTheta(monster, freeOnly = FALSE, named = TRUE)) c1.c2.alpha c1.shape1 c1.shape2 c2.c1.c2.alpha c2.c1.shape1 6.00 0.40 0.95 6.00 0.40 c2.c1.shape2 c2.c2.alpha c2.shape1 c2.shape2 shape1 0.95 2.00 0.20 0.90 0.90 shape2 0.10 > (th.m <- getTheta(monster, named = TRUE)) c1.c2.alpha c1.shape1 c2.c1.c2.alpha c2.c1.shape1 c2.c2.alpha 6.0 0.4 6.0 0.4 2.0 shape2 0.1 > stopifnot(identical(th.m, th.mA[isFree(monster)])) > > set.seed(488) > U <- rCopula(100000, monster) > ## cdf versus C.n > max(abs(pCopula(u, monster) - C.n(u, U))) ## < 0.002) [1] 0.001314904 > ## pdf versus kde2d > kde <- kde2d(U[,1], U[,2], n = 9, lims = c(0.1, 0.9, 0.1, 0.9)) > max(abs(dCopula(u, monster) / c(kde$z) - 1)) ## relative difference < 0.09 [1] 0.08216382 > > ################################################################################ > ## khoudrajiExplicitCopula with dim 3 > kcd3 <- khoudrajiCopula(copula1 = indepCopula(dim=3), + copula2 = claytonCopula(6, dim=3), + shapes = c(0.4, 0.95, 0.95)) > kcd3 Khoudraji copula, dim. d = 3, constructed from Independence copula Clayton copula Dimension: 3 Parameters: c2.alpha = 6.00 shape1 = 0.40 shape2 = 0.95 shape3 = 0.95 > stopifnot(isExplicit(kcd3), + inherits(kcd3, "khoudrajiExplicitCopula")) > > set.seed(1712) > U <- rCopula(100000, kcd3) > u <- matrix(runif(15), 5, 3) > ## cdf versus C.n > max(abs(pCopula(u, kcd3) - C.n(u, U))) # < 0.00007 [1] 0.0006881849 > ## don't know how to check pdf > (f.v <- dCopula(u, kcd3)) [1] 1.1116773 1.6661734 0.1719080 0.4981574 9.8964415 > stopifnot( + all.equal(f.v, + c(1.1116773, 1.6661734, 0.1719080, 0.4981574, 9.8964415), + tol = 1e-7) + ) > > kcg <- khoudrajiCopula(claytonCopula(2, dim=3), gumbelCopula(3, dim=3), c(0.2, 0.2, .8)) > kcg Khoudraji copula, dim. d = 3, constructed from Clayton copula Gumbel copula Dimension: 3 Parameters: c1.alpha = 2.0 c2.alpha = 3.0 shape1 = 0.2 shape2 = 0.2 shape3 = 0.8 > u <- rCopula(10, kcg) > dCopula(u, kcg) [1] 2.780102 2.723464 1.041935 2.027283 1.675718 2.307609 1.203909 [8] 10.459996 0.386535 3.480239 > > > kkcgg <- khoudrajiCopula(kcg, gumbelCopula(2, dim = 3), c(.3, .3, .9)) > kkcgg Khoudraji copula, dim. d = 3, constructed from Khoudraji copula constructed from Clayton copula Gumbel copula Gumbel copula Dimension: 3 Parameters: c1.c1.alpha = 2.0 c1.c2.alpha = 3.0 c1.shape1 = 0.2 c1.shape2 = 0.2 c1.shape3 = 0.8 c2.alpha = 2.0 shape1 = 0.3 shape2 = 0.3 shape3 = 0.9 > u <- rCopula(10, kkcgg) > dCopula(u, kkcgg) [1] 0.3665809 1.5981348 1.0638901 1.9684222 1.5384452 1.5214729 1.3522174 [8] 0.9529139 1.2088327 0.4565743 > > > kcgcd3 <- khoudrajiCopula(kcd3, kkcgg, c(.4, .4, .5)) > kcgcd3 Khoudraji copula, dim. d = 3, constructed from Khoudraji copula constructed from Independence copula Clayton copula Khoudraji copula constructed from Khoudraji copula constructed from Clayton copula Gumbel copula Gumbel copula Dimension: 3 Parameters: c1.c2.alpha = 6.00 c1.shape1 = 0.40 c1.shape2 = 0.95 c1.shape3 = 0.95 c2.c1.c1.alpha = 2.00 c2.c1.c2.alpha = 3.00 c2.c1.shape1 = 0.20 c2.c1.shape2 = 0.20 c2.c1.shape3 = 0.80 c2.c2.alpha = 2.00 c2.shape1 = 0.30 c2.shape2 = 0.30 c2.shape3 = 0.90 shape1 = 0.40 shape2 = 0.40 shape3 = 0.50 > u <- rCopula(10, kcgcd3) > dCopula(u, kcgcd3) [1] 0.5406296 4.7736360 0.5877674 0.7449026 2.2931403 0.3452497 1.5496446 [8] 0.3569642 2.9840308 1.2362195 > > ##--- or use comparederiv() from ../inst/Rsource/utils.R via source(..) > ## dCdu > all.equal(copula:::dCdu(kcgcd3, u), copula:::dCduNumer(kcgcd3, u, may.warn=FALSE)) [1] "Mean relative difference: 0.0008815003" > ## dCdtheta > all.equal(copula:::dCdtheta(kcgcd3, u), copula:::dCdthetaNumer(kcgcd3, u, may.warn=FALSE)) [1] "Mean relative difference: 0.002194312" > ## dlogcdu > all.equal(copula:::dlogcdu(kcgcd3, u), copula:::dlogcduNumer(kcgcd3, u, may.warn=FALSE)) [1] TRUE > ## dlogcdtheta > all.equal(copula:::dlogcdtheta(kcgcd3, u), copula:::dlogcdthetaNumer(kcgcd3, u, may.warn=FALSE)) * checking for unstated dependencies in vignettes ... OK * checking package vignettes in 'inst/doc' ... OK * checking running R code from vignettes ... SKIPPED * checking re-building of vignette outputs ... SKIPPED * checking PDF version of manual ... [20s] OK * checking HTML version of manual ... [28s] OK * DONE Status: 1 ERROR, 1 NOTE