PK–PD Simulator

Marta Z. Naves Sánchez
03/05/2026

Overview of the Application

Objective

This application simulates:

  • Drug concentration over time (PK)
  • Biological response (PD)

Based on the Code

Key UI elements:

  • Model selection (1 or 2 compartments)
  • Dose, Vd, kel inputs
  • PD parameters (E0, Emax, EC50)

Output

  • Concentration plot
  • Response plot
  • Summary statistics

Pharmacokinetics (PK) – One Compartment

Model Used in server.R

t <- seq(0, 24, length.out = 200)

X0 <- 100
Vd <- 10
kel <- 0.2

C<- (X0 / Vd) * exp(-kel * t)

plot(t, C, type="l", lwd=2,
     main="One-Compartment Model",
     xlab="Time", ylab="Concentration")

Interpretations:

  • Exponential decay
  • Controlled by elimination rate (kel)
  • Higher kel → faster drug removal

Pharmacokinetics (PK) – Two Compartment

Model from server.R Eigenvalues

k12<- 0.3
k21<- 0.2
kel<- 0.2
X0<- 100
Vd<- 10
t<- seq(0, 24, length.out = 200)
a <- (k12 + k21 + kel)
b <- k21 * kel
alpha <- (a + sqrt(a^2 - 4*b)) / 2
beta  <- (a - sqrt(a^2 - 4*b)) / 2
A <- (alpha - k21) / (alpha - beta)
B <- (k21 - beta) / (alpha - beta)
Xc <- X0 * (A * exp(-alpha * t) + B * exp(-beta * t))
C <- Xc / Vd
plot(t, C, type="l", lwd=2,
     main="Two-Compartment Model",
     xlab="Time", ylab="Concentration")

Interpretations:

  • Two phases: Fast distribution and slow elimination
  • More realistic than 1-compartment

Pharmacodynamics (PD) – Emax Model

Model Used in server.R

E0<- 5
Emax<- 20
EC50<- 5

R <- E0 + (Emax * C) / (EC50 + C)

plot(t, R, type="l", lwd=2,
     main="Pharmacodynamic Response",
     xlab="Time", ylab="Response")

Interpretations:

  • Response increases with concentration
  • Saturation effect (cannot grow infinitely)
  • EC50 controls sensitivity