- using R Under development (unstable) (2025-02-14 r87716)
- using platform: x86_64-pc-linux-gnu
- R was compiled by
gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)
GNU Fortran (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)
- running under: Fedora Linux 40 (Workstation Edition)
- using session charset: UTF-8
- using option ‘--no-stop-on-test-error’
- checking for file ‘cpr/DESCRIPTION’ ... OK
- this is package ‘cpr’ version ‘0.4.0’
- 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 executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking whether package ‘cpr’ can be installed ... [90s/63s] OK
See the install log for details.
- used C++ compiler: ‘g++ (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)’
- 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 code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... OK
- checking whether the package can be loaded with stated dependencies ... OK
- checking whether the package can be unloaded cleanly ... OK
- checking whether the namespace can be loaded with stated dependencies ... OK
- checking whether the namespace can be unloaded cleanly ... OK
- checking loading without being on the library search path ... 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 ... [12s/16s] OK
- checking Rd files ... OK
- checking Rd metadata ... OK
- checking Rd line widths ... 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 ... OK
- checking LazyData ... OK
- checking data for ASCII and uncompressed saves ... 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 use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK
- checking pragmas in C/C++ headers and code ... OK
- checking compilation flags used ... OK
- checking compiled code ... OK
- checking installed files from ‘inst/doc’ ... OK
- checking files in ‘vignettes’ ... OK
- checking examples ... [65s/78s] OK
- checking for unstated dependencies in ‘tests’ ... OK
- checking tests ... [137s/164s] ERROR
Running ‘test-bsplineD.R’
Running ‘test-bsplines.R’
Running ‘test-btensor.R’
Running ‘test-build_tensor.R’
Running ‘test-cn.R’ [13s/15s]
Running ‘test-cnr.R’ [9s/11s]
Running ‘test-coef_vcov.R’
Running ‘test-cp.R’
Running ‘test-cp_diff.R’
Running ‘test-cp_value.R’
Running ‘test-cpr.R’
Running ‘test-datasets.R’
Running ‘test-generate_cp_formula_data.R’
Running ‘test-get_spline.R’
Running ‘test-get_surface.R’
Running ‘test-iknots_or_df.R’
Running ‘test-influence_of_iknots.R’
Running ‘test-insert_a_knot.R’
Running ‘test-knot_expr.R’
Running ‘test-loglikelihood.R’
Running ‘test-matrix_rank.R’
Running ‘test-modify-formula-and-data.R’
Running ‘test-newknots.R’
Running ‘test-order_statistics.R’
Running ‘test-plot.cpr_bs.R’
Running ‘test-plot.cpr_cn.R’
Running ‘test-plot.cpr_cnr.R’
Running ‘test-plot.cpr_cp.R’
Running ‘test-plot.cpr_cpr.R’
Running ‘test-predict.R’ [20s/24s]
Running ‘test-recover-known-spline.R’ [12s/15s]
Running ‘test-summary.cpr_cn.R’
Running ‘test-summary.cpr_cnr.R’ [9s/11s]
Running ‘test-summary.cpr_cp.R’
Running ‘test-summary.cpr_cpr.R’
Running ‘test-trimmed_quantile.R’
Running ‘test-update_bsplines.R’ [13s/16s]
Running ‘test-wiggle.R’
Running the tests in ‘tests/test-cp.R’ failed.
Complete output:
> library(cpr)
> require(lme4)
Loading required package: lme4
Loading required package: Matrix
> require(geepack)
Loading required package: geepack
> ################################################################################
> # Verify that cp.cpr_bs and cp.formula both return similar objects
> e <- new.env()
> with(e, {
+
+ xvec <- runif(500, 0, 6)
+ bknots <- c(0, 6)
+ dat <- data.frame(x = xvec, y = sin((xvec - 2)/pi) + 1.4 * cos(xvec/pi))
+ acp <- cp(y ~ bsplines(x, df = 8, bknots = bknots), data = dat)
+ theta <- coef(lm(y ~ bsplines(x, df = 8, bknots = bknots) - 1, data = dat))
+ bcp <- cp(bsplines(xvec, df =8, bknots = bknots), theta)
+
+ stopifnot(isTRUE(all.equal(names(acp), names(bcp))))
+
+ stopifnot(identical(
+ names(acp)
+ ,
+ c("cp", "xi", "iknots", "bknots", "order", "call", "keep_fit", "fit", "theta", "coefficients", "vcov", "vcov_theta", "loglik", "rss", "rse")
+ ))
+
+ })
>
> ################################################################################
> # Verify that an error is thrown if bsplines is not used as expected in the
> # formula
> e <- new.env()
> with(e, {
+ test <- tryCatch(cp(log10(pdg) ~ age + ttm, data = spdg), error = function(e) e)
+ stopifnot(inherits(test, "error"))
+ stopifnot(identical(test$message, "bsplines() must appear first, once, and with no effect modifiers, on the right hand side of the formula."))
+ })
>
> e <- new.env()
> with(e, {
+ test <- tryCatch(cp(log10(pdg) ~ age + bsplines(ttm), data = spdg), error = function(e) e)
+ stopifnot(inherits(test, "error"))
+ stopifnot(identical(test$message, "bsplines() must appear first, once, and with no effect modifiers, on the right hand side of the formula."))
+ })
>
> e <- new.env()
> with(e, {
+ test <- tryCatch(cp(log10(pdg) ~ bsplines(ttm)*age, data = spdg), error = function(e) e)
+ stopifnot(inherits(test, "error"))
+ stopifnot(identical(test$message, "bsplines() must appear first, once, and with no effect modifiers, on the right hand side of the formula."))
+ })
>
> ################################################################################
> # Verify that a control polygon can be build from a lm
> e <- new.env()
> with(e, {
+ xvec <- seq(0, 5.9999, length = 500)
+ bknots <- c(0, 6)
+ dat <- data.frame(x = xvec, y = sin((xvec - 2)/pi) + 1.4 * cos(xvec/pi))
+ cp3 <- cp(y ~ bsplines(x, bknots = bknots), data = dat)
+
+ stopifnot(
+ isTRUE(
+ all.equal(
+ cp3$cp
+ ,
+ structure(list(xi_star = c(0, 2, 4, 6),
+ theta = c(0.797026006387093, 1.36601191348564, 1.19010324873104, 0.482219646221653)),
+ class = "data.frame", row.names = c(NA, -4L))
+ )
+ )
+ )
+
+ stopifnot(
+ isTRUE(
+ all.equal(
+ summary(cp3)
+ ,
+ structure(list(dfs = 4L, n_iknots = 0L, iknots = structure(list( numeric(0)), class = "AsIs"), loglik = 2218.47902453217, rss = 0.00409829163655395, rse = 0.0028744886068859, wiggle = structure(0.0685628056150533, abs.error = 7.61200054267312e-16, subdivisions = 1L, message = "OK"), fdsc = 1), row.names = c(NA, -1L), class = c("cpr_summary_cpr_cp", "data.frame"))
+ )
+ )
+ )
+ })
>
> ################################################################################
> # verify that a control ploygon can be build via lmer
> e <- new.env()
> with(e, {
+
+ lmer_cp <- cp(log10(pdg) ~ bsplines(day, bknots = c(-1, 1)) + (1 | id)
+ , data = spdg
+ , method = lmer)
+
+ stopifnot(
+ isTRUE(
+ all.equal(
+ lmer_cp$cp
+ ,
+ structure(list(xi_star = c(-1, -0.333333333333333, 0.333333333333333, 1), theta = c(0.192421846281352, -2.18938687153398, 1.98993907207642, 0.0777684276192437)), class = "data.frame", row.names = c(NA, -4L))
+ )
+ )
+ )
+
+ stopifnot(
+ isTRUE(
+ all.equal(
+ summary(lmer_cp)
+ ,
+ structure(list(dfs = 4L, n_iknots = 0L, iknots = structure(list( numeric(0)), class = "AsIs"), loglik = 7909.94604102081, rss = 622.553425369456, rse = 0.159004352365617, wiggle = structure(60.2815339858114, abs.error = 6.69259469907717e-13, subdivisions = 1L, message = "OK"), fdsc = 2), row.names = c(NA, -1L), class = c("cpr_summary_cpr_cp", "data.frame"))
+ )
+ )
+ )
+
+ })
Error in eval(substitute(expr), data, enclos = parent.frame()) :
isTRUE(all.equal(lmer_cp$cp, structure(list(xi_star = c(-1, -0.333333333333333, .... is not TRUE
Calls: with -> with.default -> eval -> eval -> stopifnot
In addition: Warning messages:
1: In optwrap(optimizer, devfun, getStart(start, rho$pp), lower = rho$lower, :
convergence code -2 from nloptwrap: NLOPT_INVALID_ARGS: Invalid arguments (e.g. lower bounds are bigger than upper bounds, an unknown algorithm was specified, etcetera).
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 51.9411 (tol = 0.002, component 1)
Execution halted
Running the tests in ‘tests/test-summary.cpr_cp.R’ failed.
Complete output:
> library(cpr)
> require(lme4)
Loading required package: lme4
Loading required package: Matrix
>
> ################################################################################
>
> e <- new.env()
> with(e, {
+
+ xvec <- runif(500, 0, 6)
+ bknots <- c(0, 6)
+
+ dat <- data.frame(x = xvec, y = sin((xvec - 2)/pi) + 1.4 * cos(xvec/pi))
+ acp <- cp(y ~ bsplines(x, df = 8, bknots = bknots), data = dat)
+
+ theta <- coef(lm(y ~ bsplines(x, df = 8, bknots = bknots) - 1, data = dat))
+ bcp <- cp(bsplines(xvec, df =8, bknots = bknots), theta)
+
+ s1 <- summary(acp, wiggle = TRUE)
+ s2 <- summary(acp, wiggle = TRUE)
+ s3 <- summary(bcp, wiggle = FALSE)
+ s4 <- summary(bcp, wiggle = FALSE)
+
+ stopifnot(inherits(s1, "cpr_summary_cpr_cp"))
+ stopifnot(inherits(s2, "cpr_summary_cpr_cp"))
+ stopifnot(inherits(s3, "cpr_summary_cpr_cp"))
+ stopifnot(inherits(s4, "cpr_summary_cpr_cp"))
+
+ stopifnot(inherits(s1, "data.frame"))
+ stopifnot(inherits(s2, "data.frame"))
+ stopifnot(inherits(s3, "data.frame"))
+ stopifnot(inherits(s4, "data.frame"))
+
+ stopifnot(identical(names(s1), c("dfs", "n_iknots", "iknots", "loglik", "rss", "rse", "wiggle", "fdsc")))
+ stopifnot(identical(names(s2), c("dfs", "n_iknots", "iknots", "loglik", "rss", "rse", "wiggle", "fdsc")))
+ stopifnot(identical(names(s3), c("dfs", "n_iknots", "iknots", "loglik", "rss", "rse", "wiggle", "fdsc")))
+ stopifnot(identical(names(s4), c("dfs", "n_iknots", "iknots", "loglik", "rss", "rse", "wiggle", "fdsc")))
+
+ stopifnot(identical(nrow(s1), 1L))
+ stopifnot(identical(nrow(s2), 1L))
+ stopifnot(identical(nrow(s3), 1L))
+ stopifnot(identical(nrow(s4), 1L))
+
+ stopifnot(identical(s1$dfs, 8L))
+ stopifnot(identical(s2$dfs, 8L))
+ stopifnot(identical(s3$dfs, 8L))
+ stopifnot(identical(s4$dfs, 8L))
+
+ stopifnot(identical(s1$n_iknots, 4L))
+ stopifnot(identical(s2$n_iknots, 4L))
+ stopifnot(identical(s3$n_iknots, 4L))
+ stopifnot(identical(s4$n_iknots, 4L))
+
+ stopifnot(is.list(s1$iknots))
+ stopifnot(is.list(s2$iknots))
+ stopifnot(is.list(s3$iknots))
+ stopifnot(is.list(s4$iknots))
+
+ stopifnot(isTRUE(!is.na(s1$loglik)))
+ stopifnot(isTRUE(!is.na(s2$loglik)))
+ stopifnot(isTRUE(is.na(s3$loglik)))
+ stopifnot(isTRUE(is.na(s4$loglik)))
+
+ stopifnot(isTRUE(!is.na(s1$rss)))
+ stopifnot(isTRUE(!is.na(s2$rss)))
+ stopifnot(isTRUE(is.na(s3$rss)))
+ stopifnot(isTRUE(is.na(s4$rss)))
+
+ stopifnot(isTRUE(!is.na(s1$rse)))
+ stopifnot(isTRUE(!is.na(s2$rse)))
+ stopifnot(isTRUE(is.na(s3$rse)))
+ stopifnot(isTRUE(is.na(s4$rse)))
+
+ stopifnot(isTRUE(!is.na(s1$wiggle)))
+ stopifnot(isTRUE(!is.na(s2$wiggle)))
+ stopifnot(isTRUE(is.na(s3$wiggle)))
+ stopifnot(isTRUE(is.na(s4$wiggle)))
+
+ stopifnot(isTRUE(!is.na(s1$fdsc)))
+ stopifnot(isTRUE(!is.na(s2$fdsc)))
+ stopifnot(isTRUE(is.na(s3$fdsc)))
+ stopifnot(isTRUE(is.na(s4$fdsc)))
+
+ })
> ################################################################################
> # summary of cp built via lmer
> e <- new.env()
> with(e, {
+
+ lmer_cp <- cp(log10(pdg) ~ bsplines(day, bknots = c(-1, 1)) + (1 | id)
+ , data = spdg
+ , method = lmer)
+
+ stopifnot(
+ isTRUE(
+ all.equal(
+ summary(lmer_cp)
+ ,
+ structure(list(dfs = 4L, n_iknots = 0L, iknots = structure(list( numeric(0)), class = "AsIs"), loglik = 7909.94604102081, rss = 622.553425369456, rse = 0.159004352365617, wiggle = structure(60.2815339858114, abs.error = 6.69259469907717e-13, subdivisions = 1L, message = "OK"), fdsc = 2), row.names = c(NA, -1L), class = c("cpr_summary_cpr_cp", "data.frame"))
+ )
+ )
+ )
+
+ lmer_cp <- cp(log10(pdg) ~ bsplines(day, df = 10, bknots = c(-1, 1)) + (1 | id)
+ , data = spdg
+ , method = lmer
+ )
+ lmer_cpr <- cpr(lmer_cp)
+ summary(lmer_cpr)
+ expected_summary <- structure(list(dfs = 4:10, n_iknots = 0:6, iknots = structure(list( numeric(0), -0.188465250965251, c(-0.188465250965251, 0.522392938868911), c(-0.387864823348694, -0.188465250965251, 0.522392938868911), c(-0.591390091390091, -0.387864823348694, -0.188465250965251, 0.522392938868911), c(-0.591390091390091, -0.387864823348694, -0.188465250965251, 0.0576230492196879, 0.522392938868911), c(-0.791871921182266, -0.591390091390091, -0.387864823348694, -0.188465250965251, 0.0576230492196879, 0.522392938868911)), class = "AsIs"), loglik = c(7909.94604102081, 10436.9685349426, 10737.2482721693, 10914.6482850108, 10921.8458243132, 10921.6797222902, 10918.8473988721), rss = c(622.553425369456, 503.060849675992, 490.342743968001, 482.912931876825, 482.468659854174, 482.310898509441, 482.293585986326), rse = c(0.159004352365617, 0.14293539213227, 0.141119884726865, 0.140049503551057, 0.139987909982521, 0.139967863538051, 0.139968194161426), wiggle = structure(c(60.2815339858114, 68.4958125786486, 35.8347712135129, 40.5896605338692, 38.0314913723466, 39.1709974050207, 41.1623689089349), abs.error = 6.69259469907717e-13, subdivisions = 1L, message = "OK"), fdsc = c(2, 2, 2, 2, 2, 2, 2), `Pr(>w_(1))` = c(NA, 0, 0, 0, 0, 4.04076772042572e-12, 0.00208664723131902)), row.names = c(NA, -7L), class = c("cpr_summary_cpr_cpr", "cpr_summary_cpr_cp", "data.frame"), elbow = structure(c(3, 2, 3, 2, 3, 2), dim = 2:3, dimnames = list( c("quadratic", "linear"), c("loglik", "rss", "rse"))))
+ stopifnot(isTRUE(all.equal(target = expected_summary, current = summary(lmer_cpr))))
+ })
Error in eval(substitute(expr), data, enclos = parent.frame()) :
isTRUE(all.equal(summary(lmer_cp), structure(list(dfs = 4L, n_iknots = 0L, .... is not TRUE
Calls: with -> with.default -> eval -> eval -> stopifnot
In addition: Warning messages:
1: In optwrap(optimizer, devfun, getStart(start, rho$pp), lower = rho$lower, :
convergence code -2 from nloptwrap: NLOPT_INVALID_ARGS: Invalid arguments (e.g. lower bounds are bigger than upper bounds, an unknown algorithm was specified, etcetera).
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 51.9411 (tol = 0.002, component 1)
Execution halted
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes ... OK
- checking re-building of vignette outputs ... [255s/301s] OK
- checking PDF version of manual ... [11s/14s] OK
- checking HTML version of manual ... OK
- checking for non-standard things in the check directory ... OK
- checking for detritus in the temp directory ... OK
- DONE
Status: 1 ERROR