-
Notifications
You must be signed in to change notification settings - Fork 1
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
poped - infusion time as optimization variable "a" #131
Comments
For ODEs, you can if you code infusion time as a duration, ie ....
dur(central) = Tinf
... Then in your design table you would have to use |
You would use
I don't know how to reproduce your issue, so I don't know why. I do know I don't use underscores, so this comes from |
Just looked at the code, since you are looking at an infusion, you can't really optimize over dose. |
The
|
It seems to be getting the Without it you can get what you need: library(babelmixr2)
#> Loading required package: nlmixr2
#> Loading required package: nlmixr2data
library(PopED)
f <- function() {
ini({
tp <- fix(100)
td <- fix(0.001)
te <- fix(1e-7)
ts <- fix(20000)
tKA <- log(0.8)
tKE <- log(0.15)
tVD <- log(100) #VD=log(100000),
tEC50 <- log(0.12) #EC50=log(0.00012),
tn <- log(2)
tdelta <- log(0.2)
tc <- log(7)
eta.KA ~ 0.25
eta.KE ~ 0.25
eta.VD ~ 0.25
eta.EC50 ~0.25
eta.n ~ 0.25
eta.delta ~ 0.25
eta.c ~ 0.25
add.sd.pk <- sqrt(0.04) # nlmixr2 uses sd
add.sd.pd <- sqrt(0.04)
})
model({
p <- tp
d <- td
e <- te
s <- ts
KA <- exp(tKA + eta.KA)
KE <- exp(tKE + eta.KE)
VD <- exp(tVD + eta.VD)
EC50 <- exp(tEC50 + eta.EC50)
n <- exp(tn + eta.n)
delta <- exp(tdelta + eta.delta)
c <- exp(tc + eta.c)
# # Apply the conditional logic -
# # This does not work right now - could be addressed in the future
# if ( (time - (floor(time / TAU) * TAU)) < TINF) {
# In <- DOSE / TINF # Infusion rate
# } else {
# In <- 0 # No infusion
# }
d/dt(depot) = -KA*depot # + In
d/dt(central) = KA*depot - KE*central
d/dt(TC) = s - TC*(e*VP+d) # target cells (TC)
d/dt(IC) = e*TC*VP-delta*IC # productively infected cells (IC)
d/dt(VP) = p*(1-(pow(central/VD,n)/(pow(central/VD,n)+pow(EC50,n))))*IC-c*VP # viral particles (VP)
# Initial conditions
dur(depot) = 1
# depot(0) <- DOSE
TC(0) =c*delta/(p*e)
IC(0) =(s*e*p-d*c*delta)/(p*delta*e)
VP(0) = (s*e*p-d*c*delta)/(c*delta*e)
# Concentration and effect are calculated
conc = central/VD
eff = log10(VP)
## And both are assumed to follow additive error
conc ~ add(add.sd.pk)
eff ~ add(add.sd.pd)
})
}
rxClean()
f <- f()
TAU = 7
e1 <- et(c( 0,0.25,0.5,1,2,3,4,7,10,14,21,28)) %>%
add.dosing(dose=180, nbr.doses=4, dosing.interval=TAU) %>%
as.data.frame() %>%
dplyr::mutate(dvid=1)
e2 <- et(c( 0,0.25,0.5,1,2,3,4,7,10,14,21,28)) %>%
add.dosing(dose=0, nbr.doses=4, dosing.interval=TAU) %>%
as.data.frame() %>%
dplyr::mutate(dvid=2) %>%
dplyr::filter(is.na(ii))
e <- rbind(e1, e2)
babel.db <- nlmixr2(f, e, "poped",
popedControl(
groupsize=30,
#a=list(c(TINF=1))))
# a=list(c(DOSE=180,TINF=1,TAU=7))
))
#> ℹ ordering data by dvid and time
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
#>
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
## create plot of model without variability
plot_model_prediction(babel.db, facet_scales = "free")
#> rxode2 3.0.1.9000 using 8 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()` evaluate_design(babel.db)
#> $ofv
#> [1] 88.05631
#>
#> $fim
#> tKA tKE tVD tEC50 tn
#> tKA 85.8596242 17.8246985 -14.0568779 -0.1678529 -2.315434
#> tKE 17.8246985 103.6929320 11.7609721 0.2768431 2.567008
#> tVD -14.0568779 11.7609721 109.9254711 0.3285378 -2.178854
#> tEC50 -0.1678529 0.2768431 0.3285378 41.3594004 -29.456807
#> tn -2.3154336 2.5670081 -2.1788544 -29.4568068 105.587877
#> tdelta 0.7321587 -3.6388776 2.3495185 -0.6219348 2.953830
#> tc 7.5425097 -1.0455137 1.0248459 -20.3366826 -5.574666
#> d_eta.KA 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> d_eta.KE 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> d_eta.VD 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> d_eta.EC50 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> d_eta.n 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> d_eta.delta 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> d_eta.c 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> sig_var_add.sd.pk 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> sig_var_add.sd.pd 0.0000000 0.0000000 0.0000000 0.0000000 0.000000
#> tdelta tc d_eta.KA d_eta.KE d_eta.VD
#> tKA 0.7321587 7.542510 0.000000e+00 0.000000e+00 0.00000000
#> tKE -3.6388776 -1.045514 0.000000e+00 0.000000e+00 0.00000000
#> tVD 2.3495185 1.024846 0.000000e+00 0.000000e+00 0.00000000
#> tEC50 -0.6219348 -20.336683 0.000000e+00 0.000000e+00 0.00000000
#> tn 2.9538303 -5.574666 0.000000e+00 0.000000e+00 0.00000000
#> tdelta 114.3630827 1.560629 0.000000e+00 0.000000e+00 0.00000000
#> tc 1.5606288 101.909897 0.000000e+00 0.000000e+00 0.00000000
#> d_eta.KA 0.0000000 0.000000 1.228646e+02 5.295331e+00 3.29326567
#> d_eta.KE 0.0000000 0.000000 5.295331e+00 1.792037e+02 2.30534602
#> d_eta.VD 0.0000000 0.000000 3.293266e+00 2.305346e+00 201.39340916
#> d_eta.EC50 0.0000000 0.000000 4.695781e-04 1.277368e-03 0.00179905
#> d_eta.n 0.0000000 0.000000 8.935389e-02 1.098255e-01 0.07912350
#> d_eta.delta 0.0000000 0.000000 8.934279e-03 2.206905e-01 0.09200264
#> d_eta.c 0.0000000 0.000000 9.481578e-01 1.821833e-02 0.01750552
#> sig_var_add.sd.pk 0.0000000 0.000000 1.782866e+02 1.122728e+02 70.25054514
#> sig_var_add.sd.pd 0.0000000 0.000000 6.683309e+01 1.417364e+01 8.92725686
#> d_eta.EC50 d_eta.n d_eta.delta d_eta.c
#> tKA 0.000000e+00 0.00000000 0.000000e+00 0.00000000
#> tKE 0.000000e+00 0.00000000 0.000000e+00 0.00000000
#> tVD 0.000000e+00 0.00000000 0.000000e+00 0.00000000
#> tEC50 0.000000e+00 0.00000000 0.000000e+00 0.00000000
#> tn 0.000000e+00 0.00000000 0.000000e+00 0.00000000
#> tdelta 0.000000e+00 0.00000000 0.000000e+00 0.00000000
#> tc 0.000000e+00 0.00000000 0.000000e+00 0.00000000
#> d_eta.KA 4.695781e-04 0.08935389 8.934279e-03 0.94815778
#> d_eta.KE 1.277368e-03 0.10982551 2.206905e-01 0.01821833
#> d_eta.VD 1.799050e-03 0.07912350 9.200264e-02 0.01750552
#> d_eta.EC50 2.851000e+01 14.46172406 6.446730e-03 6.89301052
#> d_eta.n 1.446172e+01 185.81333118 1.454185e-01 0.51794849
#> d_eta.delta 6.446730e-03 0.14541851 2.179819e+02 0.04059285
#> d_eta.c 6.893011e+00 0.51794849 4.059285e-02 173.09377536
#> sig_var_add.sd.pk 2.276454e+00 4.33466660 1.610358e+01 24.09061842
#> sig_var_add.sd.pd 2.029990e+02 57.90926983 4.783497e+01 115.22550284
#> sig_var_add.sd.pk sig_var_add.sd.pd
#> tKA 0.000000 0.000000
#> tKE 0.000000 0.000000
#> tVD 0.000000 0.000000
#> tEC50 0.000000 0.000000
#> tn 0.000000 0.000000
#> tdelta 0.000000 0.000000
#> tc 0.000000 0.000000
#> d_eta.KA 178.286607 66.833089
#> d_eta.KE 112.272850 14.173638
#> d_eta.VD 70.250545 8.927257
#> d_eta.EC50 2.276454 202.999006
#> d_eta.n 4.334667 57.909270
#> d_eta.delta 16.103582 47.834967
#> d_eta.c 24.090618 115.225503
#> sig_var_add.sd.pk 87821.881319 959.139934
#> sig_var_add.sd.pd 959.139934 77727.049239
#>
#> $rse
#> tKA tKE tVD tEC50
#> 50.199535 5.334518 2.116734 8.848459
#> tn tdelta tc d_eta.KA
#> 16.127344 5.819421 5.525224 36.176782
#> d_eta.KE d_eta.VD d_eta.EC50 d_eta.n
#> 29.911831 28.197607 77.515557 29.947637
#> d_eta.delta d_eta.c sig_var_add.sd.pk sig_var_add.sd.pd
#> 27.094601 30.561106 8.453072 9.057133 Created on 2024-10-18 with reprex v2.1.1 |
Not an issue per se - unsure on how to code this
Can we have infusion time coded as an "a" poped variable?
I am trying some code structure similar to this - maybe different coding should be used?
Code example:
https://github.com/nlmixr2/babelmixr2/blob/poped-examples-tp/inst/poped/ex.10.PKPD.HCV.babelmixr2.R
The text was updated successfully, but these errors were encountered: