I am trying to use ifelse statement at dosecontrol block but am not sure if it is supported. Here is my model.
ecmo_cov_model = @model begin
@param begin
POPCL ∈ RealDomain(lower=0.0)
θscr ∈ RealDomain(lower=0.0)
θpma ∈ RealDomain(lower=-100)
POPVc ∈ RealDomain(lower=0.0)
θage ∈ RealDomain(lower=0.0)
POPKa ∈ RealDomain(lower=0.0)
POPBioav ∈ RealDomain(lower=0.001)
ω²κF ∈ RealDomain(lower=0)
Ω1 ∈ PDiagDomain(2) #BSV for CL and Vc
σ_prop ∈ RealDomain(lower=0.0)
end
@random begin
η ~ MvNormal(Ω1)
κF ~ MvNormal(7, sqrt(ω²κF))
end
@covariates FFM AGEYRS PMA SCR PSF isECMO OCC
#FFM:Fat free mass(kg), AGEYRS:Age(PNA,yr), PMA:Postmenstrual age(wk), SCR:Serum creatinine(mg/dL)
@pre begin
TVCL = POPCL * (FFM/70)^0.75 * (0.3/SCR)^θscr * (1/(1 + (PMA/41)^θpma))
TVVc = POPVc * (FFM/70) * θage^log(AGEYRS/0.28)
CL = TVCL * exp(η[1])
Vc = TVVc * exp(η[2])
Ka = POPKa
end
@dosecontrol begin
bioav = ifelse.(isECMO .== 0, (Depot .= POPBioav, Central .= 1), (Depot .= POPBioav * exp(κF[OCC]), Central .= 1 * exp(κF[OCC])))
end
@dynamics begin
# 1cmt
Depot' = -Ka * Depot
Central' = Ka * Depot - Central * (CL/Vc)
end
@derived begin
CP = @. Central/Vc
DV ~ @. Normal(CP, abs(CP) * σ_prop)
end
end
I would like to estimate BOV when isECMO is true. In other words, bioav will keep changing in the time course of ECMO.
The error says Depot is not defined and I was wondering if the dosecontrol block makes sense.
Thank you in advance for your help!
I was able to resolve the previous issue thanks to your suggestion but am facing another error during fitting. I tried both bayesian post hoc estimation and fitting but they showed the same type of error. It worked before adding BOV and I suspect that OCC is causing the problem. Could you please look at them? Thank you for your help!
ecmo_cov_model = @model begin
@param begin
POPCL ∈ RealDomain(lower=0.001)
θscr ∈ RealDomain(lower=0.001)
θpma ∈ RealDomain(lower=-10, upper=-0.001)
POPVc ∈ RealDomain(lower=0.001)
θage ∈ RealDomain(lower=0.001)
POPKa ∈ RealDomain(lower=0.001, upper = 1.0)
POPBioav ∈ RealDomain(lower=0.001, upper = 0.95)
ω²κF ∈ RealDomain(lower=0.001)
Ω1 ∈ PDiagDomain(2) #BSV for CL and Vc
σ_prop ∈ RealDomain(lower=0.001)
end
@random begin
η ~ MvNormal(Ω1)
κF ~ MvNormal(8, sqrt(ω²κF))
end
@covariates FFM AGEYRS PMA SCR PSF isECMO OCC
@pre begin
TVCL = POPCL * (FFM/70)^0.75 * (0.3/SCR)^θscr * (1/(1 + (PMA/41)^θpma))
TVVc = POPVc * (FFM/70) * θage^log(AGEYRS/0.28)
CL = TVCL * exp(η[1])
Vc = TVVc * exp(η[2])
Ka = POPKa
end
@dosecontrol begin
bioav = (Depot = POPBioav * (exp(κF[OCC]) * isECMO == 1), Central = 1 * (exp(κF[OCC]) * isECMO == 1))
end
@dynamics begin
# 1cmt
Depot' = -Ka * Depot
Central' = Ka * Depot - Central * (CL/Vc)
end
@derived begin
CP = @. Central/Vc
DV ~ @. Normal(CP, abs(CP) * σ_prop)
end
end
# initial parameters
ecmo_cov_param = (POPCL = 0.372, #CL(l/h)
θscr = 0.265, #SCR effect on CL
θpma = -4.22, #PMA effect on CL
POPVc = 62.5, #Vc(L)
θage = 0.981, #AGEYRS effect on Vc
POPKa = 0.8, #θabsorption rate(1/hr)
POPBioav = 0.89, #θbioavailability
ω²κF = 0.3,
Ω1 = Diagonal([0.1814, 0.1052]), #varCL, varVc
σ_prop = 0.148)
baysian_post = predict(ecmo_cov_model, ecmo_data, ecmo_cov_param)
fit_result= fit(ecmo_cov_model,
ecmo_data,
ecmo_cov_param,
Pumas.FOCEI())
The below screenshot was a part of the error during the fitting.
This code made it possible to start iteration but it stopped during iteration. I don’t have any EVID=2. Could you please advise how I can fix this? Thank you!
Drs Vijay and Dawoon - Very interesting problem to solve. Pleased to see some talented scientists are tackling this topic. I have some clinical experience with ECMO. Dosing in ECMO patients is so challenging in the ICU.
The principal cause for the loss of ‘dose’ is due to the sticking of drug to the tubing. While this is not physiologic; I see you are trying to alter the bioavailability to account for this loss. Doesn’t bioavailability affect the dose only during ‘active dosing’? Which means for an oral dose, it is instantaneous. Probably this approach may not be viable for your problem. Have you considered an irreversible loss via an additional route ? It is also possible that this loss has a brief time course (kind of first-order). You might want to take some inspiration from how enterohepatic circulation is modeled.
Bob
Good point, Bob! Loss of drug through adhesion to the tube is usually modeled this way. I guess the OP was trying different modalities of handling this, but you are right that bioav is only applied to the time of the active dose and not after the dose is administered.
Thank you for your comments @bobbrown, @vijay .
I have been trying different models to deal with loss of drug in ECMO circuit and was wondering if I could employ this bioav concept into the model but it seems not a viable option. I will also look at enterohepatic circulation model and see if I can get an idea from it. Thank you so much for your suggestion and advice!
I’m getting this error with evid=2. I wrapping what’s in bioav in abs() + 0.001, but the error still remains. Do you have any other potential fix for this?
PumasDataError: Dose-related data items must be zero or missing when evid is 2
The dose control block for my simulations is as follows:
@dosecontrol begin
duration = (Central = tvdur * exp(ηdur),)
Ffast = logistic(logit(tvFfast) + ηFfast_logit + κFfast_logit[period])
Fslow = 1 - Ffast
Ffast_ = abs(Ffast * exp(κF[period])) + 0.01 # abs + adding small number to prevent biov from reaching 0
Fslow_ = abs(Fslow * exp(κF[period])) + 0.01 # abs + adding small number to prevent biov from reaching 0
bioav = (Central = (isT == 1) ? tvtr_F * Ffast_ : Ffast_,
Depot = (isT == 1) ? tvtr_F * Fslow_ : Fslow_
)
end
I don’t have the abs or + 0.01 in the estimation model.
The absorption model is parallel zero-order and transit compartment model. I have BOV on bioavailability through Ffast_ and Fslow_, which is where I think the problem could be coming from.