I am fitting a model to a population and generating a report of the estimates.
Everything runs correctly except after I try to write it all to a report.
This is the error it gives:
Here is my code:
# Practice developing dissolution model using Pumas
using Random, Pumas, PumasUtilities, CairoMakie, AlgebraOfGraphics, DataFramesMeta, DataFrames, CSV, Tectonic
## Model definition Emaxγ
model_Emaxγ = @model begin
@metadata begin
desc = "Dissolution model Emax"
timeu = u"minute"
end
@param begin
"Maximum % drug dissolved (%)"
θfdissmax ∈ RealDomain(lower=0)
"Time required for 50% of the drug to dissolve (minutes)"
θtd50 ∈ RealDomain(lower=0)
"Additive RUV"
σ_add ∈ RealDomain(lower=0)
"sigmoidicity factor"
θγ ∈ RealDomain(lower=0)
end
@covariates dtd50
@pre begin
fdissmax = θfdissmax
td50 = θtd50 * (1 + dtd50)
γ = θγ
end
@derived begin
fdiss = @. fdissmax * (t ^ γ) / ((td50 ^ γ) + (t ^ γ))
td50_ = td50
"""
Percent dissolved in vitro
"""
dv_fdiss ~ @. Normal(fdiss, σ_add)
end
end
param_Emaxγ = (θfdissmax = 100.0, θtd50 = 10, σ_add = 0.01, θγ = 0.5)
##Read in simulated populationa and make it a new population
sim_Emax = CSV.read("/home/jrun/data/code/Practice/ExercisePK44_1/Data/Emaxpop.csv", DataFrame)
pop_Emaxγ = read_pumas(sim_Emax, observations=[:dv_fdiss], covariates=[:dtd50], event_data=false)
#Fit Emaxγ model to simulated population from Emax model
@time result_Emaxγ = fit(model_Emaxγ, Subject.(pop_Emaxγ), param_Emaxγ, Pumas.NaivePooled())
infer_Emaxγ = infer(result_Emaxγ)
inspected_Emaxγ = inspect(result_Emaxγ)
goodness_of_fit(inspected_Emaxγ, figure = (resolution = (1200, 800),), axis = (title = "Emax with sigmoidicity factor",))
report((result_Emaxγ, infer_Emaxγ, inspected_Emaxγ), output="/home/jrun/data/code/Practice/ExercisePK44_1/Reports/Emaxgamma_report")