You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to visualize the optimized sample times on top of the predicted curve, this points seem to be off. To me it looks like a problem with the times.
ff.ODE.compiled <- function(model_switch,xt,parameters,poped.db){
with(as.list(parameters),{
A_ini <- c(A1 = DOSE*Favail, A2 = 0)
times <- drop(xt)##xt[,,drop=T]
times <- sort(times)
times <- c(0,times) ## add extra time for start of integration
out <- ode(A_ini, times, func = "derivs", parms = c(CL,V,KA),
#jacfunc = "jac", # not really needed, speed up is minimal if this is defined or not.
dllname = "one_comp_oral_CL",
initfunc = "initmod", nout = 1, outnames = "Sum")
y = out[,"A2"]/(V)
y=y[-1] # remove initial time for start of integration
y = cbind(y) # must be a column matrix
return(list( y= y,poped.db=poped.db))
})
}
It seems the ff.ode.compiled function is a bit outdated and is doing a strange filtering. I would change it to
ff.ODE.compiled<-function(model_switch,xt,parameters,poped.db){
with(as.list(parameters),{
A_ini<- c(A1=DOSE*Favail, A2=0)
times_xt<- drop(xt) #xt[,,drop=T] times<- sort(times_xt)
times<- c(0,times) ## add extra time for start of integrationout<- ode(A_ini, times, func="derivs", parms= c(CL,V,KA),
#jacfunc = "jac", # not really needed, speed up is minimal if this is defined or not.dllname="one_comp_oral_CL",
initfunc="initmod", nout=1, outnames="Sum")
y=out[, "A2"]/(V)
y=y[match(times_xt,out[,"time"])]
y= cbind(y) # must be a column matrixreturn(list( y=y,poped.db=poped.db))
})
}
When trying to visualize the optimized sample times on top of the predicted curve, this points seem to be off. To me it looks like a problem with the times.
`library(PopED)
library(deSolve)
sfg <- function(x,a,bpop,b,bocc){
parameters=c(CL=bpop[1]*exp(b[1]),
V=bpop[2]*exp(b[2]),
KA=bpop[3]*exp(b[3]),
Favail=bpop[4],
DOSE=a[1])
return(parameters)
}
system("R CMD SHLIB one_comp_oral_CL.c")
dyn.load(paste("one_comp_oral_CL", .Platform$dynlib.ext, sep = ""))
ff.ODE.compiled <- function(model_switch,xt,parameters,poped.db){
with(as.list(parameters),{
A_ini <- c(A1 = DOSE*Favail, A2 = 0)
times <- drop(xt)##xt[,,drop=T]
times <- sort(times)
times <- c(0,times) ## add extra time for start of integration
out <- ode(A_ini, times, func = "derivs", parms = c(CL,V,KA),
#jacfunc = "jac", # not really needed, speed up is minimal if this is defined or not.
dllname = "one_comp_oral_CL",
initfunc = "initmod", nout = 1, outnames = "Sum")
y = out[,"A2"]/(V)
y=y[-1] # remove initial time for start of integration
y = cbind(y) # must be a column matrix
return(list( y= y,poped.db=poped.db))
})
}
-- Define initial design and design space
poped.db.compiled <- create.poped.database(ff_fun=ff.ODE.compiled,
fg_fun = sfg,
fError_fun = feps.add.prop,
bpop=c(CL=0.15, V=8, KA=1.0, Favail=1),
notfixed_bpop=c(1,1,1,0),
d=c(CL=0.07, V=0.02, KA=0.6),
sigma=c(0.01,0.25),
groupsize=32,
xt=c( 0.5,1,2,6,24,36,72,120),
minxt=0,
maxxt=120,
a=c(DOSE=70),
mina=c(DOSE=0),
maxa=c(DOSE=100))
create plot of model with variability
plot_model_prediction(poped.db.compiled,IPRED=T,DV=T)
making optimization times more resonable
output <- poped_optim(poped.db.compiled ,opt_xt=T, opt_a=T, parallel=T, dlls = c('one_comp_oral_CL'))
plot_model_prediction(output$poped.db,IPRED=T,DV=T)`
Plot before optimization
Plot after optimization
The text was updated successfully, but these errors were encountered: