1 st run
mymodel = @model begin
@param begin
tvcl ∈ RealDomain(lower=0, init = 1)
tvv1 ∈ RealDomain(lower=0, init = 40)
tvv2 ∈ RealDomain(lower=0, init= 100)
tvq ∈ RealDomain(lower=0, init=3)
σ_prop ∈ RealDomain(lower = 0, init= 0.04)
#Ω ∈ PDiagDomain( init = [0.09])
end
@random begin
η ~ MvNormal(Matrix{Float64}(0.09I, 1, 1))
end
@pre begin
CL = tvcl * exp(η[1])
V1 = tvv1
V2 = tvv2
Q = tvq
end
#@covariates Wt
@dynamics begin
Central' = - (CL/V1)*Central + Q*(Peripheral/V2) - Q*(Central/V1)
Peripheral' = Q*(Central/V1) - Q*(Peripheral/V2)
end
@vars begin
cent= Central/V1
Perip=Peripheral/V2
end
@derived begin
conc = cent
dv ~ @. Normal(conc, sqrt(conc^2*σ_prop)+eps())
end
end
param= init_param(mymodel)
data = CSV.read("D:\\NONMEMnights\\mould\\julia\\12.3.2\\2comp_iv_data.csv", missingstring=".")
Newdata = read_pumas(data,id=:id, time=:TIME, dvs=[:dv])
sim=simobs(mymodel, Newdata, param)
plot(sim)
![arun1|493x318](upload://y36mTTNyHbZihWwsbCExwXPC1QU.png)
2nd run
md = CSV.read("D:\\NONMEMnights\\mould\\julia\\12.3.2\\2comp_iv_data.csv", missingstring=".")
trans = read_pumas(md, id=:id, time=:TIME, dvs=[:dv],)
dian = @model begin
@param begin
tvcl ∈ RealDomain(lower=0, init = 1.0)
tvv ∈ RealDomain(lower=0, init = 20)
tvQ ∈ RealDomain(lower = 0, init= 1)
tvv2 ∈ RealDomain(lower = 0, init = 100)
Ω ∈ PDiagDomain(init=[0.09])
σ_prop ∈ RealDomain(lower=0,init=0.04)
end
#end
@random begin
# η ~ MvNormal(Matrix{Float64}(0.01I, 1, 1))
η ~ MvNormal(Ω)
#η ~ MvNormal(Ω)
end
#end
@pre begin
CL = tvcl * exp(η[1])
V = tvv
V2 = tvv2
Q = tvQ
end
#end
#@covariates WT
#end
#@dynamics ImmediateAbsorptionModel
@dynamics begin
# Depot' = -Ka*Depot
Central' = Q*(Peripheral/V2) - (CL/V)*Central - Q*(Central/V)
Peripheral' = Q*(Central/V)-Q*(Peripheral/V2)
end
#end
@vars begin
Cent := Central/V
Peri := Peripheral/V2
end
@derived begin
cp = Cent
# dv ~ @. Normal(cp,sqrt(cp^2*σ_prop))
dv ~ @. Normal(cp, sqrt(cp^2*σ_prop)+eps())
end
end
param =init_param(dian)
sims = simobs(dian,trans,param)
plot(sims)
![run2|576x361](upload://2PWmTP5WIBeDN8r0gG8p9l9ibqU.png)