I have a question related to creating DosageRegimen in which Dose varies during infusion time.
Let’s assume that due to some reason that the drug loses during infusing, and the concentration decreases with time. And I want to create the ‘dynamical dose’. Is any way for me to do this?
For instance, I have 1000 mg at the onset of therapy, after 30 min, the amt is 950 mg until fulfilling the infusion, assume 2h, the amt is 800 mg. If I traditionally create DosageRegimen, the dose (and actually the concentration) is seen to be incremental.
You can create 3 different infusion doses with your specifications. For eg, first infusion is 50mg for 30min, followed by 150mg for 2h…etc. Can you try that?
J
I tried this before asking my question, but it didn’t work. The amt is counter for new events, but in this example, it must still be in 1 events.
I also tried to modify in @model like that, Cp = @. (Central.X%)/Vc, where X% is array[100, 95, 90, 85, 80]. But it when I executed my simulation, I had an error DimensionMismatch("arrays could not be broadcast to a common size; got a dimension with lengths 129 and 7")
The problem is due to some reason (especially instability drug), the drug loses during infusing, and the concentration (and amt) decreases with time in the infusing solution.
So lets me assume that the drug is given in extended infusion (for example with 3h), then the amt naturally decreases in infusion solution bags. So basically, it is still in 1 events.
I don’t know whether what I explained above matching with your question.
My question was mostly why it’s necessary to treat this as a single dose in the dataset/software. It’s not clear to me why it would matter. Splitting it into three doses in the dataset would just be a convenient way of handling the effect that you are describing. The number of events in the software seems like it could be considered an internal detail as long as the total dose matches what was administered.
An alternative solution that might be closer to the real world would be to model the infusion rate as a smoothly decaying function over time. That is possible but then you’d have to carry the dose information as a covariate instead of using the event system since the latter only handles the three standard administration types. That can be done in the pre block. See the Weibull example in Absorption models for how this can be done.
Dear Tien - Interesting discussion. You may want to consider the following if you want to treat the dose as one event:
Setup a diff eq based model with a depot and central compartments. Use a first-order transfer from depot to central; you can fix the ka to a high number 5/hr for eg. This will not be your rate-limiting step.
Add a zero-order kloss from the depot compartment. If you know the ‘degradation’ rate from stability experiments you can fix to that rate here.
Perform a simple simulation to begin with, to make sure this is what you wanted to achieve.
If happy so far, then you can add a step-wise change in the kloss based on your requirements.
J
Thank you, Joga and Andreas Noack for your recommendation.
First, I have the same idea as you, Joga. But the depot here corresponding to the infusion solution, so I think instead of using 1-order transfer from depot to central, we should use zero-order with rate = Depot/duration. And depot here has 2 zero-order rates.
Why this zero-order model has an error when simulation, I just copy this in tutorial. I’m using Pumas 2.0.
pk_03 = @model begin
@param begin
tvcl ∈ RealDomain(lower=0)
tvvc ∈ RealDomain(lower=0)
tvTabs ∈ RealDomain(lower=0)
Ω ∈ PDiagDomain(3)
σ²_prop ∈ RealDomain(lower=0)
end
@random begin
η ~ MvNormal(Ω)
end
@pre begin
Cl = tvcl * exp(η[1])
Vc = tvvc * exp(η[2])
duration = (Central = tvTabs * exp(η[3]),)
end
@dynamics begin
Central' = - (Cl/Vc)*Central
end
@derived begin
cp = @. 1000*(Central/Vc)
dv ~ @. Normal(cp, sqrt(cp^2*σ²_prop))
end
end
param = ( tvcl = 45.12,
tvvc = 96,
tvTabs = 4.54,
Ω = Diagonal([0.0,0.0,0.0]),
σ²_prop = 0.015
)
ev1 = DosageRegimen(20,rate=-2)
sub1 = Subject(id=1,events=ev1)
Random.seed!(123)
sim_sub1 = simobs(pk_03, sub1, param, obstimes=0:0.1:10)
ERROR: ArgumentError: either rate or duration should be set in the @pre block when the Event rate is -2
The tutorials in that page are being updated to the new syntax, but essentially what you are hitting is an error due to a syntax change in 2.0. All parameters that control the dose are now in a new block called the dosecontrol block. You can see the documentation here.
here is the complete code that will help you run the example in Pumas 2.0
using Random, Pumas, PumasUtilities
pk_03 = @model begin
@param begin
tvcl ∈ RealDomain(lower=0)
tvvc ∈ RealDomain(lower=0)
tvTabs ∈ RealDomain(lower=0)
Ω ∈ PDiagDomain(3)
σ²_prop ∈ RealDomain(lower=0)
end
@random begin
η ~ MvNormal(Ω)
end
@pre begin
Cl = tvcl * exp(η[1])
Vc = tvvc * exp(η[2])
end
@dosecontrol begin
duration = (Central = tvTabs * exp(η[3]),)
end
@dynamics begin
Central' = - (Cl/Vc)*Central
end
@derived begin
cp = @. 1000*(Central/Vc)
dv ~ @. Normal(cp, sqrt(cp^2*σ²_prop))
end
end
param = ( tvcl = 45.12,
tvvc = 96,
tvTabs = 4.54,
Ω = Diagonal([0.0,0.0,0.0]),
σ²_prop = 0.001
)
ev1 = DosageRegimen(20,rate=-2)
sub1 = Subject(id=1,events=ev1, observations = (cp = nothing, dv=nothing))
Random.seed!(123)
sim_sub1 = simobs(pk_03, sub1, param, obstimes=0.1:0.1:10)
sim_plot(pk_03, [sim_sub1])
Yes that is allowed but you can only assign to a variable once, so you’d have to write it like
μ = if t <= 3
(θX/100)*t
else
zero((θX/100)*t)
end
Using zero instead of 0 isn’t strictly require but it ensures that both branches in the control flow statement produce floating point values. This will give better performance.
An alternative formulation without control flow is