Skip to content

Commit

Permalink
Merge pull request #685 from nlmixr2/684-test-for-iov-simulation
Browse files Browse the repository at this point in the history
684 test for iov simulation
  • Loading branch information
mattfidler authored Jun 7, 2024
2 parents 6cfbaac + 4b8b7d8 commit 83db1a5
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: rxode2
Version: 2.1.3
Version: 2.1.3.9000
Title: Facilities for Simulating from ODE-Based Models
Authors@R: c(
person("Matthew L.","Fidler",
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# rxode2 (development version)

# rxode2 2.1.3

## Bug fixes
Expand Down
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- This works with the new rxode2 parse
- This is more pendantic with the no-remap so that no-remap is everywhere :)
- This moves the ignored steady state indicators to a allocated
integer so garbage collection will not cause gcc-USBAN alignment
errors
65 changes: 65 additions & 0 deletions tests/testthat/test-occ.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,69 @@ rxTest({

.en <- rxExpandNesting(mod, .ni)
})

test_that("nesting test from https://github.com/nlmixr2/rxode2random/issues/25", {

mod <- rxode2({
TABS = TV_TABS * exp(eta.TABS + iov.TABS)
TR_Fbio = TV_TR_Fbio + eta.TR_Fbio + iov.TR_Fbio
CL = TV_CL * exp(eta.CL)
V1 = TV_V1 * exp(eta.V1)
V2 = TV_V2 * exp(eta.V2)
CLD = TV_CLD * exp(eta.CLD)
KA = log(2) / (TABS/60)
FBIO = 1 / (exp(-TR_Fbio) + 1)
DC1 = AMT1/V1
DC2 = AMT2/V2
d/dt(AMTa) = -KA * AMTa
d/dt(AMT1) = FBIO * KA * AMTa - CLD * DC1 + CLD * DC2 - CL * DC1
d/dt(AMT2) = + CLD * DC1 - CLD * DC2
d/dt(AUC) = DC1
})

n <- 10

theta <- c("TV_TABS" = 45,
"TV_TR_Fbio" = logit(x = 0.85),
"TV_CL" = 10,
"TV_V1" = 10,
"TV_V2" = 65,
"TV_CLD" = 25)


omega <- lotri::lotri(
lotri::lotri(eta.TABS~0.25,
eta.TR_Fbio~0.20,
eta.CL~0.30,
eta.V1~0.30,
eta.V2~0.45,
eta.CLD~0.15) | id(nu=n),
lotri::lotri(iov.TABS~0.15,
iov.TR_Fbio~0.15) | occ(nu=n*2))

dosing <- et(amt=1000,
addl=6,
ii=24,
evid=1,
cmt="AMTa",
time=0) %>%
et(amt=1000,
addl=6,
ii=24,
evid=4,
cmt="AMTa",
time = 336) %>%
et(seq(0,168,0.5)) %>%
et(seq(336,672,0.5)) %>%
et(id=seq(1,n))

dosing <- dplyr::mutate(dosing, occ = 1) %>%
dplyr::mutate(occ = ifelse(time>=336,2,occ))

expect_error(rxSolve(object = mod,
theta,
omega=omega,
ev=dosing,
nDisplayProgress=100L), NA)
})
})

0 comments on commit 83db1a5

Please sign in to comment.