Diagnostic Plot Gallery With Public and Synthetic Data

Purpose

This gallery shows the pharmax.viz diagnostic helpers using public and synthetic data. It is intended for exploratory model review, not regulatory validation.

library(pharmax.viz)

Public Theophylline Profiles

theoph <- datasets::Theoph
theoph_plot <- px_spaghetti(
  data.frame(
    ID = theoph$Subject,
    TIME = theoph$Time,
    DV = theoph$conc
  )
)
theoph_plot

Synthetic Diagnostics

set.seed(2026)
demo <- data.frame(
  TIME = rep(c(0.5, 1, 2, 4, 8), each = 30),
  DV = abs(rnorm(150, 4, 1)),
  PRED = abs(rnorm(150, 4.1, 0.9)),
  SIM = abs(rnorm(150, 4.2, 1.1)),
  CWRES = rnorm(150),
  NPDE = rnorm(150)
)
px_residuals(demo)

px_npde(demo)

px_vpc(demo, bins = 5)

Forest Plot

effects <- data.frame(
  term = c("WT on CL", "AGE on V", "ALB on CL"),
  estimate = c(0.25, -0.10, 0.18),
  lower = c(0.05, -0.30, 0.02),
  upper = c(0.45, 0.10, 0.34)
)

px_forest(effects)