0% found this document useful (0 votes)
13 views19 pages

NONMEM Tutorial - Part II

NONMEM tutorial - part II

Uploaded by

Khanh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views19 pages

NONMEM Tutorial - Part II

NONMEM tutorial - part II

Uploaded by

Khanh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Citation: CPT Pharmacometrics Syst. Pharmacol. (2019) XX, 1–19; doi:10.1002/psp4.

12422

TUTORIAL

NONMEM Tutorial Part II: Estimation Methods and


Advanced Examples
Robert J. Bauer1,*

In this second tutorial on NONMEM, the examples of typical pharmacokinetic/pharmacodynamic modeling problems that
occur in the pharmaceutical field will be presented, which the reader can use as a template for his or her own modeling
endeavors. Each of the problems presented is challenging in some way, and the logic behind setting up each problem is dis-
cussed. Logical concepts of the problem itself as well as the technical aspect of how to set it up in NONMEM are described
and demonstrated. The concepts behind the various estimation algorithms will first be described to allow the user a better
understanding of how to use them.

These estimation methods include:1 each subject, a linearized, often weighted, extended least-­
squares assessment of the contributions of within-­subject
The first-order (FO) method (guide II1) and between-­subject variability is made (FO), or an inte-
The FO conditional estimation (FOCE)/Laplace method gration of the conditional density over all values of ETAs
(guide VII1) must be performed, for a given set of THETAs, OMEGAs,
Various additional methods in NONMEM are (intro71): and SIGMAs (FO/FOCE/Laplace and EM methods). This in-
Monte Carlo importance sampling (IMP) expectation max- tegration is computationally difficult to do, and the various
imization (EM) methods solve this problem in different ways.
Markov Chain Monte Carlo (MCMC) stochastic approxima-
tion expectation maximization (SAEM) FIRST METHOD WAS FO (1970s2; GUIDE II1)
Iterative two stage (ITS). Approximate EM method
MCMC Bayesian analysis The FO was the first method used in population PK anal-
ysis that could simultaneously discern the variability of
measured levels of drug or drug response (residual vari-
The examples consist of the following:
ance) within a subject and the variability of PK/pharmaco-
dynamic (PD) parameters between subjects (intersubject
Example 1: Pharmacokinetic (PK) model with covariates variance). The FO method could determine how popula-
using IMP, SAEM, and Bayesian analysis methods tion PK/PD parameters related to patient characteristics,
Example 2: Modeling data that are below the limit of quan- even when there were few data points per subject. FO
titation (LOQ) analysis could be accomplished using the computing
Example 3: Modeling pharmacokinetic categorical re- power and memory that was available at the time. The FO
sponse data method optimizes an objective function with a linearized
Example 4: Using ordinary differential equation (ODE) solv- projection of intersubject and intrasubject effects with-
ers to model a basic target-mediated drug disposition out explicitly evaluating the integral of the joint density for
model each subject and hence evaluates very quickly.
Example 5: Analyzing data modeled with multiple levels of
mixed effects FOCE (1992) METHOD (GUIDE VII1)
Example 6: Modeling a mixture of subpopulations of
parameters Although the FO method was fast, it was very approx-
Example 7: Modeling periodically collected urine samples imate. Sometimes inaccurate assessments occurred if
­residual error and/or intersubject variability were large.
The FOCE, although also an approximate method, was
BASIC PRINCIPLES AND HISTORY OF THE VARIOUS more accurate for a larger variety of problems. In FOCE
METHODS mixed effects modeling, an integral over all possible in-
Goal of nonlinear mixed effects methods dividual parameter values (ETAs, or random effects) is
The common goal of FO and EM methods is to determine taken into consideration for each subject’s joint density of
the set of fixed effects THETAs, OMEGAs, and SIGMAs that observed data and ETAs when determining the best fixed
best fit the population data, considering all possible val- effects (THETAs, OMEGAs, and SIGMAs). As mentioned
ues of individual parameters or ETAs (random effects). For previously, this integration is computationally expensive.

1
Pharmacometrics R&D, ICON Clinical Research LLC, Gaithersburg, Maryland, USA. *Correspondence: Robert J. Bauer (robert.bauer@iconplc.com)
Received: January 16, 2019; accepted: April 9, 2019. doi:10.1002/psp4.12422
NONMEM Tutorial II
Bauer
2

To alleviate the computational expense, the FOCE eval- HOW IMP AND SAEM EXPECTATION STEPS ARE
uates the mode of the joint density (most likely values of IMPLEMENTED
ETAs) and the first order approximation of variances of IMP: Importance Sampling Algorithm
ETAs. An approximate integral using the Gaussian func- In IMP, the expectation step is performed by creating
tion centered at the mode of the joint density with the ­random normal deviates of ETAs and evaluating the con-
approximate variance is used as a linear approximation ditional density (joint density normalized to integrate with
of the integral of the joint density with respect to ETAs respect to ETAs to the value of 1) at these ETAs for each
and can be easily calculated. These integrations must be subject. The normal random sampler is typically centered
done for the data of each individual separately, and so at the mode or the mean of the conditional density and a
FOCE takes longer to evaluate than the FO method. Thus, variance that approximates the variance of the conditional
unlike FO, which linearizes the intersubject and within-­ density; hence it samples in the “important” region of the
subject variability, FOCE evaluates the intersubject effect conditional density. On the first iteration, this information
accurately while linearizing the within-­subject variability is not available, so the mode and its FO approximation of
with its Gaussian function approximation. the variance (called mode a posteriori (MAP) estimation,
as is done in FOCE) is obtained and used as the mean
SECOND-­ORDER CONDITIONAL ESTIMATION and variance for the sampler. On subsequent iterations,
(LAPLACE, 1992) METHOD (GUIDE VII1) the MAP estimation may be repeated to obtain the nor-
mal random sampler parameters, or the conditional Monte
The Laplace method is the same as FOCE except that it Carlo mean and conditional Monte Carlo variance ob-
uses a second derivative assessment of the variance of the tained from the IMP of the previous iteration may be used.
joint density with respect to the ETAs. The Laplace method With this method, weighted averages of conditional means
is used when nonnormal densities are used to model some and variances of individual parameters (or ETAs) as well
of the observed data or the prediction model imparts a high as accurate (with stochastic variation) assessments of the
degree of nonlinearity to the joint density of the individual objective functions for each individual. The weight to each
parameters. ETA sample is proportional to the goodness of fit of the
sample relative to the probability of the sampler to select
MONTE CARLO EM METHODS (2000s3–5) that sample, and it reflects the properties of the exact con-
ditional density. Usually 300–1,000 random samples are
These are exact methods that are able to analyze complex used for each subject, and about 50–200 iterations are
PK/PD problems with a greater incidence of success than required to approach the maximum likelihood population
FOCE. As in FOCE, the integral over all possible individual parameters.
parameter values (ETAs, or random effects) is taken into
consideration when determining the best fixed effects SAEM: MCMC Sampling Algorithm
(THETAs, OMEGAs, and SIGMAs). The EM algorithms, As in IMP, random samples are generated from normal
however, perform a Monte Carlo integration to explore proposal densities. Instead of centered at the mode (or
­
the entire ETA space and provide a more accurate (but mean) of the conditional density, the proposal density is
more stochastic) assessment of the integral of the joint centered at the previous sample position. New samples
density. This is called the “expectation step.” Although are accepted with a probability that is related to the condi-
the Monte Carlo expectation step can be computation- tional density (goodness of fit) at the particular ETA sample
ally expensive, and/or highly stochastic, the update of the ­position. The variance of the proposal density is adjusted
fixed effect parameters can be efficiently carried out with to maintain a certain average acceptance rate. This method
single-­step algorithms if the statistical model is struc- requires more elaborate sampling strategy but is useful for
tured in a certain way (PHI/MU modeling). This update highly nonnormally distributed conditional densities.
of the fixed effects is called the “maximization step.” The Unlike IMP that evaluates the problem in a single mode, the
Monte Carlo EM can be more accurate than FOCE for SAEM requires two modes of estimation. In the first mode,
sparse data,3,4 although less precise than FOCE because SAEM evaluates an unbiased but highly stochastic approx-
the results have stochastic variability. It takes longer than imation of individual parameters (pseudo-­expectation, usu-
FOCE for simple PK/PD problems (examples 1–3 and 6 ally two samples per individual). Population parameters are
in this tutorial) but can be more efficient than FOCE for updated from individual parameters by single-­iteration max-
complex PK/PD problems (such as example 4). By sim- imization steps that are very stable and statistically proven
ple, this means analytical, linear PK problems and ana- to improve the objective function (usually in 300–2,000 iter-
lytically evaluated PD problems, with perhaps no more ations). In the second mode, individual parameter samples
than six model parameters to be estimated. Complex PK/ from previous iterations are averaged together, converging
PD problems are those that require ODEs or problems toward the true conditional individual parameter means and
with more than six model parameters to be estimated. variances. This leads to population parameters converging
Efficiency reduces considerably when the model cannot toward the maximum of the exact likelihood. The SAEM
be expressed in a particular fixed/random effect (PHI/ is not able to assess an objective function that can be used
MU) format (explained in the MU Referencing section). in hypothesis testing or for assessing final population good-
Importance sampling and SAEM are the two efficient ness of fit. The objective function and standard errors are
Monte Carlo EM methods available in NONMEM. best obtained by one or a few iterations of a final IMP step

CPT: Pharmacometrics & Systems Pharmacology


NONMEM Tutorial II
Bauer
3

with population parameters fixed at the final SAEM values. Usefulness and efficiency of each method
This is expectation-­only IMP because the maximization of The following lists the general properties of each
population parameters has already been achieved by the method and for what types of problems can they be
SAEM step. most useful. It should be pointed out that these are just
general guidelines, so the bullet points are intended to
APPROXIMATE (LINEARIZED) LIKELIHOOD EM be general rules of thumb, and each problem must be
METHOD: ITS (19842) assessed individually. It is reasonable to use a trial-­and-­
error ­approach, and some methods can be improved in
This is an approximate conditional method that is able to efficiency or accuracy by modifying their options. Also,
analyze complex PK/PD problems with great efficiency and there is considerable overlap in the usefulness of each of
incidence of success. Although it is more accurate than these methods for various types of problems as we shall
FO, it is not as accurate as FOCE (NONMEM7 Technical see in the examples.
Guide1,3) when data are not rich (a subject is rich in data
when there are many more data points than ETAs being Monte Carlo IMP EM
estimated) and/or residual variability of data is large. The
efficiency reduces considerably when the model cannot be • Complex PK/PD problems with ODEs and/or many
expressed in a particular fixed/random effect (PHI/MU) for- parameters
mat (MU Referencing section). This method is considered a • Sparse (fewer data points per subject than ETAs to be
deterministic EM method. The ITS evaluates the conditional estimated) or rich data
mode (not mean!) and first order (expected) approximation • Can be less accurate than SAEM with highly categorical
of the variance of parameters of individuals by maximiz- data or very sparse data
ing the conditional density. This integration (expectation) • Can track progress of improvement in true objective
step is the same as in FOCE. The parameters are updated function with each iteration
using the mean of the conditional modes and approximate • Results can vary stochastically, typically by about 25% of
individual variances, and therefore it is less accurate than SE
the Monte Carlo EM methods. They are updated by single-­ • Can handle full OMEGA blocks well
iteration maximization steps that are very stable (usually in • Less efficient when some or many THETAs may not be
50–100 iterations). For rich data, ITS is almost as accurate MU referenced (described later)
as FOCE but much faster.

Full OMEGA blocks in EM analysis SAEM


Full OMEGA blocks are more easily updated by EM
methods than by FOCE. They are preferred over diagonal • Categorical data
OMEGAs in EM problems. Having off-­diagonal elements • Very sparse, sparse, or rich data
does not necessarily make EM methods less stable, so • Complex PK/PD problems with many parameters (may
there is no need to fix off-­diagonal elements to 0 even sometimes reach true objective function only within ±10
though the standard error may be greater than the esti- units of optimum and can take longer than IMP)
mate. This is because every OMEGA element (including • Cannot assess true objective function during its prog-
off-­diagonal elements) is updated by evaluating the sam- ress, must finish analysis with IMP assessment of objec-
ple variance of the many randomly assessed individual tive function
parameters. Thus, if the covariance of clearance~vol- • Results can vary stochastically, typically by about 25% of
ume CL~V is reported in the NONMEM output as, for SE
example, mean +/- standard error, 0.0018 ± 0.0113, this • Can handle full OMEGA blocks well
is an unconstrained assessment that this particular off-­ • Less efficient when some or many THETAs may not be
diagonal element is not statistically different from 0. MU referenced
Performing a reassessment of the problem by fixing this
off-­diagonal element to 0 is not necessary for stabili-
ITS
zation of the problem, as is sometimes necessary with
FOCE, where the off-­diagonal element is assessed by
a regression process using derivatives and could chal- • Rich data
lenge the stability of the estimation. If the original anal- • Rapid, exploratory method
ysis was performed with FOCE, and if the off-­diagonal • Can be used as preanalysis to facilitate IMP or SAEM
element was fixed to 0 because FOCE had round-­ off • Requires less fuss with adjusting options than SAEM or
error problems in estimation, or the $COV step could not IMP
complete, then allow the off-­diagonal to be estimated • Results are highly reproducible to ±4 digits
when doing EM. Then, only if the EM objective function • Can have large bias or instability for some problems
is highly variable, or $COV step reports non-­p ositive-­ • Can handle full OMEGA blocks well
definite issues, consider fixing off-­ diagonal elements • Less efficient when some or many THETAs may not be
back to 0. MU referenced

www.psp-journal.com
NONMEM Tutorial II
Bauer
4

FOCE LTVCL= LOG(THETA(1))+THETA(2)*LOG(AGE/50)


MU_5= LTVCL
• Rich and semirich data LTVV=LOG(THETA(3))
• Does not require MU referencing MU_3=LTVV
• Good for many THETAS with no ETAs associated with CL=EXP(MU_5+ETA(5))
them
V=EXP(MU_3+ETA(3))
• More accurate than ITS
• Requires less fuss with adjusting options than SAEM or
IMP In the above example, LTVCL stands for natural log of
• Results are highly reproducible to ±4 digits typical value clearance. Because the individual parameters
• Does not handle full OMEGA blocks as easily as EM CL and V are log-­normally distributed (exp(ETA)), the MUs
• If convergence criterion reduced (along with reducing are the log of the typical values so that they are arithmetically
precision criteria for ODE problems), then time of analysis associated with the ETAs. Even better, one may impose a
can be reduced by twofold to threefold in some cases. linear relationship between MU and THETA:
Using MU referencing and the FAST option, additional in-
creases in speed occur. LTVCL= THETA(1)+THETA(2)*LOG(AGE/50)
MU_5= LTVCL
In theory, all problems can be solved by EM methods. For LTVV=THETA(3)
Monte Carlo EM methods to be efficient, however, they rely MU_3=LTVV
on a particular statistical structure of the population analysis
CL=EXP(MU_5+ETA(5))
problem (gray box process) in which fixed effects parameters
(THETAs) are involved only in defining the mean (mu) of the V=EXP(MU_3+ETA(3))
normal population distribution of individual parameters (PHI).
That is, most THETAs need to be referenced in a PHI/MU In such cases, THETA(1) is no longer the typical value
format (MU referencing). If the mu-­referencing process is too of CL, but the logarithm of the typical value (LTVCL) of CL,
complicated for a problem and/or there are many parameters just as MU_5 is. The initial THETA values on the $THETA
to be estimated that cannot be or are not easily MU refer- record would need to be log transformed. Any former
enced, then FOCE/Laplace would be the preferred method of lower bound of 0 should not be included, as the log() im-
analysis of such a problem. poses a natural 0 boundary on the original value. One can
avoid transposing the inputted THETAs while still having
MU referencing linear MU referencing by using the $THETAI and $THETAR
THETAs that define typical values of individual parameters record (intro71).
are “mu related” (Greek letter μ to indicate mean of individ- Linear MU referencing increases the robustness of the EM
ual parameters). So, THETAs that are associated with ETAs algorithms to converge toward a minimum, as the THETAs will
can be MU referenced. Fixed effect THETAs that have no then be updated by one-­step linear regression rather than by
intersubject variability associated with them but serve as one-­step nonlinear regression. Furthermore, lower ISAMPLE
a shared value among subjects are not mu related. To best (≤3) values are needed for stable updates with SAEM with
utilize EM methods, it is best to create MU reference equa- linear MU referencing. IMP is not as sensitive in this regard
tions in NMTRAN to describe these mu relations. because of its typically higher ISAMPLE value (≥300).
The user supplies information on how THETA parameters Additional information about MU referencing and their
are associated arithmetically with the ETAs and individual rules are given in Supplementary Materials S1—Part A.
parameters:
Phi_j = mu_j(theta) + eta(j) MCMC BAYESIAN ANALYSIS
For each parameter j that has an ETA associated with it,
and mu_j is a function of THETA. The goal of MCMC full Bayesian analysis is to obtain a sam-
The association of one or more THETAs with ETA(1) must ple distribution of probable population parameters (poste-
be identified by a variable called MU_1. rior distribution), which is unlike the goal of maximization
For ETA(2), the variable is MU_2, etc. methods such as FO, FOCE/Laplace, and EM, which seek
For example, suppose the original code is to find point (single-­valued) estimates of population param-
eters that best fit the data. Usually 10,000–30,000 samples
TVCL=(THETA(1)*(AGE/50)**THETA(2)) are required (intro7.pdf1,6). The samples are not statistically
independent, but when the analysis is properly performed,
CL=TVCL*EXP(ETA(5))
they are uncorrelated overall.
TVV=THETA(3) Unlike maximization methods (FO, FOCE/Laplace, EM),
V=TVV*EXP(ETA(3)) maximum likelihood parameters are not obtained, but with
problems of sufficient data, the sample mean parameters
This code can be modified to include intermediate vari- are similar to maximum likelihood values. Also, a maximum
ables MU_x, which inform NONMEM of the relationship of likelihood objective function is not obtained, but a distri-
certain THETAs with certain ETAs: bution of joint probability densities is obtained, from which

CPT: Pharmacometrics & Systems Pharmacology


NONMEM Tutorial II
Bauer
5

95% confidence bounds can be constructed and tested for The following examples make use of some of the con-
overlap with those of alternative models. Criteria such as cepts described previously.
Bayes information criterion can also be used for hypothesis
testing. EXAMPLE 1: PK MODEL WITH COVARIATES USING
Although the FOCE and EM methods obtain only IMP, SAEM, AND BAYESIAN ANALYSIS METHODS
­approximate SEs to the parameters at evaluated point esti-
mates using Fischer information matrix process, the MCMC In the previous tutorial, example 504.ctl was used to
Bayesian methods average the many samples of population demonstrate how the effect of covariates could be as-
parameters with frequencies in proportion to their ability sessed on various PK parameters using the FOCE with
to explain the data, and also, empirical SEs are evaluated interaction (FOCEI) method. This same model is easily
from the variance of these parameters. With these proper- rendered for EM analysis by identifying for NONMEM the
ties, MCMC Bayesian analysis can be used as a substitute “MU” parameters, the arithmetic means associated with
for bootstrap. MCMC Bayesian analysis takes longer than the random effects. This is done conveniently for this ex-
maximization analysis but provides more information and is ample by log transforming the typical values. Although not
faster than bootstrap. Use MCMC Bayesian analysis to em- essential, THETA(1) and THETA(2) are reparameterized as
bellish information on your final model. the log of the original parameters, so as to express the
All problems can be solved by MCMC Bayesian analy- MUs completely linearly in all THETAs, as recommended
sis. In practice, the more the problem is linearly MU mod- earlier, and removing the need for placing lower bounds of
eled, the more the Bayesian analysis can rely on the efficient 0 on THETA(1) and THETA(2) (Supplementary Materials
Gibbs sampling method (gray box process). The fewer pa- S2, 504_its.ctl, 504_saem.ctl, 504_foce.ctl). Please see
rameters that are linearly MU modeled, the more Bayesian Table 1, code item 1, showing how the logarithm of the
analysis relies on the less efficient but general Metropolis-­ typical values are defined and associated with the MU_
Hastings sampling method (black box process) and poten- variables.
tially can be less stable. However, the no-­u-­turn Hamiltonian For example 504_its.ctl, the ITS is used. The $EST record
(NUTS) Metropolis-­ Hastings sampling method references for this is listed in Table 1, code item 2. Although more ap-
7,8 can be very efficient if analytical derivatives are supplied proximate than FOCE, ITS is very fast and can be used as a
(Supplementary Materials S1—Part B). preliminary analysis. For example 504_saem.ctl, the SAEM
method is used, followed by IMP to obtain the final objec-
Prior information tive function (Table 1, code item 3). A convenient tool in
Prior information of population parameters is important NONMEM is available in which a subsequent $EST step uses
for MCMC Bayesian analysis in order for them to be sta- as initial values the final estimates of the immediately previ-
ble. Priors to OMEGAs are the most important, and there- ous $EST step. Here, the SAEM estimation is followed by the
fore it is best to supply at least weakly informative priors evaluation of the marginal likelihood objective function using
to them. Although prior information may also be added IMP’s expectation step only (EONLY = 1), but not allowing
to maximum likelihood (FO, FOCE, EM) estimations in the IMP step to perform maximization updates on the fixed
NONMEM and could be useful for supplying informative effects, retaining the fixed effects values at the final answer
priors based on previous studies, the maximization meth- of the SAEM method. Furthermore, the conditional mean and
ods have sufficient statistical power for obtaining their variance of the individual parameters from the last step of the
goals of point estimates to not require uninformative or SAEM are used as the parameters to the importance sam-
weakly informative priors for most problems. The MCMC pler’s proposal density (MAPITER = 0); that is, MAP estima-
Bayesian analysis, however, has less statistical power to tion is not necessary for the first iteration because we have
obtain its goal because it does not seek just point esti- information from a previous estimation step. Subsequent
mates of the population parameters but their entire poste- IMP iterations borrow the conditional mean and variance of
rior distribution. A general rule in statistics is that the more the previous iteration for the proposal density parameters.
you ask of a fixed set of data, the less power there is for Five iterations of IMP are requested to obtain a stochastic
each piece of information requested. See Supplementary sampling of the objective function value so one can get a
Materials S1—Part C on how to provide prior information sense of the extent of the Monte Carlo noise in the result.
in NONMEM. An FOCE assessment was included to compare the re-
sults (504_foce.ctl). Note that the final parameters from the
Termination testing ITS, SAEM/IMP, and FOCE are very similar, with the ITS ob-
For EM analyses (IMP, SAEM, BAYES), because of the sto- jective function nearly identical to the FOCE, although the
chastic nature of the results, a deterministic method of IMP objective function is slightly different from the FOCE
stopping the analysis when the values change by no more result by about eight units (Table 2). When the FOCE ob-
than the third digit cannot be used because the values jective function is evaluated at the population results of
will always be changing stochastically at that precision. SAEM/IMP, the FOCE objective function differs by about
Instead, a statistical test is performed on whether the gen- two units. This suggests a small amount of nonlinearity
eral change in the parameter varies by more than the sto- of the conditional density, that is, the conditional den-
chastic noise. See Supplementary Materials S1—Part D sity is not exactly normally distributed, and this results in
on how to control the statistical test for convergence on slightly different assessments of the objective function as
Monte Carlo estimation methods. well as slightly different positions, although the population

www.psp-journal.com
NONMEM Tutorial II
Bauer
6

parameters are not statistically different between SAEM random (stochastic) variations remain. Supplementary
and FOCEI. Thus, for this example, the FOCEI and SAEM Materials S1—Part E shows how this example may be
results are statistically similar, but one should always use rendered for Bayesian analysis.
the objective function from the same analysis method For Monte Carlo methods, stochastic reproducibility of
when making statistical comparisons between models. results can be improved by setting RANMETHOD = P to
The number of samples collected for each subject allow reproducibility during parallelization of a problem. The
ISAMPLE is by default 2 for SAEM, but should be increased AUTO = 1 feature performs additional complex analysis and
up to 10 if data are sparse or data are nonnormally dis- decisions, and using this feature may result in lack of sto-
tributed, such as categorical data or below-­detection data. chastic reproducibility.
For IMP, ISAMPLE should be increased from its default of Notice that the MATRIX = R option is generally requested
300 when there are many ETAs or the objective function in these examples. The R matrix is the Fisher information
has large stochastic fluctuations. When there are fewer data matrix constructed from the second derivative of the ob-
points than there are ETAs to be estimated (sparse data) or jective function with respect to the various parameters es-
data are categorical, then DF (degrees of freedom) should timated. The more approximate S matrix (score matrix) is
be set to a nonzero number to use the t-­distribution sam- constructed from the first derivatives of each individual’s ob-
pler and/or decrease the acceptance rate IACCEPT from jective function contribution with respect to the various pa-
the default value of 0.4 to about 0.2. Alternatively, option rameters estimated and can be requested with MATRIX = S.
AUTO = 1 may be selected as is done for some of these The variance–covariance of the estimates will be evaluated
examples. This is an option that requests NONMEM to as R−1 or S−1, respectively. If no MATRIX option is provided,
make decisions about ISAMPLE for SAEM and IACCEPT, the variance–covariance is evaluated as R−1S R−1. The
DF, and ISAMPLE for IMP for each subject. Furthermore, S matrix is more quickly evaluated, which may be signifi-
because SAEM uses an MCMC algorithm so that samples cant especially for ODE-­type problems (such as example 4
of the ETAs generated are correlated, the correlation inter- below), and is sufficiently accurate if there are more subjects
val CINTERVAL is also evaluated by AUTO = 1 to assure (preferably about two times more) than the dimension of the
that when NONMEM tests for convergence, the appropriate variance–covariance. If computation time is not a concern,
spread of iterations is considered when assessing whether I prefer MATRIX = R as it is more consistent with other sta-
all parameters no longer change systematically and only tistical software.

Table 1 Control stream code segments showing relevant code

Item Code
Example 1
1 $PK

LTVCL=THETA(1)+LOG(WT/70)*THETA(3)
+LOG(AGE/50)*THETA(5)+SEX*THETA(7)
LTVV=THETA(2)+LOG(WT/70)*THETA(4)
+LOG(AGE/50)*THETA(6)+SEX*THETA(8)
MU_1=LTVCL
MU_2=LTVV
CL=EXP(MU_1+ETA(1))
V=EXP(MU_2+ETA(2))
2 $EST METHOD=ITS INTERACTION AUTO=1 PRINT=20 NOABORT
3 $EST METHOD=SAEM AUTO=1 NITER=500 PRINT=20
$EST METHOD=IMP EONLY=1 PRINT=1 NITER=5 ISAMPLE=1000 MAPITER=0
Example 2
4 $PK
MU_1 = THETA(1)
MU_2 = THETA(2)
MU_3 = THETA(3)
MU_4 = THETA(4)
CL = EXP(MU_1 + ETA(1))
V1 = EXP(MU_2 + ETA(2))
Q = EXP(MU_3 + ETA(3))
V2 = EXP(MU_4 + ETA(4))
(Continues)

CPT: Pharmacometrics & Systems Pharmacology


NONMEM Tutorial II
Bauer
7

Table 1 (Continued)

Item Code
5 $ERROR
IEPRED=A(1)/S1
LLOQ=-3.5
SD = THETA(5)
; DEL can be 10E-10 or smaller
DEL=1.0E-30
; The following coding for LOG() prevents numerical errors
; from occurring when F<=0
IPRED = LOG(ABS(IEPRED)+DEL)
IF(COMACT==1) PREDV=IPRED
DUM = (LLOQ - IPRED)/SD
; Adding DEL to CUMD prevents it from becoming 0, which is not
good when NONMEM evaluates -2*LOG(CUMD)
CUMD = PHI(DUM)+DEL
TYPE=1
IF(DV<LLOQ) TYPE=2
IF(MDV==1) TYPE=0
IF(TYPE.EQ.2) DV_LOQ=LLOQ
IF (TYPE.NE. 2.OR.NPDE_MODE==1) THEN
F_FLAG = 0
Y = IPRED + SD * ERR(1)
ENDIF
IF (TYPE.EQ. 2.AND.NPDE_MODE==0) THEN
F_FLAG = 1
Y = CUMD
MDVRES=1
ENDIF
6 $EST METHOD=IMP LAPLACE INTERACTION AUTO=1 PRINT=5 RANMETHOD=S2
Example 3
7 $ERROR
IPRED=A(2)/V
EXPP=THETA(4)+IPRED*THETA(5)
; Put a limit on this, as it will be exponentiated,
; to avoid floating overflow
IF(EXPP.GT.40.0) EXPP=40.0
IF (TYPE.EQ.0) THEN
; PK Data
F_FLAG=0
Y=F+F*ERR(1); a prediction
ELSE
; Categorical data
F_FLAG=1
; IF EXPP>40, then A>1.0d+17, A/B=1, and Y=DV
AA=EXP(EXPP)
B=1+AA
Y=DV*AA/B+(1-DV)/B ; a likelihood
ENDIF
(Continues)

www.psp-journal.com
NONMEM Tutorial II
Bauer
8

Table 1 (Continued)

Item Code
Example 4
8 $DES
DADT(1) = -(K10+K12)*A(1) + K21*A(2) - VM*A(1)*A(3)/(A(1)+KM)
DADT(2) = K12*A(1) - K21*A(2)
DADT(3) = -(VM-K30)*A(1)*A(3)/(A(1)+KM) - K30*A(3) + K03
9 $PK

A_0(3)=K03/K30
10 $ERROR
ETYPE=1
IF(CMT.NE.1) ETYPE=0
CP=A(1)/S1
CR=A(3)/S3
IPRE=CP
IF(CMT.NE.1) IPRE=CR
Y = IPRE + IPRE*ETYPE*EPS(1) + IPRE*(1.0-ETYPE)*EPS(2)
Example 5
11 $ABBR REPLACE ETA(OCC_CL)=ETA(5,7,9)
$ABBR REPLACE ETA(OCC_V)=ETA(6,8,10)
12 $LEVEL
SID=(3[1],4[2])
13 $PK

CL=EXP(MU_1+ETA(1)+ETA(3)+ETA(OCC_CL))
V=EXP(MU_2+ETA(2)+ETA(4)+ETA(OCC_V))
14 ;Individual omegas (1,2)
$OMEGA BLOCK(2)
.1
-.0001 .1
;SID OMEGAS (3,4)
$OMEGA BLOCK(2)
.3
-.0001 .3
; inter-occasion omegas for occasion 1 (5,6)
$OMEGA BLOCK(2)
.03
-.0001 .03
; inter-occasion omegas for occasion 2 and 3
; SAME(n) means repeat block structure n times;
; and omega parameters used for occasions 2 and 3 are shared
; with those of occasion 1.
$OMEGA BLOCK(2) SAME(2)
Example 6
15 $PK

VCM=DEXP(MU_1+ETA(1))
K10M=DEXP(MU_2+ETA(2))
VCF=DEXP(MU_3+ETA(3))
K10F=DEXP(MU_4+ETA(4))
Q=1
IF(MIXNUM.EQ.2) Q=0
V=Q*VCM+(1.0-Q)*VCF
K=Q*K10M+(1.0-Q)*K10F

CPT: Pharmacometrics & Systems Pharmacology


NONMEM Tutorial II
Bauer
9

Table 1 (Continued)

Item Code
16 ;Initial OMEGA block 1, for sub-population 1
$OMEGA BLOCK(2)
.04;[p]
.01; [f]
.027; [p]
;Initial OMEGA block 2, for sub-population 2
$OMEGA BLOCK(2)
.05; [p]
.01; [f]
.06; [p]
Example 7
17 $PK

CL=EXP(MU_1+ETA(1))
CLR=EXP(MU_3+ETA(3))
F2=CLR/CL
18 $ERROR
CP=A(1)/V
UVL=UVOL
IF(UVL<=0.0) UVL=1.0
CU=A(2)/UVL
IF(CMT==1) THEN
IPRE=CP
W=IPRE+1.0E-10
Y=IPRE + W*EPS(1)
ELSE
IPRE=CU
W=IPRE+1.0E-10
Y=IPRE + W*EPS(2)
ENDIF

EXAMPLE 2: MODELING DATA THAT ARE BELOW THE See Supplementary Materials S3 for the complete con-
LOQ trol stream of this example. The first part of the control stream
ad3tr4_loqb_lap.ctl (Laplace method) and ad3tr4_loqb_imp.ctl
The following example models data that are below the LOQ (IMP method) consists of a typical setup with MU referencing
(see ref. 9). Normally distributed, below quantifiable limits are (Table 1, code item 4). Consideration to modeling the LOQ data
given the following likelihood evaluation: is confined to the $ERROR block (Table 1, code item 5). The indi-
vidual predicted value (IPRED) and standard deviation (SD) of the
( LOQ−f )∕sd
residual error are defined, followed by evaluation of the Gaussian
∫−∞
p(x < LOQ) = exp ( − y 2 ∕2)dy = Φ((LOQ − f )∕sd)
function PHI(), the result stored in the variable CUMD (cumulative
distribution). In addition to IPRED, it is desired to store the pop-
For data below the LOQ, their data likelihood contribution ulation predicted value, which is essentially the value of IPRED
is expressed as the probability that the data value is nor- evaluated when ETA = 0, and this is signaled by NONMEM on
mally distributed and below the LOQ. Because this partial the occasion that COMACT = 1, which is saved in the variable
integral of the normal density is not itself a normal density, PREDV (population prediction variable). Normally, the NONMEM
NONMEM must be informed by setting F_FLAG = 1 that the reserved variable PRED (population prediction) will be automat-
returned Y value is not the predicted function but is a user-­ ically calculated for the user when the data are the typical nor-
defined data likelihood for that datum. As we shall see, the mally distributed type and calculating PREDV is unnecessary.
F_FLAG = 1 option may be generally used to allow the user However, when data are modeled with a user-­specified likeli-
to provide any data likelihood that is not normally distrib- hood, the PRED value will be set to an uninformative value of 1.
uted. In such cases, the Laplace option must be set. One may wish to use the more informative PREDV.

www.psp-journal.com
NONMEM Tutorial II
Bauer
10

In this particular setup, any observed value DV (de-

BAYES, Bayesian analysis; FOCE, first-­order conditional estimation; FOCEI, FOCE with interaction; IMP, importance sampling; ITS, iterative two stage; OBJ, objective function; SAEM, stochastic approxima-
Table 2 Final parameter estimates and standard errors for Example 1: Statistical assessment of covariates added to a base pharmacokinetic model using FOCE, importance sampling, SAEM

pendent variable) that is less than the LOQ (in this case

FOCE OBJ = 1,060.360

FOCE OBJ = 1,061.227


the log(LOQ) = LLOQ, because the log(DV) is fitted in the
model) will be designated TYPE = 2, and those data above
1,058.304
1,058.542

1,051.790

661.634

19.475
OBJ

LOQ are designated TYPE = 1. During estimation (when


NPDE_MODE = 0, that is, normalized prediction distribu-
tion error (NPDE) is not being calculated) when TYPE = 1,
NONMEM is informed by setting F_FLAG = 0 that the re-
turned Y value is to be treated as the predicted value to a
normally distributed dependent variable, which is the usual
OMEGA(2:2)

interpretation of data. When TYPE = 2, NONMEM is in-


0.046
0.049
0.047
0.047

0.015
0.014
0.014

0.014
formed by setting F_FLAG = 1 that the returned Y value is
to represent the likelihood of the datum itself, which in this
case is CUMD.
OMEGA(2:1)

As of NONMEM 7.4, setting MDVRES = 1 (MDVRES stands


−0.002
0.0003

0.008
0.008

0.008
0.001
0.001

for MDV (missing dependent variable indicator) during re-


0.01

sidual error analysis) for the nonnormal data (F_FLAG = 1)


assures that weighted residual diagnostics (CWRES10) are
calculated for the collection of normal data (F_FLAG = 0) in
OMEGA(1:1)

that subject and excludes from the weighted residual eval-


0.009
0.009

0.009
0.008
0.032

0.029
0.031
0.03

uation any data for which MDVRES = 1 (or MDV = 1). In


previous versions, if there was at least one nonnormal datum
in the collection of data considered for weighted residual
assessment, no weighted residuals for any of the data for
SIGMA(1:1)

0.008
0.055
0.050
0.050
0.050

0.007
0.007
0.007

that subject were calculated.


Normalized prediction distribution error (NPDE) values
for LOQ data may also be calculated (based on refs. 11–
13). To implement this, use the NPDE_MODE switch and
THETA8

−0.054
−0.055

−0.052
−0.057

0.081

0.073

0.073
0.071

set reserved variable DV_LOQ as shown in the previous


code. When NPDE_MODE = 1, NONMEM is executing the
$ERROR block during the evaluation of NPDEs for the items
THETA7

−0.103
−0.101
−0.101

0.063

0.058
0.057

0.057

in the $TABLE records (so, not during estimation), and if the


−0.1

datum is <LOQ (TYPE = 2), then user code should return the
predicted value IPRED just as it does with normal data. In
addition, with DV_LOQ is set, NONMEM knows to use that
THETA6

0.060

0.055
0.048
0.052

0.133
0.135

0.132
0.149

as the “observed value” limit.


Notice that the $TABLE record requests that NPDE values
be generated from ESAMPLE = 1,000 samples. In general,
THETA5

the most extreme value generated in NPDE is limited by


−0.534
−0.544

−0.557
−0.523

0.106
0.103
0.105
0.135

ESAMPLE as follows:
Statistic/Estimation method, and Bayesian analysis methods

1∕ESAMPLE = Φ(NPDE_low)
THETA4

0.208

0.204
0.202
1.321

1.315
1.311

0.25
1.32

so selecting a sufficiently high ESAMPLE is necessary so


that extreme NPDE values are sufficiently detected. Usually
it is sufficient that the NPDE extreme values be −3.09 to 3.09
tion expectation maximization; SE, standard error.
THETA3

0.644
0.671

0.641

0.163

0.165

(default ESAMPLE = 300) to accurately reflect those NPDE


0.66

0.16
0.2

beyond the 95% range (NPDE = −1.96, 1.96) without sig-


nificant truncation. An ESAMPLE of 10,000 will give you a
range of NPDE = −3.72, 3.72.
THETA2

0.044

0.050

0.050
3.464

0.049
3.467

3.467
3.478

A portion of table ad3tr4_loqb_imp.tab is listed in


Table 3. Note that CWRES values for all normal data
exists, but not for records whose DV < LOQ (bolded in
THETA1

Table 3), whereas the NPDE values are calculated for all
0.038
0.039

0.039
1.109
1.112

0.05
1.07

1.07

data records. In Figure 1 one can see how providing ad-


ditional NPDEs from the LOQ data can fill out the lower
x-­regions of a scatter plot.
BAYES
BAYES

FOCEI
FOCEI

(IMP)
(IMP)

The conditional Laplace method is susceptible to end-


SAEM
SAEM

ITS
ITS
Mean

ing the analysis with round-­off errors, as in this example.


SE

The Monte Carlo EM analysis method does not have this

CPT: Pharmacometrics & Systems Pharmacology


NONMEM Tutorial II
Bauer
11

Table 3 A portion of the post hoc results from Example 2 (ad3tr4_loqb_imp.tab): Modeling data that are below the limit of quantitation

ID TIME DV IPRED PRED PREDV CWRES NPDE


1.0000E+00 0.0000E+00 −2.9934E+01 3.0116E+00 2.9972E+00 2.9972E+00 0.0000E+00 0.0000E+00
1.0000E+00 2.0000E−01 2.7061E+00 2.6978E+00 2.7013E+00 2.7013E+00 2.9914E−02 1.2819E−01
1.0000E+00 1.0000E+00 1.4796E+00 1.5042E+00 1.5732E+00 1.5732E+00 −1.5716E−01 1.9934E−01
1.0000E+00 4.0000E+00 −6.6033E−01 −7.0388E−01 −6.2029E−01 −6.2029E−01 1.1124E−01 −6.7731E−02
1.0000E+00 7.0000E+00 −1.2313E+00 −1.1889E+00 −1.0987E+00 −1.0987E+00 −2.1749E−01 8.5329E−02
1.0000E+00 4.0000E+01 −5.1486E+00 −5.8988E+00 1.0000E+00 −5.5438E+00 0.0000E+00 −2.8193E−01
The record in bold contains a DV that is less than LOQ, for which CWRES is not calculated, but NPDE is calculated.
CWRES, conditional weighted residuals; DV, dependent variable; ID, subject identification number; IPRED, individual predicted value; NPDE, normalized
prediction distribution error; PRED, predicted value; PREDV, Population Prediction Variable.

difficulty and can be particularly effective with problems with MU-­ reference equations for EM analysis (wexample10_
LOQ data. Control stream ad3tr4_loqb_imp.ctl uses the IMP saem.ctl, wexample10_bayes.ctl, wexample10_lap.ctl,
estimation method (Table 1, code item 6). Again, the AUTO wexample10_imp.ctl; Supplementary Materials S4).
feature is used, which adjusts IACCEPT and other option In the $ERROR block, the PK data (TYPE = 0) is modeled
values to allow handling of highly nonnormal conditional as usual normally distributed data (F_FLAG = 0 is set),
densities that are likely to occur with nonnormal data like- and its prediction function (mean to the normal density) is
lihoods. Also, RANMETHOD = S2 turns on quasi-­random ­returned as the Y value, whereas when the data are clinical
(Sobol) sampling to reduce stochastic noise in the objective response (TYPE = 1), a logistic regression function is used
function evaluation (intro71). to match up the concentration of drug with the increased
probability of positive response, and a likelihood is returned
EXAMPLE 3: MODELING PK CATEGORICAL as the Y value (Table 1, code item 7). A linear function
RESPONSE DATA (EXPP = THETA(4)+F*THETA(5)) relates the drug concentra-
tion A(2)/V linearly to drug effectiveness, which in turn is used
The following is another example in which the user must in a logistic regression function (exp(x)/(1 + exp(x)) to convert
define the likelihood for the data. In this example, PK sam- this into a probability of effectiveness. When DV = 1, Y is re-
ples are collected and interpreted in the usual manner with turned with the probability that the drug was effective, and
a normal data likelihood. Response data are also available, when DV = 0, Y is returned with the probability that the drug
0 indicating treatment failure, and 1 indicating treatment was not effective. Notice that extremes of likelihood values (0
success. The first portion models the standard one-­ or 1) are returned depending on the following scenarios:
compartment model with absorption using the convenient
Very low drug Very high drug
library module ADVAN2 in NONMEM and also providing levels levels
No response (DV = 0) Y=1 Y=0

NORMAL Response (DV = 1) Y=0 Y=1


3
LOQ
2.5
Thus the model tests that with drug present, a high inci-
2
dence of treatment success occurs, and with little or no drug
1.5 present, a low incidence of treatment success occurs.
1 The remainder of the control stream file contains typical
0.5
records for estimation and output. There may be more than
two categories of responses for clinical data, for which the
NPDE

0
user’s model must return the appropriate likelihood for each
-0.5 of those occurrences, and the likelihoods should total to 1 to
-1 statistically consider all possibilities.
Notice in these examples that an ITS step is first per-
-1.5
formed, followed by the estimation with the method of inter-
-2 est. In wexample10_lap.ctl, an ITS estimation is performed
-2.5 first and then the classical Laplace estimation. As mentioned
-3 previously, Laplace can be sometimes unstable in its search
for the minimal objective function, so having the Laplace
-3.5
-10 -8 -6 -4 -2 0 2 4 estimation begin at the population parameter values where
PREDV the ITS ended can stabilize the analysis. Similarly, in wex-
ample10_bayes.ctl, an ITS estimation is performed first and
Figure 1 Normalized prediction distribution error (NPDE) plotted then BAYES estimation. This can be beneficial to improving
against population prediction variable (PREDV) for Example 2: stability and reducing the burn-­in time required for BAYES,
Modeling data that are below the limit of quantitation (LOQ). The
NPDE values for data < LOQ are shown in red and, as expected, as the BAYES method will use as initial values the final pop-
occupy the lower PREDV region of the plot. ulation and individual parameters that were assessed by

www.psp-journal.com
NONMEM Tutorial II
Bauer
12

100
Vc
30
K12, K21
10
K10 10

Total Receptor Level


Ab Level in g/mL 3
K03, K30
1 3

0.3 1
0.1 Kmc,Vm
0.3
0.03
0.1
0.01
Vm, K03
0.003 0.03

0.001 0.01
0 7 14 21 28 35 42 49 56
Time in Days

Figure 2 Antibody levels (pharmacokinetic) and total receptor levels (pharmacodynamic) are plotted against time for Example 4: Using
ordinary differential equation solvers to model a basic target-mediated drug disposition model. Parameter symbols are located where
they impact the curve shape the most to give some sense of their contributions. Ab, antibody; Kmc, concentration of half-maximal rate of
internalization ; K12, rate constant of transfer from compartment 1 to compartment 2; K21, rate constant of transfer from compartment 2
to compartment 1; K10, rate constant of elimination from compartment 1; K03, rate of production of receptor (compartment 3); K30, rate
constant of elimination of receptor (compartment 3); Vc, volume of distribution of central compartment ; Vm, maximal rate of internalization.

ITS. For wexample10_saem.ctl, one or a few iterations of ctl, r2complb_foce.ctl) and Table 1, code item 8. Notice
ITS is first performed to obtain individual parameters evalu- that the initial value of the receptor level is set using the
ated at the mode of their posteriors, which can facilitate the reserved variable A_0(3), to K03/K30 (Table 1, code item
SAEM analysis. 9). Also, the PK data are modeled with residual variance
SIGMA(1,1), and PD data are modeled with another resid-
EXAMPLE 4: USING ODE SOLVERS TO MODEL A ual variance SIGMA(2,2) (Table 1, code item 10). Figure 2
BASIC TARGET-­MEDIATED DRUG DISPOSITION shows a typical PK profile and total receptor profile for
MODEL a subject receiving an infusion of loading-­dose antibody
during the first week followed by a higher dose the sec-
This example shows one of the most versatile ways to ond week. Parameter symbols are located where they im-
model a PK/PD problem, with ODE, using mass transfer pact the curve shape the most to give some sense of their
equations as a means to describe the interactions of mol- contributions. Although there are eight parameters to the
ecules and rates of movements from one physiological model, there is sufficient detail in the PK and PD curves to
or biochemical component to the other. The following is allow for their evaluation in a suitably rich data set.
a basic target-­mediated drug disposition model. Consider For target-­mediated drug disposition models, the IMP
an antibody with central volume of distribution VC (com- method is particularly efficient.14 When the analysis starts far
partment 1) that distributes to the peripheral compartment from reasonable initial values, the mode of the conditional
(compartment 2) with rate constants K12 and K21, a linear (MAP) estimation during the first iteration in IMP is facilitated
rate constant of elimination K10 associated with the high-­ by allowing a Monte Carlo sampling of MCETA-­1 ETAs to be
capacity receptor via the Fc component of the antibody, tested, and the ETA vector providing the lowest initial ob-
and an interaction with a target cell membrane receptor jective function is used as the initial position for the MAP
(compartment 3, total receptor) for which the antibody was estimation. Also, the TOL was set to 6, and SIGL (significant
designed to bind with high affinity via its (Fabʹ)2 component, digit precision for lower level calculations) should also be set
which results in the internalization and elimination of the to 6, as described in the manual.
antibody–receptor complex with maximal internalization For a data set with 50 subjects, this problem is solved
constant Vm and half-­maximal internalization rate occur- several fold faster by IMP than by FOCEI, but improvements
ring at plasma antibody levels of Kmc. The receptor is con- in the efficiency of FOCE evaluation have been made over
tinually replenished by the cell with first order production the years, such as the introduction of the SIGL option, which
rate K03 and first order elimination rate K30 in the absence allows one to reduce the convergence criterion NSIG (sig-
of antibody. This is readily expressed as a series of mass nificant digit precision for population parameter estimates)
transfer equations that take into account each of these and the ODE evaluation tolerance TOL, which can make
actions by simple equation components in record $DES, the FOCE method also more efficient.14 Also, the use of
shown in Supplementary Materials S5 (r2complb_imp. MU referencing with the FAST option allows the evaluation

CPT: Pharmacometrics & Systems Pharmacology


Table 4 A portion of the final output results for Example 5 (superid30_1_foce.tab): Analyzing data modeled with multiple levels of mixed effects

ID SID OCC TIME IPRED ETA1 ETA2 ETA3 ETA4 ETA5 ETA6 ETA7 ETA8 ETA9 ET10
1.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 5.7690E+01 −1.2951E−01 −2.7152E−01 −5.3382E−01 −7.1304E−01 9.0991E−02 −1.6888E−01 −8.3666E−02 8.6754E−02 −4.1063E−02 −1.1915E−02
1.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 5.7053E+01 −1.2951E−01 −2.7152E−01 −5.3382E−01 −7.1304E−01 9.0991E−02 −1.6888E−01 −8.3666E−02 8.6754E−02 −4.1063E−02 −1.1915E−02
1.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 5.6423E+01 −1.2951E−01 −2.7152E−01 −5.3382E−01 −7.1304E−01 9.0991E−02 −1.6888E−01 −8.3666E−02 8.6754E−02 −4.1063E−02 −1.1915E−02

2.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 4.4818E+01 −7.0114E−02 −1.4319E−01 −5.3382E−01 −7.1304E−01 −1.1614E−01 −4.4747E−02 1.0101E−01 4.5861E−02 −3.3181E−03 −5.0617E−02
2.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 4.4486E+01 −7.0114E−02 −1.4319E−01 −5.3382E−01 −7.1304E−01 −1.1614E−01 −4.4747E−02 1.0101E−01 4.5861E−02 −3.3181E−03 −5.0617E−02
2.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 4.4156E+01 −7.0114E−02 −1.4319E−01 −5.3382E−01 −7.1304E−01 −1.1614E−01 −4.4747E−02 1.0101E−01 4.5861E−02 −3.3181E−03 −5.0617E−02

3.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 2.8086E+01 −1.1209E−01 9.8214E−02 −5.3382E−01 −7.1304E−01 −1.9225E−02 1.8118E−01 7.7868E−02 −7.4813E−02 −1.0431E−01 −6.4336E−02
3.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 2.7948E+01 −1.1209E−01 9.8214E−02 −5.3382E−01 −7.1304E−01 −1.9225E−02 1.8118E−01 7.7868E−02 −7.4813E−02 −1.0431E−01 −6.4336E−02
3.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 2.7811E+01 −1.1209E−01 9.8214E−02 −5.3382E−01 −7.1304E−01 −1.9225E−02 1.8118E−01 7.7868E−02 −7.4813E−02 −1.0431E−01 −6.4336E−02

4.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 3.2419E+01 −9.2289E−02 1.6778E−01 −5.3382E−01 −7.1304E−01 6.7656E−03 −3.1853E−02 −5.2640E−02 −8.5933E−02 3.9829E−03 1.8459E−01
4.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 3.2227E+01 −9.2289E−02 1.6778E−01 −5.3382E−01 −7.1304E−01 6.7656E−03 −3.1853E−02 −5.2640E−02 −8.5933E−02 3.9829E−03 1.8459E−01
4.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 3.2036E+01 −9.2289E−02 1.6778E−01 −5.3382E−01 −7.1304E−01 6.7656E−03 −3.1853E−02 −5.2640E−02 −8.5933E−02 3.9829E−03 1.8459E−01

5.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 3.2916E+01 2.0926E−01 1.5725E−01 −5.3382E−01 −7.1304E−01 1.2382E−03 −3.6522E−02 8.7817E−03 −2.9378E−02 5.8401E−02 1.1359E−01
5.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 3.2649E+01 2.0926E−01 1.5725E−01 −5.3382E−01 −7.1304E−01 1.2382E−03 −3.6522E−02 8.7817E−03 −2.9378E−02 5.8401E−02 1.1359E−01
5.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 3.2385E+01 2.0926E−01 1.5725E−01 −5.3382E−01 −7.1304E−01 1.2382E−03 −3.6522E−02 8.7817E−03 −2.9378E−02 5.8401E−02 1.1359E−01

6.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 4.7660E+01 −1.4427E−01 −1.1702E−01 −5.3382E−01 −7.1304E−01 8.7928E−02 −1.3239E−01 −1.3833E−01 −9.0787E−02 3.6565E−03 1.8711E−01
6.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 4.7232E+01 −1.4427E−01 −1.1702E−01 −5.3382E−01 −7.1304E−01 8.7928E−02 −1.3239E−01 −1.3833E−01 −9.0787E−02 3.6565E−03 1.8711E−01
6.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 4.6808E+01 −1.4427E−01 −1.1702E−01 −5.3382E−01 −7.1304E−01 8.7928E−02 −1.3239E−01 −1.3833E−01 −9.0787E−02 3.6565E−03 1.8711E−01

7.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 4.6352E+01 1.1683E−02 −1.2005E−01 −5.3382E−01 −7.1304E−01 −2.7490E−02 −1.0154E−01 −7.6464E−02 5.8465E−02 1.1414E−01 −1.9799E−03
Bauer

7.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 4.5931E+01 1.1683E−02 −1.2005E−01 −5.3382E−01 −7.1304E−01 −2.7490E−02 −1.0154E−01 −7.6464E−02 5.8465E−02 1.1414E−01 −1.9799E−03
7.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 4.5514E+01 1.1683E−02 −1.2005E−01 −5.3382E−01 −7.1304E−01 −2.7490E−02 −1.0154E−01 −7.6464E−02 5.8465E−02 1.1414E−01 −1.9799E−03

8.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 4.1899E+01 1.7997E−01 −5.5437E−02 −5.3382E−01 −7.1304E−01 5.2661E−02 −6.5148E−02 −8.6443E−02 7.8233E−02 1.0205E−01 −4.2697E−02
8.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 4.1458E+01 1.7997E−01 −5.5437E−02 −5.3382E−01 −7.1304E−01 5.2661E−02 −6.5148E−02 −8.6443E−02 7.8233E−02 1.0205E−01 −4.2697E−02
NONMEM Tutorial II

8.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 4.1022E+01 1.7997E−01 −5.5437E−02 −5.3382E−01 −7.1304E−01 5.2661E−02 −6.5148E−02 −8.6443E−02 7.8233E−02 1.0205E−01 −4.2697E−02

9.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 4.0748E+01 −3.4621E−02 2.5466E−02 −5.3382E−01 −7.1304E−01 1.7205E−02 −1.1819E−01 4.9575E−02 5.0070E−02 −8.0644E−02 7.9295E−02
9.0000E+00 1.0000E+00 1.0000E+00 1.0000E−01 4.0423E+01 −3.4621E−02 2.5466E−02 −5.3382E−01 −7.1304E−01 1.7205E−02 −1.1819E−01 4.9575E−02 5.0070E−02 −8.0644E−02 7.9295E−02
9.0000E+00 1.0000E+00 1.0000E+00 2.0000E−01 4.0100E+01 −3.4621E−02 2.5466E−02 −5.3382E−01 −7.1304E−01 1.7205E−02 −1.1819E−01 4.9575E−02 5.0070E−02 −8.0644E−02 7.9295E−02

1.0000E+01 1.0000E+00 1.0000E+00 0.0000E+00 3.3914E+01 −7.9089E−03 1.3188E−01 −5.3382E−01 −7.1304E−01 −7.2529E−02 −4.1041E−02 7.4692E−02 −6.3879E−02 −1.1558E−02 1.5417E−01
1.0000E+01 1.0000E+00 1.0000E+00 1.0000E−01 3.3703E+01 −7.9089E−03 1.3188E−01 −5.3382E−01 −7.1304E−01 −7.2529E−02 −4.1041E−02 7.4692E−02 −6.3879E−02 −1.1558E−02 1.5417E−01
1.0000E+01 1.0000E+00 1.0000E+00 2.0000E−01 3.3492E+01 −7.9089E−03 1.3188E−01 −5.3382E−01 −7.1304E−01 −7.2529E−02 −4.1041E−02 7.4692E−02 −6.3879E−02 −1.1558E−02 1.5417E−01

1.1000E+01 2.0000E+00 1.0000E+00 0.0000E+00 9.0996E+00 −1.0569E−01 −7.6361E−02 4.6715E−04 7.1010E−01 −1.2187E−02 5.9678E−02 9.9922E−02 −7.5580E−03 −1.2245E−01 −7.5073E−02
1.1000E+01 2.0000E+00 1.0000E+00 1.0000E−01 9.0745E+00 −1.0569E−01 −7.6361E−02 4.6715E−04 7.1010E−01 −1.2187E−02 5.9678E−02 9.9922E−02 −7.5580E−03 −1.2245E−01 −7.5073E−02
1.1000E+01 2.0000E+00 1.0000E+00 2.0000E−01 9.0495E+00 −1.0569E−01 −7.6361E−02 4.6715E−04 7.1010E−01 −1.2187E−02 5.9678E−02 9.9922E−02 −7.5580E−03 −1.2245E−01 −7.5073E−02

1.2000E+01 2.0000E+00 1.0000E+00 0.0000E+00 7.1985E+00 −1.9556E−02 1.0727E−01 4.6715E−04 7.1010E−01 −9.3251E−02 1.1041E−01 6.0611E−02 −1.3951E−01 2.0220E−02 6.9816E−02
1.2000E+01 2.0000E+00 1.0000E+00 1.0000E−01 7.1827E+00 −1.9556E−02 1.0727E−01 4.6715E−04 7.1010E−01 −9.3251E−02 1.1041E−01 6.0611E−02 −1.3951E−01 2.0220E−02 6.9816E−02
1.2000E+01 2.0000E+00 1.0000E+00 2.0000E−01 7.1669E+00 −1.9556E−02 1.0727E−01 4.6715E−04 7.1010E−01 −9.3251E−02 1.1041E−01 6.0611E−02 −1.3951E−01 2.0220E−02 6.9816E−02

ETA1-10=ETA(1) to ETA(10), empirical bayes estimates; ID=subject identification number; IPRED, individual predicted value; OCC=occasion number; SID=site identification number.

www.psp-journal.com
13
NONMEM Tutorial II
Bauer
14

Table 5 Outputted table results for Example 6: Modeling a mixture of option (23,777 seconds, r2complb_foce4.ctl). Of course,
subpopulations of parameters (pmixture_foce.par) individual rates of improvement will vary depending on the
model and data.
ID V K BESTSUB
1.0000E+00 4.2434E+01 9.3660E−02 1.0000E+00 EXAMPLE 5: ANALYZING DATA MODELED WITH
2.0000E+00 6.6534E+01 1.1262E−01 1.0000E+00 MULTIPLE LEVELS OF MIXED EFFECTS
3.0000E+00 6.1668E+01 5.0276E−01 2.0000E+00
4.0000E+00 7.4587E+01 9.5481E−02 1.0000E+00 Additional nested levels of random effects may be added in
5.0000E+00 5.0625E+01 1.1113E−01 1.0000E+00 NONMEM. In the following example the PK parameters may
6.0000E+00 5.9876E+01 4.2720E−01 2.0000E+00 vary within an individual from one dosing event to the next,
7.0000E+00 5.8508E+01 1.3610E−01 1.0000E+00 called interoccasion variability. Furthermore, there are the
8.0000E+00 6.9308E+01 1.2559E−01 1.0000E+00 usual random effects between individuals (interindividual
9.0000E+00 7.0448E+01 4.0392E−01 2.0000E+00 variability) as well as random effects explaining variability
1.0000E+01 6.2197E+01 1.2000E−01 1.0000E+00 between one clinical site and the next (intersite variability).
1.1000E+01 7.4701E+01 8.9449E−02 1.0000E+00
With the residual variance, this consists of four hierarchi-
1.2000E+01 7.6044E+01 7.6652E−01 2.0000E+00
cal random effects and errors. The code of superid30_1*
gives an example of how this may be conveniently coded
1.3000E+01 6.9676E+01 9.4314E−02 1.0000E+00
using some of the symbolic declarations available since
1.4000E+01 6.4067E+01 1.4138E−01 1.0000E+00
NONMEM 7.3 (superid30_1_bayes.ctl, superid30_1_saem.
1.5000E+01 5.3923E+01 8.0854E−01 2.0000E+00
ctl, superid_1_foce.ctl; Supplementary Materials S6). The
1.6000E+01 6.7635E+01 1.2107E−01 1.0000E+00
dosing events within a given subject are demarcated by
1.7000E+01 1.0518E+02 1.0739E−01 1.0000E+00
the OCC (occasion) data item, which has values of 1, 2, 3,
1.8000E+01 9.1576E+01 5.1767E−01 2.0000E+00
etc., to indicate occasion number. The $ABBR RERPLACE
1.9000E+01 9.4717E+01 7.6706E−02 1.0000E+00 records map symbolic references OCC_CL and OCC_V
2.0000E+01 8.7513E+01 7.7070E−02 1.0000E+00 to the ETAs that are appropriate for each occasion. For
2.1000E+01 5.7781E+01 4.5237E−01 2.0000E+00 example, for PK parameter CL, OCC_CL maps to ETA(5),
2.2000E+01 6.9630E+01 1.0151E−01 1.0000E+00 ETA(7), or ETA(9), depending on whether the OCC data item
2.3000E+01 5.8963E+01 1.5230E−01 1.0000E+00 is 1, 2, or 3, respectively. This allows three separate CLs to
2.4000E+01 5.9655E+01 8.3048E−01 2.0000E+00 be independently created, one for each occasion, within
2.5000E+01 6.0324E+01 1.0135E−01 1.0000E+00 a particular individual. A similar mapping is performed for
2.6000E+01 7.3017E+01 1.1475E−01 1.0000E+00 parameter V using OCC_V to map ETA(6), ETA(8), or ETA(10)
2.7000E+01 6.6592E+01 4.7002E−01 2.0000E+00 for the three occasions using the $ABBR REPLACE record
2.8000E+01 7.1897E+01 1.0585E−01 1.0000E+00 (Table 1, code item 11). Random effects that scope across
2.9000E+01 7.1601E+01 1.1429E−01 1.0000E+00 individuals such as intersite variability in this example are
3.0000E+01 5.1493E+01 3.3186E−01 2.0000E+00 mapped using the $LEVEL record (Table 1, code item 12).
3.1000E+01 4.8920E+01 1.1613E−01 1.0000E+00 The SID (site identification number) data item has separate
3.2000E+01 9.2087E+01 1.1539E−01 1.0000E+00 values in the data set for each site, and those subjects shar-
3.3000E+01 5.8832E+01 5.1238E−01 2.0000E+00
ing the same site value will share the same random effect
3.4000E+01 7.7011E+01 1.0821E−01 1.0000E+00
ETA value. NONMEM is informed that ETA(3) is a CL ETA
that changes only with every site and is associated by nest-
3.5000E+01 6.5992E+01 9.3086E−02 1.0000E+00
ing with CL ETA(1), which varies with each subject. They
3.6000E+01 7.3862E+01 2.8765E−01 2.0000E+00
associate together because they provide random effects
3.7000E+01 7.7355E+01 1.1107E−01 1.0000E+00
to the same individual parameter. Similarly, volume ETA(4)
3.8000E+01 6.3286E+01 9.9980E−02 1.0000E+00
is another eta that changes only with every site and is as-
3.9000E+01 7.8039E+01 6.8947E−01 2.0000E+00
sociated by nesting with intersubject volume random effect
BESTSUB=index to best fitting sub-population; ID=subject identification ETA(2). This relationship is reflected in the way the individ-
number; K=rate constant of elimination; V=volume of distribution.
ual parameters are modeled using these ETAs in the $PK
record (Table 1, code item 13). The hierarchical random
effects levels are each given OMEGA block descriptions
of analytical derivatives with respect to the population pa- (Table 1, code item 14). To permit a BAYES analysis, unin-
rameters, which also increases accuracy of evaluating the formative prior OMEGAs are supplied with the same pat-
variance–covariance of estimates during the $COV step. The tern as the to-­be-­estimated OMEGAs (superid30_1_bayes).
example r2complb_foce.ctl was evaluated with low SIGL(=6) The estimation records shown in Supplementary
low NSIG(=1), with low tolerance setting for ODE integration Materials S6 are examples of how one may perform ITS,
(TOL = 6) and using the FAST option, resulting in the esti- SAEM, IMP, BAYES, and FOCE on this type of problem.
mation completing in 475 seconds. For a more conservative These are followed by the $COV and $TABLE records. Of
precision assessment, with SIGL = 9, NSIG = 3, TOL = 9, particular importance is that the FNLETA must be set to
the FAST option completes the estimation in 1,022 seconds 0 to have final SID ETAs retain their shared values among
(r2complb_foce3.ctl), which is still much faster, and with a subjects of a common SID value when outputted in a table
cleaner termination status, than when not using the FAST (in this example, superid30_1*.tab). Also, for FOCE, options

CPT: Pharmacometrics & Systems Pharmacology


Table 6 NONMEM, partial phm file results for Example 6: Modeling a mixture of subpopulations of parameters (pmixture_foce.phm)

TABLE NO. 1: First-­order conditional estimation with interaction: Problem = 1 Subproblem = 0 Superproblem1 = 0 Iteration1 = 0 Superproblem2 = 0 Iteration2 = 0

ID SUBPOP PMIX ETA(1) ETA(2) ETA(3) ETA(4) ETC (1,1) ETC (2,1) ETC (2,2) ETC (3,3) ETC (4,3) ETC (4,4) OBJ
1 1 1.00000E+00 −4.93563E−01 −7.16567E−02 0.00000E+00 0.00000E+00 1.82140E−03 −1.33876E−03 2.97276E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −14.7965423227514
1 2 4.67808E−13 0.00000E+00 0.00000E+00 −5.35659E−01 −1.63579E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.85406E−03 −1.33784E−03 2.82839E−03 40.5984872879239
2 1 1.00000E+00 −4.37870E−02 1.12666E−01 0.00000E+00 0.00000E+00 1.83753E−03 −1.14698E−03 2.12519E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −27.4568591873074
2 2 1.42478E−09 0.00000E+00 0.00000E+00 −8.52734E−02 −1.45695E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.86034E−03 −1.13173E−03 2.00410E−03 11.8952271143952
3 1 1.88263E−21 −1.25051E−01 1.60474E+00 0.00000E+00 0.00000E+00 1.86450E−03 −2.72656E−04 1.15078E−04 4.93103E−02 −1.10284E−02 5.99658E−02 41.2497512311461
3 2 1.00000E+00 0.00000E+00 0.00000E+00 −1.40094E−01 −1.18895E−02 4.61817E−02 −8.57633E−03 2.72419E−02 1.86913E−03 −2.72204E−04 1.14364E−04 −55.5798855094779
4 1 1.00000E+00 7.04636E−02 −5.24048E−02 0.00000E+00 0.00000E+00 1.82337E−03 −1.31803E−03 2.87198E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −30.5564906816249
4 2 2.61403E−11 0.00000E+00 0.00000E+00 2.91913E−02 −1.61671E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.85486E−03 −1.31447E−03 2.72696E−03 16.7921907639984
5 1 1.00000E+00 −3.17050E−01 9.93389E−02 0.00000E+00 0.00000E+00 1.83656E−03 −1.16029E−03 2.17821E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −12.5394921766005
5 2 1.54579E−10 0.00000E+00 0.00000E+00 −3.61141E−01 −1.46635E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.86007E−03 −1.14184E−03 2.04093E−03 31.2547378153604
6 1 5.53963E−17 −1.49876E−01 1.43913E+00 0.00000E+00 0.00000E+00 1.86469E−03 −3.21643E−04 1.60099E−04 4.93103E−02 −1.10284E−02 5.99658E−02 32.0133384541306
6 2 1.00000E+00 0.00000E+00 0.00000E+00 −1.69586E−01 −1.74743E−01 4.61817E−02 −8.57633E−03 2.72419E−02 1.86934E−03 −3.20334E−04 1.58334E−04 −44.2371064095188
Bauer

7 1 1.00000E+00 −1.72336E−01 3.02066E−01 0.00000E+00 0.00000E+00 1.84871E−03 −9.68943E−04 1.48974E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −26.9334957081190
7 2 2.47355E−07 0.00000E+00 0.00000E+00 −2.12555E−01 −1.27566E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.86444E−03 −9.51460E−04 1.40747E−03 2.10498244200648
8 1 1.00000E+00 −2.94763E−03 2.21691E−01 0.00000E+00 0.00000E+00 1.84453E−03 −1.04190E−03 1.73401E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −21.2148466908645
8 2 7.50375E−08 0.00000E+00 0.00000E+00 −5.24174E−02 −1.33823E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.86324E−03 −1.01054E−03 1.59067E−03 10.2093031386916
9 1 2.32945E−16 1.11717E−02 1.38345E+00 0.00000E+00 0.00000E+00 1.86471E−03 −3.39986E−04 1.78874E−04 4.93103E−02 −1.10284E−02 5.99658E−02 26.5010173168367
NONMEM Tutorial II

9 2 1.00000E+00 0.00000E+00 0.00000E+00 −6.98870E−03 −2.30785E−01 4.61817E−02 −8.57633E−03 2.72419E−02 1.86939E−03 −3.38783E−04 1.77081E−04 −46.8768468381362
10 1 1.00000E+00 −1.11194E−01 1.76185E−01 0.00000E+00 0.00000E+00 1.84181E−03 −1.08493E−03 1.88839E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −26.2675357733099
10 2 6.10413E−09 0.00000E+00 0.00000E+00 −1.51094E−01 −1.39829E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.86188E−03 −1.07033E−03 1.78824E−03 10.1746567796867
11 1 1.00000E+00 7.19914E−02 −1.17659E−01 0.00000E+00 0.00000E+00 1.81638E−03 −1.38883E−03 3.22615E−03 4.93103E−02 −1.10284E−02 5.99658E−02 −28.9248184755368
11 2 5.02444E−12 0.00000E+00 0.00000E+00 2.67665E−02 −1.67209E+00 4.61817E−02 −8.57633E−03 2.72419E−02 1.85243E−03 −1.38321E−03 3.03126E−03 21.7221908489041
12 1 4.92953E−85 3.25971E−01 5.45635E−01 0.00000E+00 0.00000E+00 1.85739E−03 −7.72211E−04 9.33345E−04 4.93103E−02 −1.10284E−02 5.99658E−02 313.955053188483
12 2 1.00000E+00 0.00000E+00 0.00000E+00 6.94565E−02 4.09859E−01 4.61817E−02 −8.57633E−03 2.72419E−02 1.86850E−03 −1.78488E−04 4.92198E−05 −75.6803309494078

ETA(x)=empirical bayes estimate to xth eta; ETC(x,y)=conditional variance between ETA(x) and ETA(y); ID=subject identification number ; OBJ=objective function value for a given subject and sub-population;
PMIX=probability of subject belonging to this sub-population; SUBPOP=sub-population index.

www.psp-journal.com
15
NONMEM Tutorial II
Bauer
16

Table 7 Subset of records to data file (urine.dat) for example 7, with urine voiding records

ID TIME AMT RATE DV MDV EVID CMT UVOL


1.0000E + 00 0.0000E + 00 1.0000E + 03 0.0000E + 00 0.0000E + 00 1.0000E + 00 1.0000E + 00 1.0000E + 00 0.0000E + 00
1.0000E + 00 0.0000E + 00 0.0000E + 00 0.0000E + 00 0.0000E + 00 1.0000E + 00 2.0000E + 00 2.0000E + 00 0.0000E + 00

1.0000E + 00 5.0000E + 00 0.0000E + 00 0.0000E + 00 9.5704E + 00 0.0000E + 00 0.0000E + 00 −2.0000E + 00 1.0000E + 01
1.0000E + 00 5.0000E + 00 0.0000E + 00 0.0000E + 00 0.0000E + 00 1.0000E + 00 2.0000E + 00 2.0000E + 00 0.0000E + 00

1.0000E + 00 1.0000E + 01 0.0000E + 00 0.0000E + 00 5.8533E + 00 0.0000E + 00 0.0000E + 00 −2.0000E + 00 1.2000E + 01
1.0000E + 00 1.0000E + 01 0.0000E + 00 0.0000E + 00 0.0000E + 00 1.0000E + 00 2.0000E + 00 2.0000E + 00 0.0000E + 00

AMT, amount of drug; CMT, compartment number; DV, dependent variable; EVID=event ID; ID, subject identification number; MDV, missing dependent vari-
able indicator; UVOL, urine volume.

SLOW and NONINFETA = 1 must be set so that proper The subpopulations are given separate block OMEGAs,
gradients are evaluated for updating the SID ETAs. Table 4 as there should be no correlation between parameters
shows a part of superid30_1_foce.tab that outputs the ID, across subpopulations (Table 1, code item 16). As usual,
SID, OCC, TIME, IPRED, and ETAs. Notice that the SID-­level priors to OMEGAs are set up to match the block pattern of
ETAs 3 and 4 do not change until SID changes. the estimated OMEGAs. The post hoc best-­fitting V, K for
Only one of the ETAs belonging to an individual parameter each subject and the subpopulation to which they belong
requires a nonzero MU associated with the typical value for (BESTSUB = MAXEST) may be outputted, as indicated in
that parameter. Here, the MU_ variables are associated with the $TABLE record, outputting to file pmixture*.par. Table 5
the ETAs to intersubject variability (such as MU_1 as typical lists a part of pmixture_foce.par. In addition, the conditional
value for CL and indexed to ETA(1), the intersubject variabil- mean (for Monte Carlo EM) or mode (for FOCE/Laplace/ITS)
ity). The other ETAs, for intersite variability and interocca- individual PHIs and their variances for each subpopulation
sion variability, implicitly have 0 valued MU_’s, hence MU_3, are listed in pmixture*.phm (see Table 6), along with the
MU_5, etc., are not modeled. NMTRAN issues MU referenc- probability of belonging to a subpopulation PMIX. For each
ing warnings, which can be ignored. Notice that once again, subject, MIXEST is related to PMIX by:
ITS estimation can be used as a partial burning-­in/estima-
tion step to facilitate SAEM, BAYES, and FOCE. MIXEST=sub-population with largest PMIX value.

EXAMPLE 6: MODELING A MIXTURE OF


The phi(x) values in the.phm file are related to the V and K
SUBPOPULATIONS OF PARAMETERS
in the pmixture.par file as follows:
If BESTSUB=1:
The distribution of model parameters sometimes may be
best described as coming from two or more subpopula- V=exp(phi(1))
tions among the subjects. When this occurs, it is desir- K=exp(phi(2))
able to determine if a particular categorical covariate, such If BESTSUB=2:
as sex, can explain the reason for these subpopulations. V=exp(phi(3))
Sometimes none of the covariates available can explain the
K=exp(phi(4))
subpopulation distributions, and it is then desired that indi-
viduals be tested for their relative goodness of fit between
these subpopulations. The example in Supplementary The conditional mean and variances averaged among the
Materials S7 (pmixture_foce.ctl, pmixture_saem.ctl, pmix- subpopulations using the PMIX value as weight is listed in
ture_bayes.ctl) with a one-­ compartment model and two pmixture*.phi (not shown). For this example, the subjects are
subpopulations of V and K demonstrates how this is set up extremely likely to belong to one subpopulation or another,
in NONMEM. In the $PK record, two sets of V and K1 are set so these values do not differ from the records in pmixture.
up for the analysis, one pair for each subpopulation, each phm whose PMIX value is close to 1.
pair distributed according to that subpopulation’s mean MU
and ETAs (Table 1, code item 15). In this example, subpop- EXAMPLE 7: MODELING PERIODICALLY COLLECTED
ulation 1 is modeled using MU_1 for mean to LOG(V), and URINE SAMPLES
MU_2 for mean to log(K), with their respective ETAs for their
random effects, whereas subpopulation 2 parameters are When urine data are collected, the model must account
modeled with means MU_3 and MU_4, and their respec- for the urine compartment to be emptied and then filled.
tive ETAs. NONMEM requests individual parameters to be Complete urine data consists of time of start of an empty
modeled for subpopulation 1 or 2 for each call to the user bladder, time of emptying of bladder measured, concentra-
model via the parameter MIXNUM. It then determines the tion of drug in urine, and total volume of urine collected at
goodness of fit of the subject’s data considering each sub- that time. In NONMEM, a particular compartment X may be
population, and the MIXEST value is set to the subpopula- emptied (turned off), that is, its amount A(x) set to 0, when a
tion number that best fits that subject’s data. data record is encountered in which its CMT (compartment

CPT: Pharmacometrics & Systems Pharmacology


NONMEM Tutorial II
Bauer
17

number) item is minus x. A subsequent data record may be A PDF file containing:
used to indicate the start of its refilling or turned on with a Part A: Additional Information on MU-­Referencing.
positive x. Usually, this would be immediately after urine col- Part B: No-­U-­Turn Hamiltonian Bayes Method.
lection (and bladder voiding) of the previous –x record. For Part C: Providing Prior Information for Bayesian Analysis.
example, a series of data records may be seen in Table 7. Part D: Termination Testing.
For the ADVAN series of models, the N+1th compartment Part E: Setting up Example 1 for Bayesian Analysis (504b.ctl).
is called the output compartment. For ADVAN1, compart- Supplementary Materials S2. (Example 1, file
ment 2 is the output (urine) compartment. The output com- NONMEM_Tutorial_I_S2.zip):
partment by default is turned off and is turned on when a The zip file contains the following files for example 1:
CMT = 2 record appears. As this record is used just to turn 501.csv: data file.
on “bladder filling” and there are no data associated with 504_foce.ctl: control stream file.
it, its EVID is set to 2, a nondose, nonobservation event. 504_foce.res: NONMEM report file.
The next record of interest is the urine collection record at 504_foce.tab: Parameters outputted by user-­specified $TABLE record.
time = 5, where the urine concentration is recorded as DV, 504_foce.ext: Raw output file.
urine volume (amount of urine voided) UVOL is recorded, and 504_foce.cov: Variance-­Covariance matrix of estimates to THETAs,
the CMT = −2, to indicate that, in addition to this being a OMEGAs, and SIGMAs.
urine collection record, the compartment is to be “turned-­ 504_foce.cor: Fully informative correlation matrix of estimates, with
off,” that is, amount of compartment 2 set to 0 (bladder standard errors as diagonal elements, and correlation values on the off-­
emptied) immediately after. Then, the next record should be diagonal elements.
EVID = 2, CMT = 2, at the same time, to indicate that the out- 504_foce.coi: Inverse covariance matrix (Fisher information matrix).
put compartment is to be turned on again, that is, the blad- 504_foce.phi: Individual ETAs (eta()), their variances (etc()), and individ-
der is to be refilled in anticipation of the next urine ­collection ual objective function values.
at time = 10. 504_its.ctl: control stream file.
The model listed in Supplementary Materials S8 uses 504_its.res: NONMEM report file.
the urine data to determine the portion of drug that is renally 504_its.tab: Parameters outputted by user-­specified $TABLE record.
cleared (total clearance is CL, renal clearance is CLR), and 504_its.ext: Raw output file.
IMP is used as the estimation method. The CLR is related to 504_its.cov: Variance-­ Covariance matrix of estimates to THETAs,
the total CL by F2 = CL/CLR, where F2 is a reserved vari- OMEGAs, and SIGMAs.
able that determines what fraction of eliminated drug from 504_its.cor: Fully informative correlation matrix of estimates, with
compartment 1 goes to the urine compartment 2 (urine.ctl; standard errors as diagonal elements, and correlation values on the
Table 1, code item 17). The $ERROR block assigns the pre- off-­diagonal elements.
dicted values, CP (concentration of plasma), or CU (concen- 504_its.coi: Inverse covariance matrix (Fisher information matrix).
tration of urine), and residual error (EPS(1) or EPS(2)) to the 504_its.phi: Individual ETAs (eta()), their variances (etc()), and individual
appropriate data (Table 1, code item 18). objective function values.
This problem may also be estimated using one of the 504_saem.ctl: control stream file.
differential equation solver ADVANs (ADVAN6, ADVAN8, 504_saem.res: NONMEM report file.
ADVAN9, ADVAN13, ADVAN14, and ADVAN15). The control 504_saem.tab: Parameters outputted by user-­specified $TABLE record.
stream model needs to be modified at the $SUBROUTINES 504_saem.ext: Raw output file.
record and $DES record (urine2.ctl; Supplementary 504_saem.cov: Variance-­Covariance matrix of estimates to THETAs,
Materials S8). The SIGL should match the TOL, and NSIG OMEGAs, and SIGMAs.
should be 3× less than SIGL for ODE problems. Note that 504_saem.cor: Fully informative correlation matrix of estimates, with
output compartment is NCOMPARTMENTS+1, so the out- standard errors as diagonal elements, and correlation values on the off-­
put compartment is still 2. diagonal elements.
504_saem.coi: Inverse covariance matrix (Fisher information matrix).
CONCLUSION 504_saem.phi: Individual ETAs (eta()), their variances (etc()), and indi-
vidual objective function values.
This tutorial listed examples of typical types of PK/PD mod- 504_bayes.ctl: control stream file.
eling problems that occur in the pharmaceutical field, which 504_bayes.res: NONMEM report file.
the reader can use as a template for his or her own modeling 504_bayes.tab: Parameters outputted by user-­specified $TABLE record.
endeavors in NONMEM. It is hoped that with these examples 504_bayes.ext: Raw output file.
and the description of the general concepts about the prop- 504_bayes.cov: Variance-­Covariance matrix of estimates to THETAs,
erties and behaviors of the various statistical algorithms, the OMEGAs, and SIGMAs.
user is able to construct models of varying complexity and 504_bayes.cor: Fully informative correlation matrix of estimates, with
wisely choose the appropriate estimation method. standard errors as diagonal elements, and correlation values on the off-­
diagonal elements.
Supporting Information. Supplementary information accompa- 504_bayes.coi: Inverse covariance matrix (Fisher information matrix).
nies this paper on the CPT: Pharmacometrics & Systems Pharmacology 504_bayes.phi: Individual ETAs (eta()), their variances (etc()), and indi-
website (www.psp-journal.com). vidual objective function values.
504_nuts.ctl: control stream file.
Supplementary Materials S1. (file NONMEM_Tutorial_II_S1.pdf) 504_nuts.res: NONMEM report file.

www.psp-journal.com
NONMEM Tutorial II
Bauer
18

504_nuts.tab: Parameters outputted by user-­specified $TABLE record. r2complb_imp.ext.


504_nuts.ext: Raw output file. r2complb_imp.phi.
504_nuts.cov: Variance-­Covariance matrix of estimates to THETAs, r2complb_imp.coi.
OMEGAs, and SIGMAs. r2complb_imp.cov.
504_nuts.cor: Fully informative correlation matrix of estimates, with r2complb_foce.ctl.
standard errors as diagonal elements, and correlation values on the off-­ r2complb_foce.res.
diagonal elements. r2complb_foce.ext.
504_nuts.coi: Inverse covariance matrix (Fisher information matrix). r2complb_foce.phi.
504_nuts.phi: Individual ETAs (eta()), their variances (etc()), and individ- r2complb_foce.coi.
ual objective function values. r2complb_foce.cov.
Supplementary Materials S3. (Example 2, file r2complb_foce3.ctl.
NONMEM_Tutorial_II_S3.zip): r2complb_foce3.res.
The zip file contains the following files for example 2: r2complb_foce3.ext.
ad3tr4.csv. r2complb_foce3.phi.
ad3tr4_loqb_lap.ctl. r2complb_foce3.coi.
ad3tr4_loqb_lap.res. r2complb_foce3.cov.
ad3tr4_loqb_lap.ext. r2complb_foce4.ctl.
ad3tr4_loqb_lap.tab. r2complb_foce4.res.
ad3tr4_loqb_lap.phi. r2complb_foce4.ext.
ad3tr4_loqb_lap.coi. r2complb_foce4.phi.
ad3tr4_loqb_lap.cov. r2complb_foce4.coi.
ad3tr4_loqb_imp.ctl. r2complb_foce4.cov.
ad3tr4_loqb_imp.res. Supplementary Materials S6. (Example 5, file
ad3tr4_loqb_imp.ext. NONMEM_Tutorial_II_S6.zip):
ad3tr4_loqb_imp.tab. The zip file contains the following files for example 5:
ad3tr4_loqb_imp.phi. Superid30.csv.
ad3tr4_loqb_imp.coi. superid30_1_foce.ctl.
ad3tr4_loqb_imp.cov. superid30_1_foce.res.
Supplementary Materials S4. (Example 3, file superid30_1_foce.ext.
NONMEM_Tutorial_II_S4.zip): superid30_1_foce.tab.
The zip file contains the following files for example 3: superid30_1_foce.phi.
wexample10.csv. superid30_1_foce.coi.
wexample10_lap.ctl. superid30_1_foce.cov.
wexample10_lap.res. superid30_1_imp.ctl.
wexample10_lap.ext. superid30_1_imp.res.
wexample10_lap.tab. superid30_1_imp.ext.
wexample10_lap.phi. superid30_1_imp.tab.
wexample10_lap.coi. superid30_1_imp.phi.
wexample10_lap.cov. superid30_1_imp.coi.
wexample10_saem.ctl. superid30_1_imp.cov.
wexample10_saem.res. superid30_1_bayes.ctl.
wexample10_saem.ext. superid30_1_bayes.res.
wexample10_saem.tab. superid30_1_bayes.ext.
wexample10_saem.phi. superid30_1_bayes.tab.
wexample10_saem.coi. superid30_1_bayes.phi.
wexample10_saem.cov. superid30_1_bayes.coi.
wexample10_bayes.ctl. superid30_1_bayes.cov.
wexample10_bayes.res. Supplementary Materials S7. (Example 6, file
wexample10_bayes.ext. NONMEM_Tutorial_II_S7.zip):
wexample10_bayes.tab. The zip file contains the following files for example 6:
wexample10_bayes.phi. Pmixture_foce.csv.
wexample10_bayes.coi. pmixture_foce.ctl.
wexample10_bayes.cov. pmixture_foce.res.
Supplementary Materials S5. (Example 4, file pmixture_foce.ext.
NONMEM_Tutorial_II_S5.zip): pmixture_foce.phi.
The zip file contains the following files for example 4: pmixture_foce.phm.
r2comp.csv. pmixture_foce.cov.
r2complb_imp.ctl. pmixture_foce.coi.
r2complb_imp.res. pmixture_foce.cor.

CPT: Pharmacometrics & Systems Pharmacology


NONMEM Tutorial II
Bauer
19

pmixture_saem.ctl. 2. Steimer, J.L., Mallet, A., Golmard, J.L. & Boisvieux, J.F. Alternative approaches to
estimation of population pharmacokinetic parameters: comparison with the nonlin-
pmixture_saem.res.
ear mixed-­effect model. Drug Metab. Rev. 15, 265–292 (1984).
pmixture_saem.ext. 3. Bauer, R.J., Guzy, S. & Ng, C.M. A survey of population analysis methods and soft-
pmixture_saem.phi. ware for complex pharmacokinetic and pharmacodynamic models with examples.
pmixture_saem.phm. AAPS J 9, E60–E83 (2007).
4. Bauer, R.J. & Guzy, S. Monte Carlo parametric expectation maximization (MC-
pmixture_saem.cov. PEM) method for analyzing population pharmacokinetic/pharmacodynamic data.
pmixture_saem.coi. In Advanced Methods of Pharmacokinetic and Pharmacodynamic Systems Analysis,
pmixture_saem.cor. Vol. 3 (ed. D’Argenio, D.Z.) 135–163 (Kluwer Academic Publishers, Boston, MA,
2004).
pmixture_bayes.ctl. 5. Lavielle, M. SAEM in MATLAB: an alternative to linearization. Population Approach
pmixture_bayes.res. Group Europe (PAGE) Meeting, Uppsala, Sweden, June 17-18, 2004.
pmixture_bayes.ext. 6. PKBUGS software, version 2.0 [computer program] (MRC Biostatistics Unit,
pmixture_bayes.phi. Cambridge, UK).
7. Hoffman, M.D. & Gelman, A. The No-­U-­Turn Sampler: adaptively setting path lengths
pmixture_bayes.phm.
in Hamiltonian Monte Carlo. J. Mach. Learn Res. 15, 1593–1623 (2014).
pmixture_bayes.cov. 8. Stan Modeling Language. User’s guide and reference manual. Stan Reference
pmixture_bayes.coi. Manual. Stan Development Team, V.2.18 (July 2018) https://mc-stan.org/.
pmixture_bayes.cor. 9. Ahn, J.E., Karlsson, M.O., Dunne, A. & Ludden, T.M. Likelihood based approaches
to handling data below the quantification limit using NONMEM VI. J. Pharmacokient.
Supplementary Materials S8. (Example 7, file
Phar. 35, 401–402 (2008).
NONMEM_Tutorial_II_S8.zip): 10. Hooker, A.C., Staatz, C.E. & Karlsson, M.O. Conditional weighted residuals
The zip file contains the following files for example 7: (CWRES): a model diagnostic for the FOCE method. Pharm. Res. 24, 2187–2197
urine.dat. (2007).
11. Comets, E., Brendel, K. & Mentre, F. Computing normalized prediction distribution
urine.ctl
errors to evaluate nonlinear mixed effects models: the npde add-­on package for R.
urine.res. Comput. Methods Programs Biomet. 90, 154–166 (2008).
urine.tab. 12. Brendel, K., Comets, E., Laffont, C., Laveille, C. & Mentré, F. Metrics for external
urine.ext. model evaluation with an application to the population pharmacokinetics of gli-
urine.phi. clazide. Pharm. Res. 23, 2036–2049 (2006).
13. Nguyen, T.H.T., Comets, E. & Mentré, F. Extension of NPDE for evaluation of non-
urine.coi. linear mixed effect models in presence of data below the quantification limit with
urine.cov. applications to HIV dynamic model. J. Pharmacokinet Pharmacodyn. 39, 499–518
urine.cor. (2012).
urine2.ctl. 14. Gibansky, L., Gibansky, E. & Bauer, R. Comparison of NONMEm 7.2 estimation
methods and parallel processing efficiency on a target-­mediated drug disposition
urine2.res. model. J. Pharmacokinet Pharmacodyn. 39, 17–36 (2012).
urine2.tab.
urine2.ext.
urine2.phi.
urine2.coi. © 2019. ICON Clinical Research LLC. CPT: Pharmaco­
urine2.cov. metrics & Systems Pharmacology published by Wiley
urine2.cor. Periodicals, Inc. on b­ ehalf of the American Society for
Clinical Pharmacology & Therapeutics. This is an open
Funding. ICON Clinical Research LLC. licenses the NONMEM and access article under the terms of the Creative Commons
PDx-­Pop software. Attribution-NonCommercial-NoDerivs License, which
permits use and distribution in any medium, provided
Conflict of Interest. The author is a paid employee of ICON Clinical the original work is properly cited, the use is non-com-
Research LLC. and is the present developer of NONMEM. mercial and no modifications or adaptations are made.

1. Beal, S.L., Sheiner, L.B., Boeckmann, A.J. & Bauer, R.J. (Eds). NONMEM 7.4 users
guides (ICON plc, Gaithersburg, MD, 1989–2018). <https​://nonmem.iconp​lc.com/
nonme​m743/guides>.

www.psp-journal.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy