Pharmacokinetics: Compartment Models
Pharmacokinetics (PK) is what the body does to a drug — its absorption, distribution, metabolism, and excretion (ADME). Remarkably, these processes are described with the same mass-balance ordinary differential equations that power compartmental epidemic models, so the drug concentration in a “compartment” rises and falls by the same first-order kinetics that move individuals between , , and .
The one-compartment IV bolus
The simplest model imagines the body as a single well-mixed compartment of volume from which the drug is eliminated at a rate proportional to its concentration. For an intravenous bolus dose given at , mass balance gives
whose solution is a simple exponential decay:
Here is the first-order elimination rate constant.
The core parameters
The volume of distribution relates the dose to the initial concentration:
It is an apparent volume — a proportionality constant, not a physical space — and can exceed total body water for drugs that partition into tissue.
Clearance is the volume of plasma cleared of drug per unit time and links the rate constant to the volume:
The half-life is the time for the concentration to fall by half, found by solving :
The area under the curve is the total exposure, obtained by integrating from to (see integrals):
First-order oral absorption
Oral dosing adds an absorption compartment (the gut) that feeds the central compartment at first-order rate , with bioavailable fraction . The concentration follows the Bateman equation:
This rises from zero, reaches a peak , and then declines. Setting the derivative gives the time of the peak:
Two-compartment model
When drug distributes into a peripheral tissue compartment before reaching equilibrium, the decline after an IV bolus is biexponential — a fast distribution phase followed by a slower elimination phase:
The macro-constants , , , and are combinations of the intercompartmental micro-rate constants, and governs the terminal half-life.
Repeated dosing and steady state
Give a maintenance dose every interval and the drug accumulates until input balances elimination. The average concentration at steady state depends only on the rate of bioavailable input and clearance:
This equation drives clinical dosing: to hit a target average concentration, choose to match .
Worked example
A 500 mg IV bolus produces an initial plasma concentration of , and a second sample at reads .
Volume of distribution:
The concentration halved in 4 h, so and
Clearance:
Total exposure:
Both routes to the AUC agree, a useful consistency check.
In code
We compute the IV-bolus profile in closed form, confirm it against a numerical ODE solve, and estimate the AUC by the trapezoid rule.
R
library(deSolve)
library(pracma)
D <- 500; V <- 25; k <- 0.173 # dose, volume, rate constant
C0 <- D / V # 20 mg/L
t <- seq(0, 24, by = 0.1)
Cexact <- C0 * exp(-k * t)
# numerical ODE for the same one-compartment system
f <- function(t, C, p) list(-p$k * C)
$out <- ode(y = c(C = C0), times = t, func = f, parms = list(k = k))
max(abs(out[, "C"] - Cexact)) # ~1e-6: ODE matches closed form
trapz(t, Cexact) # ~113.6 mg*h/L (finite window)
C0 / k # 115.6 mg*h/L (0 to infinity)
Python
import numpy as np
from scipy.integrate import solve_ivp
D, V, k = 500.0, 25.0, 0.173
C0 = D / V # 20 mg/L
t = np.linspace(0, 24, 241)
Cexact = C0 * np.exp(-k * t)
sol = solve_ivp(lambda t, C: -k * C, (0, 24), [C0], t_eval=t, rtol=1e-9)
print(np.max(np.abs(sol.y[0] - Cexact))) # ~1e-7: agree
print(np.trapz(Cexact, t)) # ~113.6 mg*h/L
print(C0 / k) # 115.6 mg*h/L (analytic AUC)
Julia
using DifferentialEquations
D, V, k = 500.0, 25.0, 0.173
C0 = D / V # 20 mg/L
prob = ODEProblem((C, p, t) -> -k * C, C0, (0.0, 24.0))
sol = solve(prob, Tsit5(); saveat = 0.1)
t = sol.t
Cexact = @. C0 * exp(-k * t)
maximum(abs.(sol.u .- Cexact)) # tiny: numerical matches analytic
auc = sum(diff(t) .* (Cexact[1:end-1] .+ Cexact[2:end]) ./ 2) # ~113.6
C0 / k # 115.6 analytic AUC
Why it matters
Every antibiotic dose is chosen by solving these equations: clearance and volume set the dose and interval, and the resulting concentration–time curve is the input to the drug’s effect. Linking that curve to pharmacodynamics — what the drug does to the pathogen — is exactly how the PK/PD indices for antimicrobial dosing are built.
Related
- Pharmacodynamics: Dose–Response
- Antimicrobial PK/PD
- Compartmental Models — the same mass-balance ODEs
- Exponentials and Logarithms — first-order decay
- Integrals — computing the AUC
- Derivatives — finding the peak concentration
- Quantitative Methods