From 44044d0ef91da0115706c925f471e788be804495 Mon Sep 17 00:00:00 2001 From: Matthew Fidler Date: Fri, 18 Oct 2024 19:04:35 -0500 Subject: [PATCH] Update poped tests and news --- NEWS.md | 2 +- tests/testthat/test-poped.R | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 0b045619..c554b364 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,7 +13,7 @@ `PopED` code between two different `PopED` databases, like in issue #131. -* Added a new function `popedBpopIdx(poped.db, "par")` which will get +* Added a new function `babelBpopIdx(poped.db, "par")` which will get the poped index for a model generated from `babelmixr2`, which is useful when calculating the power (as in example 11). diff --git a/tests/testthat/test-poped.R b/tests/testthat/test-poped.R index 07d88e01..7582b8f7 100644 --- a/tests/testthat/test-poped.R +++ b/tests/testthat/test-poped.R @@ -379,27 +379,22 @@ if (requireNamespace("PopED", quietly=TRUE)) { tCl <- 3.75 tF <- fix(0.9) pedCL <- 0.8 - 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) * (pedCL**isPediatric) # add covariate for pediatrics - CL<-tCl*exp(eta.cl) + KA<-tKa*exp(eta.ka) + CL<-tCl*exp(eta.cl) * (pedCL^isPediatric) # add covariate for pediatrics Favail <- tF - N <- floor(t/TAU)+1 y <- (DOSE*Favail/V)*(KA/(KA - CL/V)) * (exp(-CL/V * (t - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - exp(-KA * (t - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU))) - y ~ prop(prop.sd) + add(add.sd) }) } @@ -436,6 +431,11 @@ if (requireNamespace("PopED", quietly=TRUE)) { vdiffr::expect_doppelganger("poped-ped-next", plot_model_prediction(babel.db.ped, model_num_points = 300)) + + expect_equal(babelBpopIdx(babel.db.ped, "pedCL"), 4L) + + expect_error(babelBpopIdx(babel.db, "matt")) + }) ## The tests run interactively runs OK