From 036d3c6009bfec71b10dac2b8c3ab2235e1fc651 Mon Sep 17 00:00:00 2001 From: Matthew Fidler Date: Tue, 15 Oct 2024 13:45:59 -0500 Subject: [PATCH] Add failing test --- tests/testthat/test-poped.R | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/testthat/test-poped.R b/tests/testthat/test-poped.R index 92ec14be..9752499d 100644 --- a/tests/testthat/test-poped.R +++ b/tests/testthat/test-poped.R @@ -594,4 +594,33 @@ if (requireNamespace("PopED", quietly=TRUE)) { ## test_that("example 3", { ## }) + + test_that("PopED lhs", { + + pheno <- function() { + ini({ + tcl <- log(0.008) # typical value of clearance + tv <- log(0.6) # typical value of volume + ## var(eta.cl) + eta.cl + eta.v ~ c(1, + 0.01, 1) ## cov(eta.cl, eta.v), var(eta.v) + # interindividual variability on clearance and volume + add.err <- 0.1 # residual variability + }) + model({ + cl <- exp(tcl + eta.cl) # individual value of clearance + if (fed == 1) + cl <- cl*1.1 + v <- exp(tv + eta.v) # individual value of volume + ke <- cl / v # elimination rate constant + d/dt(A1) = - ke * A1 # model differential equation + cp = A1 / v # concentration in plasma + cp ~ add(add.err) # define error model + }) + } + + p <- pheno() + + expect_equal(eval(.popedRxModel(p))$lhs, c("rx_pred_", "rx_r_")) + }) }