Error with M3 (Censored method)

Hi Everyone I am trying to apply M3 method for my data but I receive a Method error message (attached is the code and the error message)

training_estimation = read_pumas(df_BQL,
    observations=[:CONC], #list the name of the conc variable
    id=:ID,
    time=:TIME,
    evid=:EVID,
    mdv = :MDV,
    amt=:AMT,
    rate = :RATE,
    cmt = :CMT,
    covariates = [:WT, :Occassions,:FFM,:PMA,:GA,:HT,:BMI,:AGEYRS,:AGE_GROUP,:PNA]
    )

#one Compartment proportional error model BOV Wt Allometric
proportional_error = @model begin
  @param   begin
      TVCL     ∈ RealDomain(lower = 0.0)
      TVVc     ∈ RealDomain(lower = 0.0)
      Ω        ∈ PDiagDomain(2)
      σ_prop   ∈ RealDomain(lower = 0.0)
  end
  @random begin
      η ~ MvNormal(Ω)
  end
  @covariates Occassions WT PNA
  @pre begin
    CL     = TVCL  * exp(η[1])
    Vc     = TVVc *  exp(η[2]) 

  end
  @dynamics  Central1

  @derived begin
      CP = @. Central / Vc
      CONC ~ @. Censored(Normal(CP, CP*σ_prop),100,Inf)

  end
end

param = (
    TVCL     =   3.2811,
    TVVc      =     8.8381 ,
    σ_prop  =   0.40522 ,
    Ω  = Diagonal([0.19895,  0.67981]),
)
################### execute model ########################
one_cmt =     fit(proportional_error,training_estimation,param,Pumas.LaplaceI())
ERROR: MethodError: no method matching Censored(::Normal{ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#423#424"{PumasModel{ParamSet{NamedTuple{(:TVCL, :TVVc, :Ω, :σ_prop), Tuple{RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#5#17", var"#6#18", var"#8#20", var"#10#22", Central1, var"#11#23", var"#14#26", Nothing}, Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:WT, :Occassions, :FFM, :PMA, :GA, :HT, :BMI, :AGEYRS, :AGE_GROUP, :PNA), Tuple{Float64, Int64, Float64, Float64, Float64, Float64, Float64, Float64, String, Float64}}, NamedTuple{(:WT, :Occassions, :FFM, :PMA, :GA, :HT, :BMI, :AGEYRS, :AGE_GROUP, :PNA), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, FillArrays.Fill{String, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, NamedTuple{(:TVCL, :TVVc, :Ω, :σ_prop), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(), Tuple{}}}, Float64}, ForwardDiff.Dual{ForwardDiff.Tag{Pumas.var"#423#424"{PumasModel{ParamSet{NamedTuple{(:TVCL, :TVVc, :Ω, :σ_prop), Tuple{RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}, PDiagDomain{PDMats.PDiagMat{Float64, Vector{Float64}}}, RealDomain{Float64, TransformVariables.Infinity{true}, Float64}}}}, var"#5#17", var"#6#18", var"#8#20", var"#10#22", Central1, var"#11#23", var"#14#26", Nothing}, Subject{NamedTuple{(:CONC,), Tuple{Vector{Union{Missing, Float64}}}}, Pumas.ConstantInterpolationStructArray{Vector{Float64}, StructArrays.StructVector{NamedTuple{(:WT, :Occassions, :FFM, :PMA, :GA, :HT, :BMI, :AGEYRS, :AGE_GROUP, :PNA), Tuple{Float64, Int64, Float64, Float64, Float64, Float64, Float64, Float64, String, Float64}}, NamedTuple{(:WT, :Occassions, :FFM, :PMA, :GA, :HT, :BMI, :AGEYRS, :AGE_GROUP, :PNA), Tuple{FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}, FillArrays.Fill{String, 1, Tuple{Base.OneTo{Int64}}}, Vector{Float64}}}, Int64}, Symbol}, Vector{Pumas.Event{Float64, Float64, Float64, Float64, Float64, Float64, Int64}}, Vector{Float64}}, NamedTuple{(:TVCL, :TVVc, :Ω, :σ_prop), Tuple{Float64, Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Float64}}, NamedTuple{(), Tuple{}}}, Float64}, Float64, 1}, 1}}, ::Int64, ::Float64)
Closest candidates are:
  Censored(::D, ::T, ::T) where {T<:Real, D<:Distribution} at /builds/PumasAI/PumasSystemImages-jl/.julia/packages/Pumas/sxdq5/src/estimation/likelihoods.jl:302
Stacktrace:
  [1] _broadcast_getindex_evalf
    @ ./broadcast.jl:648 [inlined]
  [2] _broadcast_getindex
    @ ./broadcast.jl:621 [inlined]
  [3] getindex
    @ ./broadcast.jl:575 [inlined]
  [4] copy
    @ ./broadcast.jl:922 [inlined]
  [5] materialize
    @ ./broadcast.jl:883 [inlined]
 

Hello Ahmed

Could you please try to change 100 to 100.0 in the call to Censored?

Best
Andreas Noack

tir. 29. jun. 2021 kl. 17.41 skrev Ahmed via Pumas <pumas@discoursemail.com>:

1 Like

Hi Andreas,

I tried your suggestion and the code works. Thanks so much