diff --git a/tests/testthat/test-poped.R b/tests/testthat/test-poped.R index ce53ad11..c8f4bc62 100644 --- a/tests/testthat/test-poped.R +++ b/tests/testthat/test-poped.R @@ -316,6 +316,62 @@ if (requireNamespace("PopED", quietly=TRUE)) { }) + test_that("shrinkage", { + + f <- function() { + ini({ + tV <- 72.8 + tKa <- 0.25 + tCl <- 3.75 + tF <- fix(0.9) + + eta.v ~ 0.09 + eta.ka ~ 0.09 + eta.cl ~0.25^2 + + prop.sd <- fix(sqrt(0.04)) + add.sd <- fix(sqrt(5e-6)) + + }) + model({ + V<-tV*exp(eta.v) + KA<-tKa*exp(eta.ka) + CL<-tCl*exp(eta.cl) + Favail <- tF + N <- floor(time/TAU)+1 + y <- (DOSE*Favail/V)*(KA/(KA - CL/V)) * + (exp(-CL/V * (time - (N - 1) * TAU)) * + (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - + exp(-KA * (time - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU))) + + y ~ prop(prop.sd) + add(add.sd) + }) + } + + # minxt, maxxt + e <- et(list(c(0, 10), + c(0, 10), + c(0, 10), + c(240, 248), + c(240, 248))) %>% + as.data.frame() + + #xt + e$time <- c(1,2,8,240,245) + + + babel.db <- nlmixr2(f, e, "poped", + popedControl(groupsize=20, + bUseGrouped_xt=TRUE, + a=list(c(DOSE=20,TAU=24), + c(DOSE=40, TAU=24)), + maxa=c(DOSE=200,TAU=24), + mina=c(DOSE=0,TAU=24))) + + expect_error(shrinkage(babel.db), NA) + + }) + ## The tests run interactively runs OK ## However, the capture output seems to be interfere with the tests (from PopED) # So... these are commented out for now.