Skip to content

Commit

Permalink
Update poped tests and news
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Oct 19, 2024
1 parent ce07dd5 commit 44044d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/test-poped.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 44044d0

Please sign in to comment.