Understanding Interoccasion Variability (IOV) Modeling in Pumas

Author

Vijay Ivaturi

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.2 Why Share Variance Across Occasions?

When modeling IOV, it’s essential to share the variance across occasions because:

  • Biological Consistency: The variability between occasions is assumed to come from the same underlying distribution for all occasions.
  • Parameter Identifiability: Sharing variance ensures that the model can distinguish between within-subject variability (IOV) and between-subject variability (interindividual variability, IIV).
  • Statistical Efficiency: Estimating a single variance parameter for all occasions provides more reliable estimates, especially with limited data per occasion.

By sharing the variance, we acknowledge that while each occasion might have its unique effect, the degree of variability is consistent across all occasions.

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).

@param begin
    TVCL  RealDomain(lower = 0, init = 5)   # Typical value of Clearance
    TVV  RealDomain(lower = 0, init = 50)   # Typical value of Volume
    Ω  PDiagDomain(2)                   # Variance for IIV
    Ω_IOV  RealDomain(lower = 0, init = 0.1) # Variance for IOV
    σ_prop  RealDomain(lower = 0, init = 0.1) # Proportional error
end

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
    CL = TVCL * exp(η[1] + κ[OCC])
    V = TVV * exp(η[2])
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

IOV_PK_model = @model begin
    @param begin
        TVCL  RealDomain(lower = 0, init = 5)
        TVV  RealDomain(lower = 0, init = 50)
        Ω  PDiagDomain(2)
        Ω_IOV  RealDomain(lower = 0, init = 0.1)
        σ_prop  RealDomain(lower = 0, init = 0.1)
    end

    @random begin
        η ~ MvNormal(Ω)
        κ ~ MvNormal(Diagonal(fill(Ω_IOV, 7)))
    end

    @covariates OCC

    @pre begin
        CL = TVCL * exp(η[1] + κ[OCC])
        Vc = TVV * exp(η[2])
    end

    @dynamics Central1

    @derived begin
        cp = @. Central / Vc
        dv ~ @. Normal(cp, abs(cp) * σ_prop)
    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

pop1 = map(
    subj -> Subject(
        id = subj,
        events = DosageRegimen(100, addl = 6, ii = 24),
        covariates = (; OCC = [1, 2, 3, 4, 5, 6, 7]),
        covariates_time = [0, 24, 48, 72, 96, 120, 144],
        observations = (; dv = nothing),
    ),
    1:10,
)
Population
  Subjects: 10
  Covariates: OCC
  Observations: dv

1.4.3 The Parameters

params = (TVCL = 4, TVV = 10, Ω = [0.04, 0.04], Ω_IOV = 0.04, σ_prop = 0.2)
(TVCL = 4,
 TVV = 10,
 Ω = [0.04, 0.04],
 Ω_IOV = 0.04,
 σ_prop = 0.2,)

1.4.4 Simulate

using Random
Random.seed!(1234)
sims = simobs(IOV_PK_model, pop1, params, obstimes = 0:1:192)
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.2 Sharing Variance Across Occasions

The variance specification is slightly different that what we typically see for Between Subject Variability (BSV):

  • Shared Variance (Ω_IOV): The fill(Ω_IOV, 7) function creates a vector [Ω_IOV, Ω_IOV, ..., Ω_IOV] with 7 elements, all equal to Ω_IOV.

  • Diagonal Covariance Matrix: Diagonal(fill(Ω_IOV, 7)) constructs a 7x7 diagonal covariance matrix where the diagonal elements are Ω_IOV and off-diagonal elements are zero.

    This covariance matrix looks like:

    \[ \text{Cov}(κ) = \begin{bmatrix} \Omega_{\text{IOV}} & 0 & 0 & \dots & 0 \\ 0 & \Omega_{\text{IOV}} & 0 & \dots & 0 \\ 0 & 0 & \Omega_{\text{IOV}} & \dots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \dots & \Omega_{\text{IOV}} \end{bmatrix} \]

  • Interpretation: Each occasion’s random effect κ_i has the same variance Ω_IOV, meaning that the degree of variability is consistent across all occasions.

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
    CL = TVCL * exp(η_CL + κ[OCC])
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], where OCC 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.