@param begin
∈ RealDomain(lower = 0, init = 5) # Typical value of Clearance
TVCL ∈ RealDomain(lower = 0, init = 50) # Typical value of Volume
TVV ∈ PDiagDomain(2) # Variance for IIV
Ω ∈ RealDomain(lower = 0, init = 0.1) # Variance for IOV
Ω_IOV ∈ RealDomain(lower = 0, init = 0.1) # Proportional error
σ_prop end
Understanding Interoccasion Variability (IOV) Modeling in Pumas
1 Modeling Interoccasion Variability (IOV) in PKPD Models using Pumas
Pharmacokinetic and pharmacodynamic (PKPD) modeling often involves analyzing data collected over multiple dosing occasions. Interoccasion variability (IOV) refers to the variability in pharmacokinetic parameters that occurs between different occasions (e.g., days, visits) within the same individual. Accounting for IOV can improve model fit and predictive performance.
In this tutorial, we’ll provide an intuitive, step-by-step guide on how to model IOV in Pumas. We’ll explain why shared variance is essential across occasions, how indexing works in Pumas, and demonstrate how straightforward it is to implement an IOV model.
1.1 Understanding Interoccasion Variability
Interoccasion Variability (IOV) represents the differences in pharmacokinetic parameters for the same individual across different occasions. For example, a patient’s drug clearance might vary between visits due to factors like diet, concurrent medications, or measurement errors.
Ignoring IOV can lead to biased parameter estimates and poor predictive performance. By modeling IOV, we can capture these fluctuations and improve our model’s accuracy.
1.3 Implementing IOV in Pumas
Let’s walk through the steps to implement an IOV model in Pumas using a simplified example.
1.3.1 Step 1: Define the Model Parameters
First, we define the typical values (fixed effects) for our PK parameters, such as clearance (CL
) and volume of distribution (V
).
1.3.2 Step 2: Specify Random Effects with IOV
We introduce random effects for interindividual variability (η
) and interoccasion variability (κ
). Here, κ
is indexed by the occasion (OCC
).
@random begin
~ MvNormal(Ω)
η ~ MvNormal(Diagonal(fill(Ω_IOV, 7)))
κ end
1.3.3 Step 3: Define Covariates and Indexing
We need to specify the occasion covariate (OCC
) and explain how indexing works.
@covariates OCC
In Pumas, OCC
should be an integer covariate starting at 1
representing the occasion number for each observation. The κ[OCC]
notation indexes the κ
random effects by the occasion, allowing each occasion to have its unique deviation while sharing the same variance Ω_IOV
.
1.3.4 Step 4: Write the Model Equations
We incorporate both IIV (η
) and IOV (κ
) into our PK parameters.
@pre begin
= TVCL * exp(η[1] + κ[OCC])
CL = TVV * exp(η[2])
V end
Here, CL
includes both interindividual variability (η[1]
) and interoccasion variability (κ[OCC]
), while V
includes only interindividual variability.
1.3.5 Step 5: Simulate and Fit the Model
After defining the rest of the model (dynamics and derived variables), we can simulate data or fit the model to existing data.
1.4 Complete Example
1.4.1 The model
Putting it all together, here’s the full model code:
using Pumas
= @model begin
IOV_PK_model @param begin
∈ RealDomain(lower = 0, init = 5)
TVCL ∈ RealDomain(lower = 0, init = 50)
TVV ∈ PDiagDomain(2)
Ω ∈ RealDomain(lower = 0, init = 0.1)
Ω_IOV ∈ RealDomain(lower = 0, init = 0.1)
σ_prop end
@random begin
~ MvNormal(Ω)
η ~ MvNormal(Diagonal(fill(Ω_IOV, 7)))
κ end
@covariates OCC
@pre begin
= TVCL * exp(η[1] + κ[OCC])
CL = TVV * exp(η[2])
Vc end
@dynamics Central1
@derived begin
= @. Central / Vc
cp ~ @. Normal(cp, abs(cp) * σ_prop)
dv end
end
PumasModel
Parameters: TVCL, TVV, Ω, Ω_IOV, σ_prop
Random effects: η, κ
Covariates: OCC
Dynamical system variables: Central
Dynamical system type: Closed form
Derived: cp, dv
Observed: cp, dv
1.4.2 The Design
= map(
pop1 -> Subject(
subj = subj,
id = DosageRegimen(100, addl = 6, ii = 24),
events = (; OCC = [1, 2, 3, 4, 5, 6, 7]),
covariates = [0, 24, 48, 72, 96, 120, 144],
covariates_time = (; dv = nothing),
observations
),1:10,
)
Population
Subjects: 10
Covariates: OCC
Observations: dv
1.4.3 The Parameters
= (TVCL = 4, TVV = 10, Ω = [0.04, 0.04], Ω_IOV = 0.04, σ_prop = 0.2) params
(TVCL = 4,
TVV = 10,
Ω = [0.04, 0.04],
Ω_IOV = 0.04,
σ_prop = 0.2,)
1.4.4 Simulate
using Random
Random.seed!(1234)
= simobs(IOV_PK_model, pop1, params, obstimes = 0:1:192) sims
Simulated population (Vector{<:Subject})
Simulated subjects: 10
Simulated variables: cp, dv
1.4.5 Plot
using PumasUtilities
sim_plot(sims, observations = [:cp])
1.5 Understanding the Pumas Way of IOV
@random begin
~ MvNormal(Diagonal(fill(Ω_IOV, 7)))
κ end
Let’s break this down step by step.
1.5.1 Defining κ as a Vector of Random Effects
In the random effects block defined above:
- κ is a Vector: By specifying
κ ~ MvNormal(...)
, we’re indicating thatκ
is a multivariate random variable (a vector) with 7 elements, each corresponding to an occasion. - Dimension of κ: The dimension of
κ
is determined by the length of the vector in the covariance matrix. In this case,fill(Ω_IOV, 7)
creates a vector of length 7.
1.5.3 Independence Across Occasions
- Uncorrelated Random Effects: The off-diagonal zeros in the covariance matrix indicate that the random effects for different occasions are uncorrelated.
- Biological Justification: This assumes that the variability from one occasion to another within the same individual is independent, which is a common assumption when modeling IOV.
1.5.4 Multivariate Normal Distribution
- MvNormal Distribution: The notation
MvNormal(Diagonal(...))
specifies thatκ
follows a multivariate normal distribution with the given covariance matrix. - Zero Mean Vector: Since no mean vector is specified, it defaults to a zero mean vector of appropriate length (7 in this case).
1.5.5 Incorporating κ into the Model
In the pre-block, you would use κ
indexed by the occasion (OCC
) to model the parameter that varies across occasions:
@pre begin
= TVCL * exp(η_CL + κ[OCC])
CL end
- η_CL: Represents the interindividual variability (IIV) for clearance.
- κ[OCC]: Selects the random effect corresponding to the current occasion, adding interoccasion variability (IOV).
1.5.6 Example Scenario
Suppose you have data collected from patients over 7 different occasions (e.g., 7 visits or dosing periods). You want to model how clearance (CL
) varies not only between individuals but also between occasions for the same individual.
- Interindividual Variability (IIV): Captured by
η_CL
. - Interoccasion Variability (IOV): Captured by
κ[OCC]
, whereOCC
ranges from 1 to 7.
1.5.7 Complete Random Effects Block
Putting it all together, the random effects block might look like:
@random begin
~ MvNormal(Ω) # IIV for parameters like CL and V
η ~ MvNormal(Diagonal(fill(Ω_IOV, 7))) # IOV for 7 occasions
κ end
- η: A vector of interindividual random effects (e.g., for CL and V).
- κ: A vector of interoccasion random effects, one for each occasion.
1.5.8 Why Use This Approach?
- Consistency in Variance Estimation: By sharing the variance
Ω_IOV
across all occasions, we ensure that the estimated variability between occasions is based on all the data, improving statistical reliability. - Model Parsimony: Estimating a single variance parameter (
Ω_IOV
) for all occasions reduces the number of parameters, avoiding overfitting. - Flexibility in Modeling: This approach allows each occasion to have its unique deviation from the typical parameter value while acknowledging that the variability magnitude is the same across occasions.
1.5.9 Interpreting the Model Output
When you fit this model to data:
- Ω_IOV: Estimates the magnitude of variability between occasions.
- η: Individual specific deviations for each parameter.
- κ: Provides occasion-specific deviations for each individual.
1.6 Conclusion
Modeling interoccasion variability in Pumas is straightforward once you understand the concepts:
- Shared Variance: By sharing the variance
Ω_IOV
across occasions, we ensure that the variability between occasions is consistently estimated. - Indexing: Using the occasion covariate (
OCC
) to index the IOV random effects allows each occasion to have a unique effect while maintaining shared variance. - Implementation: Pumas provides a flexible framework to incorporate IOV into your models with minimal additional code.
Note: Always ensure that your data includes an appropriate occasion covariate and that it’s correctly specified in your Pumas model.