library(tidyverse)
library(nlmixr2)
library(nlmixr2data)Covariate Modeling
Module goal: Learn how population models move from unexplained variability toward explained variability.
Module Overview
In the previous module, we learned how population models represent variability using:
- random effects
- residual error
- variability structures
- shrinkage
Now we ask:
Why do subjects differ?
Covariates attempt to explain systematic differences between subjects.
Examples include:
- weight
- age
- sex
- renal function
- liver function
- disease state
- concomitant medications
Covariates do not eliminate variability.
They explain part of it.
Why This Module Matters
A model may estimate meaningful population variability.
But variability alone does not explain why subjects differ.
Example:
Typical CL = 3
Subject A = 2
Subject B = 4
A covariate model asks whether part of this difference has a systematic explanation.
Example:
Higher weight → higher clearance
Covariates help distinguish:
unexplained variability
from:
explained variability
This is central to population pharmacometrics.
Learning Objectives
By the end of this module, you will be able to:
- explain why covariates matter in population models
- distinguish random effects and covariate effects
- identify candidate continuous and categorical covariates
- visualize possible covariate relationships
- add simple covariate effects to an
nlmixr2model - interpret covariate effects biologically
- understand why covariates should be clinically meaningful, not only statistically detectable
Lessons in This Module
Lesson 1: Why Covariate Models Matter
This lesson introduces covariates and explains how they relate to variability.
You will distinguish:
- random effects
- covariate effects
- remaining unexplained variability
Lesson 2: Exploring Covariates Visually
This lesson uses exploratory plots to identify possible covariate relationships.
You will examine relationships such as:
weight → clearance
and learn why visualization comes before model building.
Lesson 3: Building the First Covariate Model
This lesson adds a simple covariate effect inside an nlmixr2 model.
You will connect covariate equations to model syntax.
Lesson 4: Interpreting Covariate Effects
This lesson focuses on interpretation.
You will learn how to describe the size and direction of a covariate effect in PK terms.
Lesson 5: From Variability to Explanation
This lesson connects covariate modeling back to the larger population modeling workflow.
You will learn how covariates support model understanding and prepare for formal diagnostics.
Software Used
This module continues using:
We will continue with simple, transparent code before introducing more automated diagnostic workflows later.
Dataset Used
data(
"theo_sd",
package = "nlmixr2data"
)We continue using the same course dataset so the covariate ideas build directly on the models already introduced.
The focus is now on explaining variability.
Conceptual Workflow
This module follows:
Typical Parameter → Random Effect → Observed Variability → Covariate Effect → Remaining Variability
Or more simply:
unexplained variability → explained variability
How This Module Connects to the Previous Module
The previous module asked:
How do population models represent variability?
This module asks:
Can some of that variability be explained?
Example:
ETA(CL) → weight effect → smaller remaining ETA(CL)
Covariates attempt to explain patterns that random effects alone only describe.
How This Module Prepares for Diagnostics
Formal diagnostics come later.
Before evaluating a model formally, we need to understand what the model is trying to explain.
This module prepares us for diagnostics by clarifying:
- what covariates are doing
- what variability remains
- what assumptions the model is making
What This Module Does Not Do Yet
This module does not focus on:
- formal goodness-of-fit diagnostics
- visual predictive checks
- final model qualification
- simulation-based dosing decisions
Those topics come later.
Here, the focus is covariate reasoning.
Expected Outputs
By the end of this module, you should be able to:
- explain why covariates are used
- recognize common PK covariates
- visualize covariate relationships
- add a simple covariate effect to a model
- interpret a covariate effect biologically
- explain why covariates reduce but do not eliminate variability
Next Step
Start with Lesson 1 to understand why covariate models are central to population PK modeling.