Implementing AUCtau in simulations #656
Unanswered
mattfidler
asked this question in
Q&A
Replies: 2 comments 6 replies
-
I think I could do it with this. 😄 https://ruminate.ubiquity.tools/articles/clinical_trial_simulation.html#example-resetting-states |
Beta Was this translation helpful? Give feedback.
6 replies
-
You can use the reset event library(rxode2)
#> rxode2 2.1.2 using 8 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()`
mod1 <- function() {
ini({
# central
KA=2.94E-01
CL=1.86E+01
V2=4.02E+01
# peripheral
Q=1.05E+01
V3=2.97E+02
# effects
Kin=1
Kout=1
EC50=200
})
model({
C2 <- centr/V2
C3 <- peri/V3
d/dt(depot) <- -KA*depot
d/dt(centr) <- KA*depot - CL*C2 - Q*C2 + Q*C3
d/dt(peri) <- Q*C2 - Q*C3
eff(0) <- 1
d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff
d/dt(AUCtau) <- C2
d/dt(AUCeTau) <- eff
})
}
ev <- et(amountUnits="mg", timeUnits="hours") %>%
et(amt=10000, addl=9,ii=12,cmt="depot") %>%
et(amt=0, evid=5, ii=12, addl=9, cmt="AUCtau") %>%
et(amt=0, evid=5, ii=12, addl=9, cmt="AUCeTau") %>%
et(time=120, amt=2000, addl=4, ii=14, cmt="depot") %>%
et(time=120, amt=0, evid=5, addl=4, ii=14, cmt="AUCtau") %>%
et(time=120, amt=0, evid=5, addl=4, ii=14, cmt="AUCeTau")
print(ev)
#> ── EventTable with 6 records ──
#> 6 dosing records (see $get.dosing(); add with add.dosing or et)
#> 0 observation times (see $get.sampling(); add with add.sampling or et)
#> multiple doses in `addl` columns, expand with $expand(); or etExpand()
#> ── First part of : ──
#> # A tibble: 6 × 6
#> time cmt amt ii addl evid
#> [h] <chr> [mg] [h] <int> <evid>
#> 1 0 depot 10000 12 9 1:Dose (Add)
#> 2 0 AUCtau 0 12 9 5:Replace
#> 3 0 AUCeTau 0 12 9 5:Replace
#> 4 120 depot 2000 14 4 1:Dose (Add)
#> 5 120 AUCtau 0 14 4 5:Replace
#> 6 120 AUCeTau 0 14 4 5:Replace
ev <- ev %>%
et(0:240) # Add sampling
x <- mod1 %>% rxSolve(ev)
plot(x, C2, eff, AUCtau, AUCeTau) Created on 2024-02-21 with reprex v2.1.0 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to find a way to use AUCtau of a compartment in rxode2/nlmixr2.
I could use, d/dt(AUCtau) = cp, but I want this AUCtau to reset every time a dosing happens.
How do I implement this?
Beta Was this translation helpful? Give feedback.
All reactions