Error: Gradient is exactly zero in theta

Hello, I am very new to Pumas and to PMx world, and I am struggling to run an estimation with a simple model. I am reproducing from NONMEM run

The error message I had:
ERROR: gradient is exactly zero in TVK12. This indicates that TVK12 isn’t identified.

I checked posts regards to gradient is zero error, and it seems like TVK12 couldn’t be estimated since it is not read in the @dynamics, which I have made conversion to Ka at @pre and implemented in @dynamics.
Any hints or pointing directions will be appreciated.

aspirin_model = @model begin
    @param begin
        # pk parameters
        TVK12   ∈ RealDomain(; lower = 0) 
        TVV     ∈ RealDomain(; lower = 0)
        TVCL    ∈ RealDomain(; lower = 0)
        Ω       ∈ PDiagDomain(3)
        σ_prop  ∈ RealDomain(; lower = 0)
        σ_add   ∈ RealDomain(; lower = 0)

    @random begin
        η       ~ MvNormal(Ω)

    @pre begin
        Ka = TVK12 * exp(η[1])
        Vc = TVV * exp(η[2])
        CL = TVCL * exp(η[3])

    @dynamics begin
        Depot'   = - Ka * Depot
        Central' = Ka * Depot - CL/Vc * Central

    @derived begin
        μ := @. Central / Vc
        DV ~ @. Normal(μ, sqrt((μ * σ_prop^2) + σ_add^2))

aspirin_model_param = (; 
            TVK12  = 5,
            TVV    = 16.5,
            TVCL   = 5.75,
            Ω      = Diagonal([0.191, 0.133, 0.123]),
            σ_prop = 0.335,
            σ_add  = 0.00001

I don’t see anything wrong with your model. So maybe your data has issues.
Can you post what a subject looks like in your data and how you’re calling read_pumas?

1 Like

Hello, thank you for confirming the model was not wrong.
I looked back to the dataset and checked I haven’t set the missingstring argument from that led to DV as string format.

Now the fit runs well and the output is not what I expected, but I think I can learn more by fixing this on my own. Thank you so much!

1 Like