Can somebody can help me to interpret this error?
┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ DiffEqBase C:\Users\julia\.julia\packages\DiffEqBase\3iigH\src\integrator_interface.jl:343
Thankyou.
It means that the numerical ODE integrator is having problems but it’s hard to know why without seeing the model and maybe also the data. However, it has often helped to add upper or more narrow bounds on the parameters during the optimization so you might want to try that.
Thank you,
I gave huge upper bounds
phenbm = @model begin
@param begin
tvka ∈ RealDomain(lower=0,init =0.225, upper = 10)
tvk23 ∈ RealDomain(lower=0,init = 5.02, upper = 300 )
tvQ ∈ RealDomain(lower=0,init = 60 , upper = 6000 )
tvvc ∈ RealDomain(lower=0,init = 223, upper = 7000)
tvvp ∈ RealDomain(lower=0,init = 2.8, upper = 1000)
tvCL ∈ RealDomain(lower=0,init = 7 ,upper =4000)
tvbio1 ∈ RealDomain(lower=0,init =0.63 , upper =1)
tvbio2 ∈ RealDomain(lower=0,init = 0.66, upper =1)
Ω ∈ PDiagDomain(init=[3.37,0.09,0.04,0.72,0.04,0.23,0.74,0.04]) # CL = 0.23,Vc = 0.72,KA = 3.37,vp = 0.04,k23 = 0.09
σ ∈ RealDomain(lower=0,init = 0.04,upper = 0.1)
end
@random begin
η ~ MvNormal(Ω)
end
@pre begin
ka = tvka * exp(η[1])
k23 = tvk23 * exp(η[2])
Q = tvQ * exp(η[3])
vc = tvvc * exp(η[4])
vp = tvvp * exp(η[5])
CL = tvCL * exp(η[6])
bioav = (Depot1 = tvbio1* exp(η[7]), Depot2 = tvbio2* exp(η[8]))
end
@dynamics begin
Depot1' = -ka * Depot1
Depot2' = -k23 * Depot2
Central' = ka * Depot1 + k23 * Depot2 - (Q/vc)*(Central) + (Q/vp)*Peripheral - (CL/vc)*Central
Peripheral' = (Q/vc) * Central - (Q/vp) * Peripheral
end
@derived begin
cp = @. Central/vc
DV ~ @. Normal(cp,abs(cp)*σ)
end
end
Does it help if you lower the upper bounds?
I did not try that yet. I just allowed model to run and give the parameter estimates. It took very long time to complete fitting. So ill try that out in night and post the update here.
I have adjusted limits. it shows the below Warning.
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\julia\.julia\packages\OrdinaryDiffEq\HO8vN\src\initdt.jl:137
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\julia\.julia\packages\OrdinaryDiffEq\HO8vN\src\solve.jl:481
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\julia\.julia\packages\DiffEqBase\3iigH\src\integrator_interface.jl:323
Adjusted Upper bounds
phenbm = @model begin
@param begin
tvka ∈ RealDomain(lower=0,init =0.225, upper = 2)
tvk23 ∈ RealDomain(lower=0,init = 5.02, upper = 10)
tvQ ∈ RealDomain(lower=0,init = 60 , upper = 150 )
tvvc ∈ RealDomain(lower=0,init = 223, upper = 500)
tvvp ∈ RealDomain(lower=0,init = 2.8, upper = 10)
tvCL ∈ RealDomain(lower=0,init = 7 ,upper =40)
tvbio1 ∈ RealDomain(lower=0,init =0.63 , upper =1)
tvbio2 ∈ RealDomain(lower=0,init = 0.66, upper =1)
Ω ∈ PDiagDomain(init=[3.37,0.09,0.04,0.72,0.04,0.23,0.74,0.04]) # CL = 0.23,Vc = 0.72,KA = 3.37,vp = 0.04,k23 = 0.09
σ ∈ RealDomain(lower=0,init = 0.04,upper = 0.1)
end
@random begin
η ~ MvNormal(Ω)
end
@pre begin
ka = tvka * exp(η[1])
k23 = tvk23 * exp(η[2])
Q = tvQ * exp(η[3])
vc = tvvc * exp(η[4])
vp = tvvp * exp(η[5])
CL = tvCL * exp(η[6])
bioav = (Depot1 = tvbio1* exp(η[7]), Depot2 = tvbio2* exp(η[8]))
end
@dynamics begin
Depot1' = -ka * Depot1
Depot2' = -k23 * Depot2
Central' = ka * Depot1 + k23 * Depot2 - (Q/vc)*(Central) + (Q/vp)*Peripheral - (CL/vc)*Central
Peripheral' = (Q/vc) * Central - (Q/vp) * Peripheral
end
@derived begin
cp = @. Central/vc
DV ~ @. Normal(cp,abs(cp)*σ)
end
end
Do you get the warnings even if you just evaluate loglikelihood
in the starting values?
it Came after 20th iteration
┌ Warning: First function call produced NaNs. Exiting.
└ @ OrdinaryDiffEq C:\Users\julia\.julia\packages\OrdinaryDiffEq\HO8vN\src\initdt.jl:137
┌ Warning: Automatic dt set the starting dt as NaN, causing instability.
└ @ OrdinaryDiffEq C:\Users\julia\.julia\packages\OrdinaryDiffEq\HO8vN\src\solve.jl:481
┌ Warning: NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.
└ @ DiffEqBase C:\Users\julia\.julia\packages\DiffEqBase\3iigH\src\integrator_interface.jl:323
21 2.221417e+03 4.272145e+01
* time: 3872.898999929428
22 2.191276e+03 3.996152e+01
* time: 4018.6080000400543
23 2.190728e+03 4.096070e+01
* time: 4128.06299996376
24 2.190317e+03 3.837986e+01
It looks like the optimization continues after the warnings. In that case you don’t have to worry about them. During the optimization, the optimizer might try to take a step that causes the warnings but the step will typically then be rejected and a shorter step will be tried instead. Occasionally, these steps can slow the optimization down so much that it becomes a problem. How long does fit
spend on the 20th iteration?
I did not check how long it took. I am not able to access later. May be REPL capacity id limited(?).
is there way to save total output and used model after each run?