# ERROR: TaskFailedException: AssertionError: cur_ev.time == t

Can someone help me to solve this

``````VCWTresult1  = fit(VCWTmodel1,VCWTDF1, VCWTparam1, Pumas.FOCEI(),ensemblealg = EnsembleThreads())
0              Inf              NaN
* time: 0.0
AssertionError: cur_ev.time == t
Stacktrace:
[1] solve(::AnalyticalPKPDProblem{LabelledArrays.SLArray{Tuple{4},ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#318#319"{Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ, :tvpintwt, :tvpdfwt),Tuple{RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64}}}},var"#1269#1295",var"#1270#1296",var"#1272#1298",Pumas.LinearODE,var"#1273#1299",var"#1284#1310"},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},Pumas.ConstantCovar{NamedTuple{(:WT, :INITWT, :DFWT),Tuple{Float64,Float64,Float64}}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Nothing,Int64},1},Array{Float64,1}},NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ, :tvpintwt, :tvpdfwt),Tuple{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#295#296"{Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ, :tvpintwt, :tvpdfwt),Tuple{RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64}}}},var"#1269#1295",var"#1270#1296",var"#1272#1298",Pumas.LinearODE,var"#1273#1299",var"#1284#1310"},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},Pumas.ConstantCovar{NamedTuple{(:WT, :INITWT, :DFWT),Tuple{Float64,Float64,Float64}}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Nothing,Int64},1},Array{Float64,1}},Array{Float64,1},Pumas.FOCEI,TransformVariables.TransformTuple{NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ, :tvpintwt, :tvpdfwt),Tuple{TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},Pumas.PDiagTransform,TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64}}}}},Float64},Float64,1},ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#295#296"{Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ, :tvpintwt, :tvpdfwt),Tuple{RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64}}}},var"#1269#1295",var"#1270#1296",var"#1272#1298",Pumas.LinearODE,var"#1273#1299",var"#1284#1310"},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},Pumas.ConstantCovar{NamedTuple{(:WT, :INITWT, :DFWT),Tuple{Float64,Float64,Float64}}},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Nothing,Int64},1},Array{Float64,1}},Array{Float64,1},Pumas.FOCEI,TransformVariables.TransformTuple{NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ, :tvpintwt, :tvpdfwt),Tuple{TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},Pumas.PDiagTransform,TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64},TransformVariables.ScaledShiftedLogistic{Float64}}}}},Float64},Float64,1},ForwardDiff.Dual{ForwardDiff.Tag{Pumas
``````

my model is

``````VCWTmodel1 = @model begin
@param begin
tvka  ∈ RealDomain(lower=0.1, upper = 5)
tvk23 ∈ RealDomain(lower=0.1, upper = 20 )
tvQ   ∈ RealDomain(lower=0.1, upper = 150 )
tvvc  ∈ RealDomain(lower=0.1, upper = 150)
tvvp  ∈ RealDomain(lower=0.1, upper = 150)
tvCL  ∈ RealDomain(lower=0.1 ,upper =15)
tvbio1 ∈ RealDomain(lower=0.1, upper =1)
Ω     ∈ PDiagDomain(7) # CL = 0.23,Vc = 0.72,KA = 3.37,vp = 0.04,k23 = 0.09
σ     ∈ RealDomain(lower=0.01,upper = 1)
tvpintwt ∈ RealDomain(lower=0.1, upper = 10)
tvpdfwt  ∈ RealDomain(lower = 0.1,upper =10)
end
@random begin
η ~ MvNormal(Ω)
end
@covariates WT INITWT DFWT
@pre begin
ka    = tvka  * exp(η[1])
k23   = tvk23 * exp(η[2])
Q     = tvQ  * exp(η[3])
pintwt = tvpintwt
pdfwt  = tvpdfwt
vc    = tvvc* (1 + pintwt*(INITWT-14.3) + pdfwt*DFWT) * exp(η[4])
vp    = tvvp * exp(η[5])
CL    = tvCL  * exp(η[6])
bioav = (Depot1 = tvbio1* exp(η[7]))

A = @SMatrix([-ka    0      0           0
0    -k23    0           0
ka    k23 -(CL+Q)/vc  Q/vp
0       0    Q/vc       -Q/vp  ])
end
@init begin
Depot1 = 0.0
Prodrug = 0.0
Central = 0.0
Peripheral = 0.0
end
@dynamics LinearODE
@derived begin
conc := @. Central/vc
DV ~ @. Normal(conc, σ*abs(conc))
end
end
``````

model has time varying covariate. INITWT is initial weight, WT = current weight, DFWT = difference from initial weight to current weight

It looks like the value of (minus) the log-likelihood is `Inf` in the starting values. Could you please confirm by just running `loglikelihood(model, population, initial_parameters, your_estimation_method)`? If that is the case then you’d have to find some other starting values that give a finite log-likelihood.

``````
julia> VCWTll =  loglikelihood(VCWTmodel1,VCWTDF1, VCWTparam1, Pumas.FOCEI(),ensemblealg = EnsembleThreads())
NaN
``````

is that infinity?

No that’s a `NaN` (no not a number). They show up in cases like

``````julia> 0/0
NaN

julia> Inf - Inf
NaN
``````

My best guess is that one of the volumes become zero. Maybe try to call `Pumas.findinfluential` instead of `loglikelihood`. That will show you a list of the subjects that contribute the most to the `loglikelihood`.

``````
julia> Pumas.findinfluential(VCWTmodel1,VCWTDF1, VCWTparam1dup, Pumas.FOCEI(),ensemblealg = EnsembleThreads())
5-element Array{Tuple{String,Float64},1}:
("41", 126.79140281385544)
("172", 46.0780610366132)
("44", 44.02736630754179)
("10", 41.0442973131424)
("171", 37.20470753972811)
``````

Do i need to remove them?

this result is after removing BSV on both volumes

I suppose that the value of `loglikelihood` is then no longer `NaN` or `Inf` after this change. Is that the case?

even after removing BSV on both volumes, loglikelihood is NaN .
I tried to find influential after that.
result is

``````julia> Pumas.findinfluential(VCWTmodel1,VCWTDF1, VCWTparam1dup, Pumas.FOCEI(),ensemblealg = EnsembleThreads())
5-element Array{Tuple{String,Float64},1}:
("41", 126.79140281385544)
("172", 46.0780610366132)
("44", 44.02736630754179)
("10", 41.0442973131424)
("171", 37.20470753972811)
``````

I checked observations of those ID’s Manually, They were very different in same ID.

ex: ID 10 has conc of 1.9mg/L after 5 hours of 200 mg of dose, same id has 1.9 mg/L after 10 hours of 200mg dose administration on other day. These 5 ID’s have that kind of data.

Could you try pasting exactly this into your session `loglikelihood(VCWTmodel1,VCWTDF1, VCWTparam1dup, Pumas.FOCEI(),ensemblealg = EnsembleThreads())` and let me know the result

Hi @andreasnoack, Here is result

``````VCWTmodel1 = @model begin
@param begin
tvka  ∈ RealDomain(lower=0.1, upper = 5)
tvk23 ∈ RealDomain(lower=0.1, upper = 20 )
tvQ   ∈ RealDomain(lower=0.1, upper = 250 )
tvvc  ∈ RealDomain(lower=0.1, upper = 250)
tvvp  ∈ RealDomain(lower=0.5, upper = 250)
tvCL  ∈ RealDomain(lower=0.1 ,upper =15)
tvbio1 ∈ RealDomain(lower=0.1, upper =1)
Ω     ∈ PDiagDomain(5) # CL = 0.23,Vc = 0.72,KA = 3.37,vp = 0.04,k23 = 0.09
σ     ∈ RealDomain(lower=0.1,upper = 1)
#tvpintwt ∈ RealDomain(lower=0.001, upper = 100)
#tvpdfwt  ∈ RealDomain(lower = 0.001,upper =100)
end
@random begin
η ~ MvNormal(Ω)
end
@covariates WT INITWT DFWT
@pre begin
ka    = tvka  * exp(η[1])
k23   = tvk23 * exp(η[2])
Q     = tvQ  * exp(η[3])
#  pintwt = tvpintwt
#  pdfwt  = tvpdfwt
#  vc    = tvvc * (1 + pintwt*(INITWT-14.3) + pdfwt*DFWT)
vc    = tvvc * (WT/14.3)
vp    = tvvp
CL    = tvCL  * exp(η[4])
bioav = (Depot1 = tvbio1* exp(η[5]))

A = @SMatrix([-ka    0      0           0
0    -k23    0           0
ka    k23 -(CL+Q)/vc  Q/vp
0       0    Q/vc       -Q/vp  ])
end
@init begin
Depot1 = 0.0
Prodrug = 0.0
Central = 0.0
Peripheral = 0.0
end
@dynamics LinearODE
@derived begin
conc := @. Central/vc
DV ~ @. Normal(conc, σ*abs(conc))
end
end

VCWTparam1dup = (tvka   = 1.9,
tvk23  = 0.18,
tvQ    = 5.23,
tvvc   = 2.27,
tvvp   = 44.86,
tvCL   = 0.8,
tvbio1 = 0.2,
Ω      = Diagonal([0.05,0.004,0.01,0.04,0.08]),
σ       = 0.45)

VCWTDF1 = read_pumas(phen1, observations = [:DV], id = :ID, time = :TIME, amt = :AMT, rate = :RATE, cmt = :CMT,
covariates = [:WT,:INITWT,:DFWT])

``````

fit resulted in below error

``````ERROR: InexactError: trunc(Int64, Inf)
Stacktrace:
[1] trunc at .\float.jl:703 [inlined]
[2] ceil at .\float.jl:365 [inlined]
[3] ceil at C:\Users\julia\.julia\packages\ForwardDiff\sdToQ\src\dual.jl:265 [inlined]
[4] _exp(::Size{(4, 4)}, ::SArray{Tuple{4,4},ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#318#319"{Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}},PumasModel{ParamSet{NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ),Tuple{RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},RealDomain{Float64,Int64,Float64},PDiagDomain{PDMats.PDiagMat{Float64,Array{Float64,1}}},RealDomain{Float64,Int64,Float64}}}},var"#53#75",var"#54#76",var"#56#78",Pumas.LinearODE,var"#57#79",var"#66#88"},Subject{NamedTuple{(:DV,),Tuple{Array{Union{Missing, Float64},1}}},Pumas.ConstantInterpolationStructArray{Array{Float64,1},StructArrays.StructArray{NamedTuple{(:WT, :INITWT, :DFWT),Tuple{Float64,Float64,Float64}},1,NamedTuple{(:WT, :INITWT, :DFWT),Tuple{Array{Float64,1},Array{Float64,1},Array{Float64,1}}},Int64},Symbol},Array{Pumas.Event{Float64,Float64,Float64,Float64,Float64,Float64,Nothing,Int64},1},Array{Float64,1}},NamedTuple{(:tvka, :tvk23, :tvQ, :tvvc, :tvvp, :tvCL, :tvbio1, :Ω, :σ),Tuple{Float64,Float64,Float64,Float64,Float64,Float64,Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Float64}}},Float64},Float64,5},2,16}) at C:\Users\julia\.julia\packages\StaticArrays\LJQEe\src\expm.jl:97
``````

then i tried loglikelihood and influential codes

``````julia> loglikelihood(VCWTmodel1,VCWTDF1, VCWTparam1dup, Pumas.FOCEI(),ensemblealg = EnsembleThreads())
-870.0609562653066

julia> Pumas.findinfluential(VCWTmodel1,VCWTDF1, VCWTparam1dup, Pumas.FOCEI(),ensemblealg = EnsembleThreads())
5-element Array{Tuple{String,Float64},1}:
("41", 126.79140281385544)
("172", 46.0780610366132)
("44", 44.02736630754179)
("10", 41.0442973131424)
("171", 37.20470753972811)
``````

It did not give NAN for loglikelihood after removing BSV on both volumes .
and fit is not yet successful.