PKPy: a Python-based framework for automated population pharmacokinetic analysis

We present PKPy, an open-source Python framework designed to automate population pharmacokinetic analysis workflows. The framework emphasizes user accessibility by minimizing the need for manual parameter initialization while maintaining analytical rigor. PKPy implements both one-compartment and two-compartment pharmacokinetic models (with and without first-order absorption) with integrated capabilities for parameter estimation, covariate analysis, and comprehensive diagnostics. The framework's performance was evaluated through simulation studies across varying sample sizes (20-100 subjects) and model complexities. Results demonstrated robust parameter estimation for clearance and volume of distribution, with bias consistently below 3% and recovery rates exceeding 98% in one-compartment models. The framework successfully identified true covariate relationships with 100% accuracy across all scenarios, while maintaining high model fit quality (<i>R</i> <sup>2</sup> ≥ 0.97). For two-compartment models, the framework showed comparable performance with slightly higher parameter bias (5-10%) but maintained excellent fit quality (<i>R</i> <sup>2</sup> ≥ 0.99). Advanced validation metrics including average fold error (AFE) and absolute average fold error (AAFE) were implemented, with AFE values ranging from 1.01-1.03 and AAFE < 1.05 across test scenarios, indicating excellent prediction accuracy. The key pharmacokinetic parameters estimated by the framework include clearance (CL), volume of distribution (V or V1/V2 for two-compartment models), inter-compartmental clearance (Q), and when applicable, the absorption rate constant (Ka). Application to the classic Theophylline dataset demonstrated PKPy's practical utility, achieving comparable results whether or not initial parameter estimates were provided. The framework successfully estimated population parameters with good model fit (<i>R</i> <sup>2</sup> = 0.933) and automatically identified physiologically plausible covariate relationships. Comprehensive comparisons with existing software packages (Saemix+PKNCA, and simulated comparisons with nlmixr2) revealed PKPy's advantages in computational efficiency, with installation times of 16s versus 96s and analysis times of 13-15s versus 101-102s. While PKPy employs a two-stage approach rather than full nonlinear mixed-effects modeling, it achieved consistent parameter estimates with minimal bias for data-rich scenarios. PKPy leverages Python's scientific computing ecosystem to provide an accessible, transparent platform for pharmacokinetic analysis. The framework's automated approach, support for multiple compartment models, and comprehensive workflow integration demonstrate the potential for reducing barriers to entry in pharmacometric analysis while maintaining scientific rigor.

Authors

Institutions

Publication Details

Journal
PeerJ
Published
2025-10-27
DOI
https://doi.org/10.7717/peerj.20258
Primary Topic
Pharmacogenetics and Drug Metabolism
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

PKPy: a Python-based framework for automated population pharmacokinetic analysis

Hyunseung Kong, Inyoung Kim, Byoung‐Tak Zhang
PeerJ
Pharmacogenetics and Drug Metabolism
article

PKPy: a Python-based framework for automated population pharmacokinetic analysis

Hyunseung Kong, Inyoung Kim, Byoung‐Tak Zhang
article en

Abstract

We present PKPy, an open-source Python framework designed to automate population pharmacokinetic analysis workflows. The framework emphasizes user accessibility by minimizing the need for manual parameter initialization while maintaining analytical rigor. PKPy implements both one-compartment and two-compartment pharmacokinetic models (with and without first-order absorption) with integrated capabilities for parameter estimation, covariate analysis, and comprehensive diagnostics. The framework's performance was evaluated through simulation studies across varying sample sizes (20-100 subjects) and model complexities. Results demonstrated robust parameter estimation for clearance and volume of distribution, with bias consistently below 3% and recovery rates exceeding 98% in one-compartment models. The framework successfully identified true covariate relationships with 100% accuracy across all scenarios, while maintaining high model fit quality (<i>R</i> <sup>2</sup> ≥ 0.97). For two-compartment models, the framework showed comparable performance with slightly higher parameter bias (5-10%) but maintained excellent fit quality (<i>R</i> <sup>2</sup> ≥ 0.99). Advanced validation metrics including average fold error (AFE) and absolute average fold error (AAFE) were implemented, with AFE values ranging from 1.01-1.03 and AAFE < 1.05 across test scenarios, indicating excellent prediction accuracy. The key pharmacokinetic parameters estimated by the framework include clearance (CL), volume of distribution (V or V1/V2 for two-compartment models), inter-compartmental clearance (Q), and when applicable, the absorption rate constant (Ka). Application to the classic Theophylline dataset demonstrated PKPy's practical utility, achieving comparable results whether or not initial parameter estimates were provided. The framework successfully estimated population parameters with good model fit (<i>R</i> <sup>2</sup> = 0.933) and automatically identified physiologically plausible covariate relationships. Comprehensive comparisons with existing software packages (Saemix+PKNCA, and simulated comparisons with nlmixr2) revealed PKPy's advantages in computational efficiency, with installation times of 16s versus 96s and analysis times of 13-15s versus 101-102s. While PKPy employs a two-stage approach rather than full nonlinear mixed-effects modeling, it achieved consistent parameter estimates with minimal bias for data-rich scenarios. PKPy leverages Python's scientific computing ecosystem to provide an accessible, transparent platform for pharmacokinetic analysis. The framework's automated approach, support for multiple compartment models, and comprehensive workflow integration demonstrate the potential for reducing barriers to entry in pharmacometric analysis while maintaining scientific rigor.

PeerJVol. 13
Seoul National University of Science and Technology (KR), Seoul National University (KR), Korea National Defense University (KR)
Openalex Percentile: Top 60%
Pharmacogenetics and Drug Metabolism
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.