nlmixr2 / rxode2

rxode2
https://nlmixr2.github.io/rxode2/
GNU General Public License v3.0
28 stars 8 forks source link

Feature Request: fixed steady state #205

Closed mattfidler closed 2 years ago

mattfidler commented 2 years ago

SS in monolix is handled by a fixed number of doses. Alllow this as a non-default method to match monolix

mattfidler commented 2 years ago

Could use maxSS instead...?

billdenney commented 2 years ago

I always think of steady-state as a dynamically-detected thing where integration occurs to within a tolerance at the measured points. A fixed number of doses does not guarantee steady-state. If the concern is that steady-state will never be detected, then there should/could be a maximum number of doses to achieve steady-state (but then, I'd think it'd error out/give NA predicted concentrations rather than anything else).

mattfidler commented 2 years ago

Well, that isn't the purpose of this request. Rather, this is to match monolix's behavior to allow nlmixr2/rxode2 to match the predictions of the Monolix output.

Right now, rxode2 handles steady state similar to what you are describing.

billdenney commented 2 years ago

Ah, got it. Thanks for the clarification. For that, making an option makes sense to me.

mattfidler commented 2 years ago
library(rxode2)
#> rxode2 2.0.7 using 4 threads (see ?getRxThreads)

ode.1c <- rxode2({
  V <- 20
  Cl <- 0.05
  fc <- 1
  C2 <- center / V
  d/dt(center) ~ -Cl * C2
  f(center) <- fc
})

d <- 3
ii <- 6

et3 <- et() %>%
  et(amt = d, ss = 1, ii = ii) %>%
  et(amt = d, time = ii) %>%
  et(seq(0, 48, length.out = 200))

xss <- solve(ode.1c, et3)

p1 <- plot(xss)

x2 <- solve(ode.1c, et3, minSS=7, maxSS=8, ssAtol=100, ssRtol=100)

p2 <- plot(x2)

library(patchwork)

p1 / p2

Created on 2022-05-19 by the reprex package (v2.0.1)

As long as you have 7 or more, then this approach can work.

Which means the babelmixr should only support 7 ss doses (or more)