Here is my code:
using Pumas
using PumasUtilities
using PharmaDatasets
using DataFramesMeta
# Read in Data
pkfile = dataset("iv_sd_3")
# Convert DataFrame into Collection of Subjects (Population)
population = read_pumas(pkfile)
# Model definition
model = @model begin
@param begin
# here we define the parameters of the model
tvcl ∈ RealDomain(; lower = 0.001) # typical clearance
tvvc ∈ RealDomain(; lower = 0.001) # typical central volume of distribution
Ω ∈ PDiagDomain(2) # between-subject variability
σ ∈ RealDomain(; lower = 0.001) # residual error
end
@random begin
# here we define random effects
η ~ MvNormal(Ω) # multi-variate Normal with mean 0 and covariance matrix Ω
end
@pre begin
# pre computations and other statistical transformations
CL = tvcl * exp(η[1])
Vc = tvvc * exp(η[2])
end
# here we define compartments and dynamics
@dynamics Central1 # same as Central' = -(CL/Vc)*Central (see Pumas documentation)
@derived begin
# here is where we calculate concentration and add residual variability
# tilde (~) means "distributed as"
cp = @. 1000 * Central / Vc # ipred = A1/V
dv ~ @. Normal(cp, σ)
# dv ~ @. Normal(cp, sqrt(cp^2 * σ_prop^2 + σ_add^2))
end
end
# Parameter values
params = (tvcl = 1.0, tvvc = 10.0, Ω = Diagonal([0.09, 0.09]), σ = 3.16)
# Fit a base model
fit_results = fit(model, population, params, Pumas.FOCE())
ins_results = DataFrame(inspect(fit_results))
all_names =names(ins_results)
all_sel = @select(ins_results, :id, :time, :dv, :cp_pred, :dv_pred,:cp_ipred, :dv_ipred)
dv is the the observed concentration, but what is the different between cp_pred and dv_pred?
They show the exact same values. Why would it predict two of the same value?