Perl-speaks-NONMEM (PsN)—a Perl module for NONMEM related programming

https://doi.org/10.1016/j.cmpb.2003.11.003Get rights and content

Abstract

The NONMEM program is the most widely used nonlinear regression software in population pharmacokinetic/pharmacodynamic (PK/PD) analyses. In this article we describe a programming library, Perl-speaks-NONMEM (PsN), intended for programmers that aim at using the computational capability of NONMEM in external applications. The library is object oriented and written in the programming language Perl. The classes of the library are built around NONMEM’s data, model and output files. The specification of the NONMEM model is easily set or changed through the model and data file classes while the output from a model fit is accessed through the output file class. The classes have methods that help the programmer perform common repetitive tasks, e.g. summarising the output from a NONMEM run, setting the initial estimates of a model based on a previous run or truncating values over a certain threshold in the data file. PsN creates a basis for the development of high-level software using NONMEM as the regression tool.

Introduction

Population pharmacokinetic/pharmacodynamic (PK/PD) modelling, through non-linear mixed effects models, is a commonly used tool in drug development. It was originally developed as a method of handling data from patient studies [1] where the observations per subject were sparse. The population PK/PD approach differs from single subject analyses, in that the data from all subjects are analysed simultaneously while retaining the notion of subjects (in contrast to a naı̈ve pooling approach). A population PK/PD analysis gives estimates of the population parameters, i.e. the values of the parameters that describe the typical individual in the population (the fixed effects) as well as their variability (the random effects).

Several software packages for population PK/PD analysis are available today among which NONMEM is the most widely used [2]. NONMEM is distributed as ANSI FORTRAN source code meaning that it is possible to run NONMEM on any computer with an ANSI FORTRAN compiler.

The NONMEM program is very flexible. It includes a library of commonly used PK models as well as general sub-routines for linear and non-linear models. With the latter, the models are specified in terms of differential equations. All in all, there is hardly any model, relevant to PK/PD modelling, which cannot be specified in NONMEM. What is limiting the model choice is, instead, the time it takes to fit the models to the data. Higher complexity of models introduces higher levels of non-linearity which in turn lengthens run times.

A population analysis, often involving several data files, may consist of anywhere between a dozen and a couple of 100 NONMEM runs. These runs are often made in distinct, logical, phases: the first step is to identify the so called structural model, i.e. the part of the mixed effects model that describes overall trends in the data. This is followed by the covariate model building phase. A covariate is a predictor that potentially explains inter-individual differences in the parameters of the structural model. Identifying a suitable covariate model is usually done in a stepwise manner, manually or automated [3]. A third part of the overall model development process is to find a model for the unexplained variability, both between individuals and between residuals within the same subject. This is sometimes called the statistical model building phase. Once the structural, covariate and statistical models are defined it is recommended to challenge, or validate, the model [4]. This can be done in a number of different ways. One is to use a new data set and assess to what extent the model is predictive. Other ways include various resampling procedures such as cross-validation, bootstrapping and jackknifing [5] (although these are, for practical and run-time reasons, often not employed). Throughout an analysis and apart from the actual modelling it is also always necessary to, for example, set up data files, create audit trails of models and data files and to create reports from output files.

It is a great and usually time consuming challenge to manage all of this in an efficient and reproducible manner. Note that we are not talking about the computational challenge of running, say, 200 NONMEM runs, but the challenge involved in managing the information generated by those runs. Of course, automating some of the 200 runs (some are mundane, pre-specifiable and more or less mandatory) would decrease the time requirements of the analysis.

Some of the computational tasks mentioned above can be implemented directly within NONMEM, but requires high skill in FORTRAN programming while some of the other tasks are beyond the scope of the program. Some attempts have been made (e.g. Wings for NONMEM [6]) to address these issues, but do not offer a comprehensive and homogenous solution.

The aim of this project is to develop a high level, platform independent, programming environment to support the development of software tools to make population analysis tasks of the above kind more efficient and manageable.

Section snippets

Prior work by the authors

During population PK/PD modelling performed by the authors, a substantial number of smaller programs and scripts have been developed to ease various parts of the modelling procedure. Examples range from scripts for extraction of relevant information from NONMEM output files to programs for automated covariate building or bootstrapping. Together they share many tasks related to extracting, changing and writing to NONMEM files. It was then recognised that these parts could be stored in a common

Design goal

In this article we describe an application programming interface (API) to NONMEM that gives the programmer a clearly defined tool for communication with NONMEM. We have chosen to call the API Perl-speaks-NONMEM (PsN).

NONMEM is flexible and has many features for single and multiple model fits, but it does not exist a direct way of using its computational power in programs that need to access NONMEM’s output and to make changes in its model parameters or settings. Still, since NONMEM is the most

Choice of programming language

As the name implies, Perl-speaks-NONMEM is written in the programming language Perl [7] which is available on all major computer platforms including Microsoft Windows®, Sun Solaris® and Linux. Perl has many strengths among which some are: (i) speed of text processing; (ii) platform independence; (iii) compilation on-the-fly—Perl is an interpreted language. Interpreted languages can never be as fast as compiled but they can compensate much of this overall speed loss with optimized built-in

Status report

The current stable version of PsN is 2.0 and can be obtained for free at http://www.farmbio.uu.se/PKPD/PsN/. The programming library is intended to be easy to use and to supply the user with methods for tasks that performed by hand or programmed from start would take a lot of time. In Fig. 5, a small script for running a bootstrap is shown. This same script coded without the help of PsN would have been much longer. A walk-through of the code can be found in Appendix A.

Lessons learned

Computer methods and programs that are developed in the academy often start as a small scale project of one researcher. If other people begin to use the method in their research and resources exist for further development, the size and complexity of the once small program may grow very fast. As we have experienced during our time of PsN development, time, resources and pain can be saved by trying to see the big picture from the beginning. Tools like UML [9] can help creating the framework for

Future plans

The bootstrap script in Fig. 5 is just a very simple example of a tool that can be built using PsN. We are currently developing a set of methods based on PsN and intended for the end user of NONMEM and not primarily developers. Possible features include functionality for running bootstrap, log-likelihood profiling, case-deletion diagnostics and step-wise covariate model building. The intention is also to support the use of one tool within another, e.g. to use the bootstrap within a stepwise

Acknowledgements

This work was funded by the Swedish Foundation for Strategic Research, Stockholm, Sweden.

References (9)

  • L.B. Sheiner et al.

    Modelling of individual pharmacokinetics for computer-aided drug dosage

    Comput. Biomed. Res.

    (1972)
  • L. Aarons

    Software for population pharmacokinetics and pharmacodynamics

    Clin. Pharmacokinetics

    (1999)
  • E.N. Jonsson et al.

    Automated covariate model building within NONMEM

    Pharm. Res.

    (1998)
  • U.S. Department of Health and Human Services, Food and Drug Administration, Guidance for Industry, Popul. Pharmacokine....
There are more references available in the full text version of this article.

Cited by (600)

View all citing articles on Scopus
View full text