Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

684 test for iov simulation #685

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
})
})
Loading