# Exercise PK01 - One Compartment Intravenous Bolus Dosing

### Background

• Structural model - One compartment linear elimination

• Route of administration - IV bolus

• Dosage Regimen - 10 mg IV

• Number of Subjects - 4 ### Learning Outcome

In this model, you will learn -

• To build One compartment model for four subjects given Intravenous Bolus dosage.

• To estimate the fundamental parameters involved in building the model.

• To apply differential equation in the model as per the compartment model.

• To design the dosage regimen for the subjects and simulate the plot.

### Objectives

In this tutorial, you will learn how to build one compartment model and to simulate the model for four subjects with different values of Parameter estimates.

### Libraries

call the "necessary" libraries to get started.

using Pumas
using PumasUtilities
using Random
using CairoMakie


### Model

In this One compartment model, intravenous dose is administered into the central compartment. We account for rate of change of concentration of drug in plasma (Central Compartment) for the time duration upto 150 min.

pk_01        = @model begin
desc = "One Compartment Model"
timeu = u"minute"
end
@param begin
"Clearance (L/hr)"
tvcl     ∈ RealDomain(lower=0)
"Volume (L)"
tvvc     ∈ RealDomain(lower=0)
Ω        ∈ PDiagDomain(2)
σ        ∈ RealDomain(lower=0)
end

@random begin
η        ~ MvNormal(Ω)
end

@pre begin
Cl       = tvcl * exp(η)
Vc       = tvvc * exp(η)
end

@dynamics begin
Central' = -(Cl/Vc)*Central
end

@derived begin
"""
PK01 Concentrations (ug/L)
"""
cp       = @. 1000*(Central/Vc)
"""
PK01 Concentrations (ug/L)
"""
dv       ~ @. Normal(cp, σ)
end
end

PumasModel
Parameters: tvcl, tvvc, Ω, σ
Random effects: η
Covariates:
Dynamical variables: Central
Derived: cp, dv
Observed: cp, dv


### Parameters

In this exercise, parameter estimate values for each subject are different. For each subject, parameters are defined individually wherein tv represents the typical value for parameters. Parameters provided for simulation are:-

• $Cl$ - Clearance(L/hr),

• $Vc$ - Volume of Central Compartment(L),

• $Ω$ - Between Subject Variability,

• $σ$ - Residual error

param = [
(tvcl = 0.10,
tvvc = 9.98,
Ω    = Diagonal([0.00,0.00]),
σ    = 20.80),

(tvcl = 0.20,
tvvc = 9.82,
Ω    = Diagonal([0.00,0.00]),
σ    = 27.46),

(tvcl = 0.20,
tvvc = 10.22,
Ω    = Diagonal([0.00,0.00]),
σ    = 8.78),

(tvcl = 0.20,
tvvc = 19.95,
Ω    = Diagonal([0.00,0.00]),
σ    = 8.50)
]

4-element Vector{NamedTuple{(:tvcl, :tvvc, :Ω, :σ), Tuple{Float64, Float64,
Diagonal{Float64, Vector{Float64}}, Float64}}}:
(tvcl = 0.1, tvvc = 9.98, Ω = [0.0 0.0; 0.0 0.0], σ = 20.8)
(tvcl = 0.2, tvvc = 9.82, Ω = [0.0 0.0; 0.0 0.0], σ = 27.46)
(tvcl = 0.2, tvvc = 10.22, Ω = [0.0 0.0; 0.0 0.0], σ = 8.78)
(tvcl = 0.2, tvvc = 19.95, Ω = [0.0 0.0; 0.0 0.0], σ = 8.5)


### Dosage Regimen

10 mg IV bolus dosage administered to four subjects at time zero.

Note:- The concentrations are in μg/L and dose is in mg, thus the final conc is multiplied by 1000 in the model

ev1   = DosageRegimen(10,time=0,cmt=1)

ids   = ["1: CL = 0.10, V = 9.98", "2: CL = 0.20, V = 9.82",
"3: CL = 0.20, V = 10.22", "4: CL = 0.20, V = 19.95"]

pop = map(i -> Subject(id = ids[i], events = ev1, observations = (cp = nothing,)), 1:length(ids))


### Simulation

• Lets simulate for plasma concentration for four subjects for specific observation time points after IV bolus dose.

Random.seed!(123)

sim = map(zip(pop, param)) do (subj, p)
return simobs(pk_01, subj, p, obstimes = [10,20,30,40,50,60,70,90,110,150])
end

Simulated population (Vector{<:Subject})
Simulated subjects: 4
Simulated variables: cp, dv


### Visualize results

f, a, p = sim_plot(pk_01, sim,
observations = :cp,
color = :redsblues,
linewidth = 4,
axis = (xlabel = "Time (minute)",
ylabel = "PK01 Concentrations (ug/L)",
xticks = 0:20:160))
axislegend(a)
f 