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

**Authors:** Hyunseung Kong, Inyoung Kim, Byoung-Tak Zhang

PMC · DOI: 10.7717/peerj.20258 · 2025-10-27

## TL;DR

PKPy is an open-source Python framework that automates population pharmacokinetic analysis, offering accurate and efficient parameter estimation with minimal user input.

## Contribution

PKPy introduces an automated, accessible Python-based framework for population pharmacokinetic analysis with support for multiple models and robust validation.

## Key findings

- PKPy achieved robust parameter estimation with bias below 3% and recovery rates over 98% in one-compartment models.
- The framework successfully identified true covariate relationships with 100% accuracy and maintained high model fit quality (R2 ≥ 0.97).
- PKPy demonstrated computational efficiency, with significantly faster installation and analysis times compared to existing software.

## 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 (R2 ≥ 0.97). For two-compartment models, the framework showed comparable performance with slightly higher parameter bias (5–10%) but maintained excellent fit quality (R2 ≥ 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 (R2 = 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.

## Full-text entities

- **Chemicals:** Theophylline (MESH:D013806)

## Figures

13 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12574595/full.md

---
Source: https://tomesphere.com/paper/PMC12574595