Closed sliao999 closed 1 year ago
Hi @sliao999 you can put the time-changing parameter as a covariate in the dataset, or you can use time
in your model, whatever you prefer.
times <- list(t1 = seq(0, 12, by = 0.1), t2 = seq(12, 24, by = 0.1)) params <- list(t1 = c(param1 = 1, param2 = 2), t2 = c(param1 = 3, param2 = 4))
inits <- c(state1 = 0, state2 = 0) ode <- " dxdt1 = -param1 x1 dxdt2 = param1 x1 - param2 * x2 " out <- rxSolve(model = ode, times = times, params = params, inits = inits)
Can you please share an example?
Sam
How do you do this as a covariate? In our case, the covariate is the dose, and CL is a function of dose such as CL=12*(dose/300)^0.42. The dose can change in different treatment period such as: Times = list(t1 = seq(0, 12, by = 0.1), t2 = seq(12, 24, by = 0.1)),
library(rxode2)
#> rxode2 2.0.13.9000 using 8 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()`
f <- function() {
model({
d/dt(x1) = -param1 * x1
d/dt(x2) = param1 * x1 - param2 * x2
x1(0) <- 10
x2(0) <- 20
})
}
e <- et(0, 12, by = 0.1) %>%
as.data.frame()
e$param1 <- ifelse(e$time < 6, 0.5, 10)
e$param2 <- ifelse(e$time < 6, 0.5, 20)
out <- rxSolve(f, e)
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
plot(out, log="y")
#> Warning in self$trans$transform(x): NaNs produced
#> Warning: Transformation introduced infinite values in continuous y-axis
#> Warning: Removed 38 rows containing missing values (`geom_line()`).
Created on 2023-08-16 with reprex v2.0.2
Like nonmem it is in the dataset.
I got it, thanks.
Sam
It works! Thanks a lot.
Sam
I was able to make the change in CL and V1 as time-dependent covariate in rxode. However, I found the bump in simulated PK profiles that seem to be corresponding to the change in CL and V1. Did anyone have this issue too? Any way to resolve this?
Sam
Hi @sliao999
This should be expected.
That being said, you can try different covariate interpolation methods, ie
covsInterpolation="nocb"
(NONMEM default)covsInterpolation="locf"
(Monolix/nlmixr2 default)covsInterpolation="linear"
covsInterpolation="midpoint"
Thanks a lot for your quick reply.
I tried "nocb" and "locf", and it still has this bump when CL changed.
The bump is likely when the time-varying covariate changes, and is likely expected. You could try linear.
Hi, For the same simulation, I got somewhat different results between NONMEM and rxode2. Is this expected? In NONMEM, I used ADVAN14 TOL=12 ATOL=12 to solve the PK model with Weibull-type input. Is there a similar method in rxode2?
Sam
ADVAN14 is a different solver (CVODES
), so yes you should expect different outputs. rxode2
does not implement CVODE
s at the present time
Thanks a lot for your quick reply. To match the results of rxode2, which NONMEM method can I used? ADVAN13 or ADVAN8?
Sam
Times = list(t1 = seq(0, 12, by = 0.1), t2 = seq(12, 24, by = 0.1)), out <- rxSolve(model = ode, params = params, inits = inits)
params has different values in t1, and t2. How can I use rxSolve to solve the PK model ode? if t1 params=param1, else if t2 params=param1,
Sam