R Under development (unstable) (2024-11-28 r87392 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## ===== confband ===== > ## -- Test utils & settings > source("test_util.R") > .run_test <- identical(Sys.getenv("NOT_CRAN"), "true") > oldopt <- options(digits = 4) > set.seed(100) > > library("tramME") Loading required package: tram Loading required package: mlt Loading required package: basefun Loading required package: variables Loading required package: mvtnorm > library("survival") > > m_cars <- BoxCoxME(dist ~ speed, data = cars) > > ## -- Consistency under various argument values > pr1 <- confband(m_cars, newdata = data.frame(speed = c(0, 1))) > pr2 <- confband(m_cars, newdata = NULL) > pr3 <- confband(m_cars, newdata = data.frame(speed = c(0, 1)), + baseline_only = TRUE) > > chkeq(pr1[[1]], pr2, check.attributes = FALSE) > chkeq(pr1[[1]], pr3[[2]], check.attributes = FALSE) > > ## set q > pr1 <- confband(m_cars, newdata = data.frame(speed = c(0, 1)), + q = c(20, 40)) > > ## -- Consistency with predict > data("sleepstudy", package = "lme4") > m_sleep <- ColrME(Reaction ~ s(Days) + (Days | Subject), data = sleepstudy) > > nd <- model.frame(m_sleep)[c(1, 171), ] > cb <- confband(m_sleep, newdata = nd, K = 100, type = "distribution") > re <- ranef(m_sleep)[[1]][c(1, 18), ] > pr <- predict(m_sleep, newdata = nd[, -1L], ranef = c(t(re)), + K = 100, type = "distribution") > chkeq(cb[[1]][, 2], pr[, 1], check.attributes = FALSE) > chkeq(cb[[2]][, 2], pr[, 2], check.attributes = FALSE) > > ## set q > nd <- data.frame(dist = c(20, 40), speed = c(1, 1)) > pr2 <- predict(m_cars, newdata = nd, type = "trafo") > chkeq(pr1[[2]][, 2], pr2, check.attributes = FALSE) > > ## TODO -- Adjust > ## pr1 <- confband.tramME(m_cars, newdata = data.frame(speed = c(0, 1)), > ## adjust = TRUE, K = 100, cheat = 20) > > summarize_tests() ========================== Number of failed tests: 0 ========================== > > options(oldopt) > > proc.time() user system elapsed 2.17 0.18 2.36