OpenPKPD Logo

Contents

  • Getting Started
    • Installation
      • Requirements
      • Installing with uv
      • Installing with pip
      • Optional extras
      • Why Install An Extra?
      • Verifying the install
      • Launching the desktop GUI
      • Building the documentation locally
    • Quick Start
      • The Python API
        • Reading the result
        • Writing HTML and PDF reports
      • Running from a control stream file
      • Desktop GUI quick start
      • Diagnostic plots
      • What’s next?
    • Migrating from NONMEM
      • Control stream → Python API
      • Estimation method names
      • NM-TRAN code blocks
      • Using a .ctl file directly
      • Output files
      • Current limitations
  • User Guide
    • What this guide covers
      • Desktop GUI
        • GUI architecture
        • Quick start
        • Shell basics
        • Workflow guide
        • End-to-end walkthroughs
        • Troubleshooting and tips
      • Data Format
        • Required columns
        • Optional columns
        • EVID codes
        • Loading data
        • Column auto-generation
        • Pre-dose convention
        • Example dataset (Theophylline)
        • Covariate imputation
      • ModelBuilder API
        • Minimal working example
        • Method reference
      • Control Streams
        • Parsing a control stream
        • Inspecting parsed records
        • Running from the CLI
        • Running from Python
        • Supported records and serialization contract
        • Round-trip example
        • Unsupported runtime combinations
        • NM-TRAN code blocks
        • BLOCK OMEGA example
        • SAME OMEGA (IOV-style blocks)
      • PK Subroutines
        • Implemented ADVAN selectors
        • TRANS codes
        • Selecting a subroutine
        • Specialized absorption helpers
        • Multiple dosing
        • Pre-dose observations
        • Covariate effects
        • Selector notes
        • ODE solver tuning (ADVAN6 / ADVAN8)
        • Native acceleration for user-defined $DES models
        • ADVAN5 — General N-Compartment Linear Model
      • Estimation Methods
        • Choosing a method
        • FO — First Order
        • FOCE and FOCEI
        • Laplacian
        • SAEM
        • IMP and IMPMAP
        • Bayesian estimation
        • Nonparametric estimation
        • Common options
        • Result objects
        • Model selection
        • Convergence and warnings
        • Parallel execution
      • Covariance Step
        • Enabling the covariance step
        • Accessing results
        • Output files
        • The R and S matrices
        • Condition number
        • Interpreting warnings
      • Output Files
        • File overview
        • .lst file
        • .ext file
        • .phi file
        • .cov and .cor files
        • $TABLE output
        • CDISC ADPPK output
        • Accessing results programmatically
      • Diagnostic Plots
        • Installation
        • Quick example
        • compute_diagnostics()
        • GOF plots (plots/gof.py)
        • PK plots (plots/pk.py)
        • PD plots (plots/pd.py)
        • ETA plots (plots/eta.py)
        • Model performance plots (plots/model_perf.py)
        • NCA plots (plots/nca.py)
        • Saving figures
        • Style
      • Coverage and Validation Map
        • How to read this page
        • Estimation methods
        • PK subroutines and solver surfaces
        • Diagnostics, simulation, and NCA
        • Analysis and model families
        • Workflow, parsing, outputs, and GUI
        • Dedicated release lanes
        • External anchors and citations
        • Current strongest areas
        • Current thinner areas
        • Recommended maintenance rule
      • Analysis validation gaps and next tests
        • Biggest remaining gaps
        • Recently resolved gaps (2026-04-02 cycle)
        • Why these are the biggest gaps
        • Best next tests to add
        • Previously addressed gaps (completed)
        • Suggested implementation order
        • Related pages
      • Validation notes
        • NPDE
        • VPC / pcVPC principles
        • NCA
        • SAEM / Monolix parity
        • What these validation milestones do and do not claim
      • Validation matrix
        • How to read this page
        • Estimation methods
        • Other validated analytical / model surfaces
        • Workflow surfaces
        • Release-gating guidance
        • What should happen when a method is not yet strong enough
        • Highest-value next additions
      • Test suite
        • Test categories
        • Recommended validation gates
        • Running the test suite
        • Coverage inventory
      • Advanced PK Features
        • Delay Differential Equations (DDE)
        • SBML Model Import
        • Inter-Occasion Variability (IOV)
        • Parallel Execution
      • Non-Compartmental Analysis (NCA)
        • Standard NCA
        • Sparse Sampling NCA
        • CDISC PP Domain Export
        • NCA Visualization
      • Migrating from Monolix
        • Concept mapping
        • Data format
        • Parameter conventions
        • Estimation settings
        • Worked example — Theophylline 1-compartment oral (SAEM)
        • Output file mapping
        • Covariate effects
        • Current limitations
        • See also
      • Comparison with Other PK/PD Software
        • Estimation methods
        • PK subroutines
        • PD and PK/PD models
        • Data handling
        • Output and reporting
        • Non-compartmental analysis (NCA)
        • Simulation and model evaluation
        • Covariate modelling
        • Parallel computing
        • Ecosystem and usability
        • Summary: when to choose OpenPKPD
      • External validation benchmarks
        • Validated estimator envelope
        • Monolix: theophylline SAEM
        • Advanced estimators: empirical benchmark notes
        • PKNCA / Phoenix-style NCA: theophylline
        • WinNonlin-backed NCA: Indometh
        • WinNonlin status
        • nlmixr2 FOCEI: theophylline and warfarin
        • NONMEM 7.x: multi-compartment and covariate models
        • Phenobarbital — Neonatal Population PK (1-Compartment FO)
        • New Example Control Streams
        • Priority Improvement Areas
        • Current conclusions
        • References
      • Algorithm and Method Citations
        • Estimation methods
        • Covariance step
        • PK structural models (ADVAN subroutines)
        • Pharmacodynamic models
        • Covariate modelling
        • Non-compartmental analysis (NCA)
        • Simulation and diagnostics
        • Optimal design
        • Prior distributions (MAP / NWPRI)
        • Software and numerical tools
        • Validation datasets
        • Validation reference outputs
  • Examples
    • Basic PK modelling
    • PD and PKPD models
    • Special features
    • Estimation methods
    • Analysis workflows
      • Example 1 — Theophylline (FO)
        • Model
        • Output
        • Figures
        • Notes
      • Example 2 — Warfarin (FOCE)
        • Model
        • Output
        • Figures
        • Notes
      • Example 3 — Two-Compartment IV (ADVAN3)
        • Model
        • Output
        • Figures
        • Biexponential decline
        • Notes
      • Example 4 — Emax PD Model
        • $ERROR block
        • Full model
        • Output
        • Figures
        • Notes
      • Example 5 — Indirect Response Model
        • Pharmacodynamic model
        • Key concepts
        • Output
        • Figures
        • Notes
      • Example 6 — Running a Control Stream File
        • Output
        • From Python
        • From the CLI
        • Minimal .ctl file
        • Supported ESTIMATION keywords
        • Notes
      • Example 7 — Full Diagnostic Plot Gallery
        • Output
        • Figures
        • Interpreting GOF plots
      • Example 8 — FOCEI Optimizer Controls from Python
        • Goal
        • Example
        • When to use these controls
        • Related example
      • Example 9 — FOCEI Optimizer Controls from a Control Stream
        • Control stream
        • Inspecting it
        • Notes
      • Example 29 — Optimal Design with PFIM
      • Example 16: Delay Differential Equation (DDE) PK model
        • Background
        • Key code
        • Output
        • Figures
        • Running
        • See also
      • Example 20 — SAEM Estimation
        • Key concepts
        • Usage
        • Constructor options
        • Convergence criterion
        • Comparison with FOCE
      • Example 22 — PBPK Modelling
        • Model structure
        • Usage
        • Output
        • Reference
      • Example 31 — IMPMAP Warm-Start Diagnostics
        • What it shows
        • Key output
        • Notes
      • Example 32 — Nonparametric Support Points
        • What it shows
        • Model
        • Notes
      • Example 33 — TMDD Model Comparison
        • What it shows
        • Notes
      • Example 34 — Multi-Dose Steady-State NCA
        • What it shows
        • Why the final-interval workflow matters
  • API Reference
    • ModelBuilder
      • ModelBuilder
        • ModelBuilder.__init__()
        • ModelBuilder.problem()
        • ModelBuilder.data()
        • ModelBuilder.dataset()
        • ModelBuilder.subroutines()
        • ModelBuilder.pk()
        • ModelBuilder.error()
        • ModelBuilder.des()
        • ModelBuilder.theta()
        • ModelBuilder.omega()
        • ModelBuilder.sigma()
        • ModelBuilder.estimation()
        • ModelBuilder.covariance()
        • ModelBuilder.covariates()
        • ModelBuilder.impute_covariates()
        • ModelBuilder.clone()
        • ModelBuilder.build()
      • BuiltModel
        • BuiltModel.population_model
        • BuiltModel.params
        • BuiltModel.estimation_kwargs
        • BuiltModel.do_covariance
        • BuiltModel.covariance_kwargs
        • BuiltModel.design()
        • BuiltModel.simulate()
        • BuiltModel.fit()
        • BuiltModel.__init__()
    • ControlStream
      • ControlStream
        • ControlStream.source_text
        • ControlStream.records
        • ControlStream.source_path
        • ControlStream.get()
        • ControlStream.get_all()
        • ControlStream.get_typed()
        • ControlStream.get_all_typed()
        • ControlStream.problem
        • ControlStream.data
        • ControlStream.input
        • ControlStream.subroutines
        • ControlStream.pk
        • ControlStream.des
        • ControlStream.error
        • ControlStream.pred
        • ControlStream.theta_records
        • ControlStream.omega_records
        • ControlStream.sigma_records
        • ControlStream.simulation
        • ControlStream.mixture
        • ControlStream.prior_record
        • ControlStream.thetap_record
        • ControlStream.thetapv_record
        • ControlStream.omegap_record
        • ControlStream.omegapd_record
        • ControlStream.sigmap_record
        • ControlStream.sigmapd_record
        • ControlStream.estimation_records
        • ControlStream.covariance
        • ControlStream.table_records
        • ControlStream.from_file()
        • ControlStream.from_string()
        • ControlStream.to_dict()
        • ControlStream.to_string()
        • ControlStream.write()
        • ControlStream.__init__()
    • Parameters
      • ThetaSpec
        • ThetaSpec.init
        • ThetaSpec.lower
        • ThetaSpec.upper
        • ThetaSpec.fixed
        • ThetaSpec.label
        • ThetaSpec.__init__()
      • OmegaSpec
        • OmegaSpec.block_size
        • OmegaSpec.values
        • OmegaSpec.fixed
        • OmegaSpec.same
        • OmegaSpec.label
        • OmegaSpec.to_matrix()
        • OmegaSpec.__init__()
      • SigmaSpec
        • SigmaSpec.block_size
        • SigmaSpec.values
        • SigmaSpec.fixed
        • SigmaSpec.label
        • SigmaSpec.to_matrix()
        • SigmaSpec.__init__()
      • ParameterSet
        • ParameterSet.theta
        • ParameterSet.omega
        • ParameterSet.sigma
        • ParameterSet.theta_specs
        • ParameterSet.omega_specs
        • ParameterSet.sigma_specs
        • ParameterSet.to_vector()
        • ParameterSet.from_vector()
        • ParameterSet.apply_bounds()
        • ParameterSet.from_specs()
        • ParameterSet.n_theta()
        • ParameterSet.n_eta()
        • ParameterSet.n_eps()
        • ParameterSet.n_iov_occasions()
        • ParameterSet.has_iov()
        • ParameterSet.expand_omega_iov()
        • ParameterSet.n_free()
        • ParameterSet.get_optimizer_bounds()
        • ParameterSet.__init__()
    • Estimation
      • EstimationResult
        • EstimationResult.theta_final
        • EstimationResult.omega_final
        • EstimationResult.sigma_final
        • EstimationResult.ofv
        • EstimationResult.converged
        • EstimationResult.condition_number
        • EstimationResult.eta_shrinkage
        • EstimationResult.eps_shrinkage
        • EstimationResult.post_hoc_etas
        • EstimationResult.ofv_history
        • EstimationResult.warnings
        • EstimationResult.structured_warnings
        • EstimationResult.shrinkage_warnings
        • EstimationResult.n_function_evals
        • EstimationResult.elapsed_time
        • EstimationResult.method
        • EstimationResult.message
        • EstimationResult.diagnostics
        • EstimationResult.n_observations
        • EstimationResult.n_subjects
        • EstimationResult.n_parameters
        • EstimationResult.aic
        • EstimationResult.bic
        • EstimationResult.compute_n_parameters()
        • EstimationResult.add_structured_warning()
        • EstimationResult.check_omega_conditioning()
        • EstimationResult.summary()
        • EstimationResult.to_html()
        • EstimationResult.to_pdf()
        • EstimationResult.compute_shrinkage()
        • EstimationResult.compute_deshrinkage_etas()
        • EstimationResult.__init__()
      • EstimationMethod
        • EstimationMethod.method_name
        • EstimationMethod.estimate()
    • Data
      • Bundled dataset loaders
        • load_theophylline()
        • load_warfarin()
      • NONMEMDataset
        • NONMEMDataset
    • Plots
      • compute_diagnostics
        • compute_diagnostics()
      • GOF plots
        • diagnostic_panel()
        • dv_vs_ipred()
        • dv_vs_pred()
        • cwres_vs_time()
        • cwres_vs_pred()
        • cwres_qq()
        • abs_iwres_vs_ipred()
      • PK plots
        • spaghetti_plot()
        • concentration_time()
        • mean_profile()
      • PD plots
        • effect_time()
        • emax_curve()
        • hysteresis_loop()
        • pd_individual()
      • ETA plots
        • eta_histograms()
        • eta_pairs()
        • eta_vs_covariate()
      • Model performance
        • ofv_history()
        • vpc()
      • Simulation-based plots
        • vpc_plot()
        • pcvpc_plot()
        • stratified_vpc_plot()
        • npde_plot()
        • simulation_panel()
    • PBPK Models
      • Base class
        • PBPKModel
      • Five-organ template
        • FiveOrganPBPK
      • Usage
    • Population PD Model
      • Class
        • PopulationPDModel
      • Overview
    • Delay Differential Equations (DDE)
      • Class
        • DDESubroutine
      • Overview
  • Contributing
    • Development setup
      • Prerequisites
      • Setup
    • just workflow and platform support
    • Running tests
    • Code style
    • Building documentation
    • Building standalone installers
    • Performance-oriented development
    • Project structure
    • Submitting a pull request
    • Licence
  • Building Standalone Installers
    • Prerequisites
    • Running the build
    • Output artifacts
    • Build steps
    • Advanced options
    • Platform notes
      • macOS
      • Linux
      • Windows
  • Developer performance guide
    • General practices
    • Existing profiling entry points
    • Patterns that have worked well in this codebase
      • 1. Add conservative fast paths for common cases
      • 2. Cache generated helper code instead of rebuilding it
      • 3. Reduce repeated allocations and repeated DataFrame work
      • 4. Batch work when semantics stay the same
    • Patterns to treat cautiously
      • Broad autodiff or runtime replacement
      • Optimizations that change convergence behavior
    • Practical workflow for a performance change
    • Validation checklist
    • Current high-value areas
  • Changelog
    • 0.3.4 — 2026-06-26
      • Fixed
    • 0.3.3 — 2026-06-26
      • Changed
    • 0.3.2 — 2026-06-26
      • Fixed
    • 0.3.1 — 2026-06-26
      • Fixed
    • 0.3.0 — 2026-06-26
      • Added
      • Fixed
      • Documentation
    • 0.2.9 — 2026-05-09
      • Fixed
      • Documentation
    • 0.2.8 — 2026-05-09
      • Fixed
      • Documentation
    • 0.2.7 — 2026-04-02
      • Added2
      • Fixed
      • Documentation
    • 0.2.6 — 2026-04-02
      • Added
    • 0.2.5 — 2026-04-01
      • Added
    • 0.2.4 — 2026-03-28
      • Changed
    • 0.2.3 — 2026-03-28
      • Changed
    • 0.2.2 — 2026-03-24
      • Changed
    • 0.2.1 — 2026-03-22
      • Changed
      • Added
    • 0.1.0 — 2026-03-03
      • Added
OpenPKPD
  • Examples
  • Example 7 — Full Diagnostic Plot Gallery
  • View page source

Example 7 — Full Diagnostic Plot Gallery

Script: examples/07_diagnostic_plots.py

A complete walkthrough of every diagnostic plot function using the theophylline FO model from Example 1 — Theophylline (FO).

Output

openpkpd/estimation/foce.py:236: UserWarning: ETA1 shrinkage is 72.5% (>30%). EBE-based analyses for this parameter may be unreliable.
  res.compute_shrinkage()
openpkpd/estimation/foce.py:236: UserWarning: ETA2 shrinkage is 73.6% (>30%). EBE-based analyses for this parameter may be unreliable.
  res.compute_shrinkage()
openpkpd/estimation/foce.py:236: UserWarning: ETA3 shrinkage is 82.3% (>30%). EBE-based analyses for this parameter may be unreliable.
  res.compute_shrinkage()
Running FOCE...
Method: FOCEI
OFV: 278.7017
AIC: 298.7017
BIC: inf   (n_obs = 0)
n_parameters: 10
Converged: False
THETA: [ 1.5   0.08 30.  ]
OMEGA (diagonal): [0.5 0.3 0.3]
SIGMA (diagonal): [0.1]
ETA shrinkage: ['72.5%', '73.6%', '82.3%']
Shrinkage warnings:
  ETA1 shrinkage is 72.5% (>30%). EBE-based analyses for this parameter may be unreliable.
  ETA2 shrinkage is 73.6% (>30%). EBE-based analyses for this parameter may be unreliable.
  ETA3 shrinkage is 82.3% (>30%). EBE-based analyses for this parameter may be unreliable.

Created 14 figures.
Figures saved to docs/_static/examples

Figures

GOF panel (2×3 composite)

The panel contains DV vs IPRED, DV vs PRED, CWRES vs TIME, CWRES vs PRED, CWRES Q-Q, and |IWRES| vs IPRED.

GOF panel

Individual GOF plots

DV vs IPRED DV vs PRED CWRES vs TIME CWRES vs PRED CWRES Q-Q |IWRES| vs IPRED

PK concentration-time plots

Spaghetti plot Concentration-time Mean profile

ETA diagnostics

ETA histograms ETA pairs ETA1 vs weight

OFV convergence

OFV history

Interpreting GOF plots

Plot

What to look for

DV vs IPRED / PRED

Points close to the identity line, no systematic bias

CWRES vs TIME

Random scatter around zero; no trend or funnel

CWRES vs PRED

Random scatter; no heteroscedasticity

CWRES Q-Q

Points on the diagonal line; normality of residuals

|IWRES| vs IPRED

Homogeneous spread; no increasing trend (proportional error check)

ETA histograms

Symmetric, approximately normal distributions

ETA pairs

No strong correlations (would suggest OMEGA mis-specification)

ETA vs covariates

Flat relationship (no unexplained covariate effect)

Previous Next

© Copyright 2025, OpenPKPD contributors.

Built with Sphinx using a theme provided by Read the Docs.