Data Visualization for Pharmacometrics
How to use this section: Plots are your fastest diagnostic tool in PMx.
These lessons build a small set of reusable plotting patterns you’ll apply in every project:
individuals → scales → stratification → summaries → QC → communication.
Learning Objectives
By the end of this module, you will be able to:
- Build clear, correct ggplot2 figures by thinking in layers (canvas → mappings → geoms → scales → facets → annotations).
- Visualize individual profiles and use them as a first-pass structural QC screen.
- Use linear vs log scales intentionally to reveal PK structure (especially late-time behavior).
- Stratify plots by covariates (continuous and categorical) and recognize correlation/confounding risks.
- Visualize dose–response patterns without over-claiming mechanism.
- Add summary and variability layers responsibly by aligning to nominal time (protocol schedule) and choosing robust summaries.
- Run a QC mindset workflow to detect common data issues before modeling.
- Turn diagnostic plots into publication- and report-ready figures, then export and reuse them reliably.
Why Visualization Matters in PMx
Before you fit any model, you should be able to answer:
- Do the profiles look plausible (shape, magnitude, timing)?
- Are there obvious outliers, duplicates, or unit issues?
- Are time ordering and sampling patterns consistent with a protocol?
- Do covariates appear to shift exposure or shape?
- Do log-scale views reveal structure that linear scale hides?
Many “modeling problems” are actually data problems that show up immediately in plots.
A single misleading plot can send you in the wrong direction.
Start simple, layer intentionally, and confirm what your plot is actually showing.
PMx Plotting Mindset: Plots as Questions
Instead of “make a nice plot,” ask:
- “Do individuals behave like individuals?”
- “Is the dataset structurally consistent (time ordering, duplicates, impossible values)?”
- “What changes when I add a log-scale layer?”
- “If I stratify, am I seeing a real pattern or a correlated covariate?”
- “If I summarize, what am I hiding—and is nominal time aligned?”
This mindset keeps your analysis honest and your modeling grounded.
A Minimal Plotting Checklist
Use this whenever you open a new PK/PD dataset:
- Individual profiles (lines + points; correct grouping)
- Log-scale view (semi-log for PK intuition)
- Faceting (if N is manageable) or alpha blending (if N is large)
- Stratify by key covariates (WT, AGE, SEX, dose group) after inspecting covariate distributions
- Nominal-time summaries (only after defining alignment)
- QC-focused plots (hunt for problems before telling stories)
If you only do one thing: plot individuals first.
Summaries are useful—but they can hide major issues.
Lessons in This Module
Work through these in order the first time. Later, revisit them as references.
Plot Construction and Layering
Learn the “empty canvas → add layers” workflow that makes ggplot predictable and reusable.Individual Profiles and Structural QC
Build your go-to profile plots and learn what “wrong” looks like before modeling.Linear and Log Scales
Add a scale layer and practice reading PK structure (especially the late-time phase).Stratification and Covariates
Use real covariates to explore variability, and practice checking covariate relationships before interpreting patterns.Dose-Response Visualization
Visualize nonlinear dose–response patterns and communicate them carefully without mechanistic overreach.Summaries and Variability Layers
Align to nominal time (protocol schedule), then add responsible summary and variability layers for large-N settings.QC Case Study: Detecting Data Issues with Visualization
Shift into “find problems” mode using layered plots to detect common data issues.Publication-Ready PMx Figures
Turn diagnostic plots into clear, readable figures: labels, scales, themes, and layout choices.Saving, Exporting, and Reusing Plots
Export figures reliably (size, resolution, formats) and build reusable plot functions/templates.
What You’ll Be Ready For After This Module
After you can see the data clearly, you’re ready to:
- formalize dataset structures for modeling (events, dosing records, BLQ handling)
- build first regression and mixed-effects intuition
- interpret diagnostics (which are also plots)
Visualization is the bridge between clean data and credible modeling.