Problems creating new_ode model
Hi guys,
I want to create a one compartment model with first order absorption and elimination (drug administered orally). I want the model to contain bioavailabilty and half life time and to be able to show concentrations and to predict time to reach steady state.
I first tried to model it like this (without halflife time):
par_mod_BA<-list(KA=1, KEL=0.6, F=0.98) reg_mod_BA<-new_regimen( amt=400, interval=24, n=5 ) mod_BA<-new_ode_model( code=" dAdt[1]=-KAA[1]; dAdt[2]=KAA[1]-KEL*A[2]", dose=list(cmt=1, bioav="F"), obs=list(cmt=2), parameters=c("F","KEL", "KA") )
My questions is: I want to include half life time "HLT", that can be described by the term HLT=ln(2)/KEL, KEL=ln(2)/HLT respectively. I tried it by making HLT a covariate.
cov1<-list("HLT"=new_covariate(value=17))
par_mod_BA<-list(KA=1, KEL=0.6, F=0.98)
reg_mod_BA<-new_regimen( amt=400, interval=24, n=5 )
mod_BA_HLT<-new_ode_model( code=" dAdt[1]=-KAA[1]; dAdt[2]=KAA[1]-KEL*A[2]; KEL=log(2)/HLT", declare_variables=c("KEL","KA"), covariates=cov1 )
data_mod_BA_HLT<-sim_ode(ode=mod_BA_HLT, regimen=reg_mod_BA, parameters=par_mod_BA)
But when I try to run the simulation is says: Error in sim(...) : Not all covariates for this model have been specified. Missing: HLT
but I don't understand because I specified it in my opinion. I tried to fix it but I can't figure out what I am doing wrong...
Thank you so much for any help!:)