Hello,

Everyone on this is very quick to respond. Thank you for your help!

I am working on fitting an infusion model to a population.

The code works until I try to fit the simulated population where it gives me the error: gradient is exactly zero in θtd50. I am not sure why I would see this sort of errror.

Here is my model:

```
# Practice developing infusion model using Pumas
using Random, Pumas, PumasUtilities, CairoMakie, AlgebraOfGraphics, DataFramesMeta, DataFrames, CSV
## Model definition infusion
model_infusion = @model begin
@metadata begin
desc = "Dissolution model Infusion"
timeu = u"minute"
end
@param begin
"Maximum percent drug dissolved (percent)"
θfdissmax ∈ RealDomain(lower=0)
"Time required for 50 percent of the drug to dissolve (minutes)"
θtd50 ∈ RealDomain(lower=0)
"Additive RUV"
σadd ∈ RealDomain(lower=0)
"sigmoidicity factor"
θkdiss ∈ RealDomain(lower=0)
end
@covariates dtd50
@pre begin
fdissmax = θfdissmax
td50 = θtd50 * (1 + dtd50)
kdiss = θkdiss
end
@derived begin
fdiss = @. fdissmax * (1 - exp(-kdiss*t))
"""
Percent dissolved in vitro
"""
dv_fdiss ~ @. Normal(fdiss, σadd)
end
end
## Initial parameters
param_infusion = (θfdissmax = 90.0, θtd50 = 30, σadd = 0.01, θkdiss = 0.1)
## Creating a Dataset
df_pop_infusion = map(i -> DataFrame(id = i, time = 1:1:120, dv_fdiss = missing, dtd50=0), 1:6)
df = vcat(DataFrame.(df_pop_infusion)...)
df[!, :dtd50] = ifelse.(df.id .== 2, -0.5, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 3, 0.5, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 4, 1, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 5, 2, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 6, 3, df.dtd50)
df_pop_infusion = df
pop_infusion = read_pumas(df_pop_infusion, observations=[:dv_fdiss], covariates=[:dtd50], event_data=false)
##Simulation
Random.seed!(1234)
sim_infusion = simobs(model_infusion, pop_infusion, param_infusion)
df_sim_infusion = DataFrame(sim_infusion) ### Change to dataframe from saving
##Estimation
@time est_infusion = fit(model_infusion, Subject.(sim_infusion), param_infusion, Pumas.NaivePooled())
```