ordinary differential equation pk/pd models using the sas macro nlinmix
TRANSCRIPT
This article was downloaded by [North Dakota State University]On 02 December 2014 At 2004Publisher Taylor amp FrancisInforma Ltd Registered in England and Wales Registered Number 1072954 Registered office MortimerHouse 37-41 Mortimer Street London W1T 3JH UK
Journal of Biopharmaceutical StatisticsPublication details including instructions for authors and subscription informationhttpwwwtandfonlinecomloilbps20
Ordinary Differential Equation PKPD Models Usingthe SAS Macro NLINMIXAndrzej T Galecki a e Russell D Wolfinger b Oscar A Linares c d Marla J Smith c ampJeffrey B Halter a ca Institute of Gerontology University of Michigan Ann Arbor Michigan USAb SAS Institute Inc SAS Campus Drive Cary North Carolina USAc Geriatrics Center University of Michigan Ann Arbor Michigan USAd Michigan Horace H Rackham School of Graduate Studies University of Michigan AnnArbor Michigan USAe Institute of Gerontology University of Michigan Ann Arbor MI 48109-2007 USAPublished online 02 Feb 2007
To cite this article Andrzej T Galecki Russell D Wolfinger Oscar A Linares Marla J Smith amp Jeffrey B Halter (2004)Ordinary Differential Equation PKPD Models Using the SAS Macro NLINMIX Journal of Biopharmaceutical Statistics 142483-503 DOI 101081BIP-120037194
To link to this article httpdxdoiorg101081BIP-120037194
PLEASE SCROLL DOWN FOR ARTICLE
Taylor amp Francis makes every effort to ensure the accuracy of all the information (the ldquoContentrdquo) containedin the publications on our platform However Taylor amp Francis our agents and our licensors make norepresentations or warranties whatsoever as to the accuracy completeness or suitability for any purpose ofthe Content Any opinions and views expressed in this publication are the opinions and views of the authorsand are not the views of or endorsed by Taylor amp Francis The accuracy of the Content should not be reliedupon and should be independently verified with primary sources of information Taylor and Francis shallnot be liable for any losses actions claims proceedings demands costs expenses damages and otherliabilities whatsoever or howsoever caused arising directly or indirectly in connection with in relation to orarising out of the use of the Content
This article may be used for research teaching and private study purposes Any substantial or systematicreproduction redistribution reselling loan sub-licensing systematic supply or distribution in anyform to anyone is expressly forbidden Terms amp Conditions of access and use can be found at httpwwwtandfonlinecompageterms-and-conditions
Ordinary Differential Equation PK=PD ModelsUsing the SAS Macro NLINMIX
Andrzej T Galecki1 Russell D Wolfinger2 Oscar A Linares34
Marla J Smith3 and Jeffrey B Halter13
1Institute of Gerontology University of Michigan Ann Arbor Michigan USA2SAS Institute Inc SAS Campus Drive Cary North Carolina USA
3Geriatrics Center University of Michigan Ann Arbor Michigan USA4Michigan Horace H Rackham School of Graduate Studies University of
Michigan Ann Arbor Michigan USA
ABSTRACT
We describe some theory and recent enhancements for the SAS macro NLINMIX(Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795) that enable model calculation to take placewithin the interaction matrix language SAS=IML (SAS Institute Inc (1999a)SAS=IML Userrsquos Guide Version 7 Cary NC SAS Institute Inc) They providegreater flexibility and scope for the specification and analysis of complexnonlinear mixed models For example using data from a frequently sampledintravenous glucose test we fit a two-compartment kinetics model that has noclosed-form representation It is derived as the solution of a system of ordinarydifferential equations and specified as such in SAS=IML Additional details andexample NLINMIX code are available in Appendix A
Correspondence Andrzej T Galecki Institute of Gerontology University of MichiganAnn Arbor MI 48109-2007 USA E-mail agaleckiumichedu
JOURNAL OF BIOPHARMACEUTICAL STATISTICS
Vol 14 No 2 pp 483ndash503 2004
483
DOI 101081BIP-120037194 1054-3406 (Print) 1520-5711 (Online)
Copyright 2004 by Marcel Dekker Inc wwwdekkercom
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Key Words Nonlinear mixed effects model Longitudinal data analysisPopulation pharmacokinetics and pharmacodynamics models Linearizationmethod SAS=IML macro Glucose disappearance model
Mathematics Subject Classification 62-07 62H12 62P10 65Y15 65L99
INTRODUCTION
Population pharmacokinetics and pharmacodynamics (PK=PD) data consist ofrepeated measurements taken on each of a number of individuals In PK studiesblood samples are drawn several times from each subject to investigate levels of a testagent in the blood and=or in the body over time In PD studies we measure aphysiological effect of a drug administered using different doses
Both population PK and PD data can be analyzed in the framework of nonlinearmixed effects models (NonLinMEM) (Davidian and Giltinan 1995) Inference aboutNonLinMEM parameters is one of the most challenging tasks in statistical modelingas it is necessary to take into account several aspects of the study design includingthe nonlinear shape of the response with respect to a set of parameters of interestand the fact that measurements taken from the same individual are likely to becorrelated In addition overall variation between measurements has to be properlypartitioned into between-and within-subject variation Population PK=PD data areespecially interesting examples of NonLinMEM in which a model for each subject isoften represented as a solution of a system of ordinary differential equations (ODE)
There are two common groups of methods to make inference on parametricNonLinMEM models those based on individual estimates and those based onapproximation of a marginal likelihood function The first group of methods is oftenreferred as two-stage approaches where parameters for each subject are estimated inthe first stage and these estimates are used as data in the second stage of analysis toestimate population parameters (Davidian and Giltinan 1995) These techniques areappealing in their computational simplicity and they naturally reflect hierarchies in aNonLinMEM model (eg within-and between-subject models) Two-stage methodsperform fairly well when the number of observations per individual is sufficient toreliably estimate individual parameters
The second group of estimation methods is based on approximation of amarginal likelihood function This group of methods is usually computationallymore intensive than the first one and are the methods of choice when data are sparseor when time-dependent covariates are present The main difficulty is that the mar-ginal likelihood function involves integration over the distribution of the randomeffects In the context of NonLinMEM this integral usually does not have a closedform solution so approximation of this integral is necessary Possible integralapproximations of the marginal likelihood function include those based on quadra-ture methods and on Taylor-series linearization (Davidian and Giltinan 1995Pinheiro and Bates 1995 Vonesh and Chinchilli 1997)
In this paper we focus our attention on linearization approximations in particu-lar those based on iteratively fitting a set of corresponding estimating equations(Wolfinger and Lin 1997) This kind of approach is often less accurate than other
484 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
more complex approximations but is usually more computationally robust It ismost effective in the common case in which the within- and between-subject errorsare approximately normally distributed and is similar but not identical to the first-order method popularized by the NONMEM package of Beal and Sheiner (1992)and also available in the NLMIXED procedure (SAS Institute Inc 1999b) It isimplemented in the nlme function in Splus and R (Pinheiro and Bates 2000) andin the SAS macros MIXNLIN (Vonesh and Chinchilli 1997) and NLINMIX
The main purpose of this paper is to present recently implemented new featuresto NLINMIX enabling a wide range of population PK=PD models One of thecritical developments is that a formerly independent NLMEM macro (Galecki1998) has been integrated into NLINMIX so that models specified as a solutionof a system of ODE can now be addressed The next sections describe the modeland estimation algorithms and these are then illustrated with a new data set onglucose elimination Other improvements and implemented features of NLINMIXare presented in detail in the Appendix A
STATISTICAL MODEL
Using the notation presented in Table 1 the hierarchical nonlinear modelconsidered here is specified as follows
Stage 1 Within-subject (WS) variation
yij frac14 f ethxij d iTHORN thorn eij
for j frac14 1 mi or in vector notation
yi frac14 f iethd iTHORN thorn ei eth1THORNei jd iNeth0Riethd i hRTHORNTHORN
Stage 2 Between-subjects (BS) variation
d i frac14 dethai b biTHORNbi Neth0G iethhGTHORNTHORN
The model is similar to that specified in Davidian and Giltinan (1995) The onlydifference is how the intra-individual covariance structure Ri is factored In thisfactorization the diagonal weight matrix W i and covariance matrix Ri are usedconsistent with the syntax of the NLINMIX macro In Davidian and Giltinan(1995) the specification of the variance function is used instead of a weight functionIn contrast to the specification of Lindstrom and Bates (1990) a nonlinear model isallowed at the second stage of the hierarchy for between-subject variation
The specification of the model is general and can be further extended to addressother aspects of longitudinal data analysis In particular multiple outcomes canbe accommodated by allowing the model function f to be a vector This extensionleads to stacking response vectors for different dependent variables from thesame individual in the model formula (1) In addition to time-dependent covariates
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 485
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
being addressed in stage 1 they also can be addressed at stage 2 of the hierarchyby allowing the individual regression parameters d i to depend on time-varyingindividual-specific information Another possible extension is to introduce morethan two stages of hierarchy so multilevel hierarchical models can be addressedAll these extensions of the two-stage model can be addressed using the NLINMIXmacro presented in this paper
ESTIMATION
This section describes the linear approximation of the hierarchical nonlinearmodel This approximation is a basis of the estimation algorithm presented laterin this section
Linearization of the Model
Given b frac14 b and bi frac14 bi the two stages of hierarchical model presented in theprevious section can be approximated using a Taylor-series linearization in the
Table 1 Notation for nonlinear mixed effects model specification and related derivativefunctions
i Subject indexmi Number of measurements per subject ij Measurement index for subject i j frac14 1 2 mi
yi A mi 1 vector of responses yij for subject ixij A vector of time-dependent covariates for a subject i
describing condition(s) at which jth measurement was takend i A p 1 vector of subject-specific regression parametersf ethxij d iTHORN An expected conditional mean of the jth response yij for subject if iethd iTHORN A nonlinear vector function of d i whose jth component is equal to f ethxij d iTHORNDiethd iTHORN frac14 f ethd iTHORN=d i is a mi p matrix function of derivatives with respect to (wrt) d i
ei A mi 1 vector of residuals eij j frac14 1 2 mi for subject ihR Vector of covariance parameters for within-subject variationRiethhR d iTHORN A mi mi covariance matrix function for within-subject
heterogeneity of varianceW iethd iTHORN A mi mi diagonal weight matrix function depending on d i
Riethd i hRTHORN frac14W1=2i ethd iTHORNRiethd i hRTHORNW1=2
i ethd iTHORNai A a 1 vector of time-independent covariates for subject ib A r 1 vector regression parameters for the fixed effectsbi A q 1 vector of random effects associated with subject idethai b biTHORN A nonlinear vector function of ai b and bi differentiable wrt b and biAethai b biTHORN frac14 dethai b biTHORN=b a p r matrix function of partial derivatives wrt bBethai b biTHORN frac14 dethai b biTHORN=bi a p q matrix function of partial derivatives wrt bihG Vector of covariance parameters for between-subject variationG iethhGTHORN A q q covariance matrix function for the between-subjects heterogeneity
of variance depending on a vector of covariance parameters hG
486 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
neighborhood of b and bi as follows
Stage 1 Approximation
yi frac14 f iethdi THORN thornDi ethd i di THORN thorn ei eth2THORNei jd i Neth0Ri ethhRTHORNTHORNStage 2 Approximation
d i frac14 di thorn Ai eth b bTHORN thorn Bi ethbi bi THORN eth3THORNbi Neth0G iethhGTHORNTHORN
where di frac14 dethai b bi THORN Di frac14 Diethdi THORN Ai frac14 Aethai b bi THORN Bi frac14 Bethai b bi THORN Wi frac14
W iethdi THORN Ri ethYRTHORN frac14 Riethdi YRTHORN and Ri ethYRTHORN frac14Weth1=2THORNi Ri ethYRTHORNWeth1=2THORN
i
The two stages of the hierarchy (Eqs 2 and 3) can be combined into thefollowing model
yi frac14 f iethdi THORN thorn Xi ethb bTHORN thorn Zi ethbi bi THORN thorn ei eth4THORNwhere Xi frac14 DiA
i and Zi frac14 Di B
i
After rearranging terms in Eq (4) the model can be expressed as a linear mixedeffects model in terms of b and the birsquos
vi frac14 Xi b thorn Zi bi thorn ei eth5THORNwhere
vi frac14 yi f iethdi THORN thorn Xi b thorn Zi b
i
Note that in this approximation the matrix of derivatives Bi and consequentlyexpression Zi b
i are evaluated at bi frac14 bi This approximation is referred to as a
second-order linearization (Lindstrom and Bates 1990) or a conditional first-orderlinearization (Davidian and Giltinan 1995) The second-order approximation maybe simplified by omitting term Zi bi from expression (5) which is equivalent tosetting bi frac14 0 This simplified approximation is referred as a first-order linearizationAn intermediate case in which selected elements of vector bi are set to zero in Zi b
i is
referred to as a hybrid linearization The linear approximation Eq (5) is used in thelinear mixed effects (LME) step of the iterative algorithm presented in the nextsection Additional details can be found in Vonesh and Chinchilli (1997)
Computational Algorithm
Several iterative algorithms have been proposed to implement a linearizationmethod The algorithm used in NLINMIX are presented in Wolfinger and Lin(1997) Details of the algorithm are illustrated in Fig 1
The algorithm optionally uses an initial call to the nonlinear regression (NLINstep) to refine initial values for b estimates Predictors of bi are set to zero and are notupdated at the initial NLIN step By default during subsequent iterations the
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 487
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
algorithm alternates between the following two steps (1) the pseudo-data (P-D)generation step and (2) the linear mixed effects (LME) step
In the P-D generation step derivative matrices Ai Bi D
i X
i Z
i and weighting
matrix Wi are calculated at current values of b frac14 b and bi frac14 0 (first-order lineariza-
tion) In case we want to apply second-order linearization we set bi frac14 bi Similarilyin case of hybrid linearization selected elements of bi are set to zero Matrices Xiand Zi are subsequently used to calculate a working dependent vector vi so theLME step can be performed using Eq (5)
In the LME step ML or REML estimates of covariance parameters hR and hGfrom a previous iteration are refined iteratively Given hR and hG vectors b
and biare updated by solving mixed model equations (MME) which completes LME step
New b and bi values are then used in subsequent P-D step New YR and YG
estimates are used in a subsequent LME step to initiate ML or REML subiterationsThe iterative process is continued until the difference between estimates of b and thecovariance parameter estimates between the current and previous iteration satisfiesconvergence criteria
EXAMPLE
The use of NLINMIX for models specified using SAS=IML is illustrated usingoriginal data from a population pharmacokinetics study of the glucose disappear-ance in old subjects with a normal glucose tolerance Each subject underwentfrequently sampled intravenous glucose test (FSIVGTT) An initial bolus dose ofglucose was administered intravenously to each of 10 subjects
For a given subject glucose and insulin concentration plasma levels are mea-sured m frac14 30 times between 0 minutes and 180 minutes after glucose injectionFor notational simplicity and to be consistent with IML modules syntax the subjectsubscript i frac14 1 10 is omitted in considerations below
The data consist of 30 glucose and insulin plasma concentrationsGeth1THORN Geth30THORN from each subject measured at prespecified time points t1 t30
Figure 1 Computational algorithm
488 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Ordinary Differential Equation PK=PD ModelsUsing the SAS Macro NLINMIX
Andrzej T Galecki1 Russell D Wolfinger2 Oscar A Linares34
Marla J Smith3 and Jeffrey B Halter13
1Institute of Gerontology University of Michigan Ann Arbor Michigan USA2SAS Institute Inc SAS Campus Drive Cary North Carolina USA
3Geriatrics Center University of Michigan Ann Arbor Michigan USA4Michigan Horace H Rackham School of Graduate Studies University of
Michigan Ann Arbor Michigan USA
ABSTRACT
We describe some theory and recent enhancements for the SAS macro NLINMIX(Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795) that enable model calculation to take placewithin the interaction matrix language SAS=IML (SAS Institute Inc (1999a)SAS=IML Userrsquos Guide Version 7 Cary NC SAS Institute Inc) They providegreater flexibility and scope for the specification and analysis of complexnonlinear mixed models For example using data from a frequently sampledintravenous glucose test we fit a two-compartment kinetics model that has noclosed-form representation It is derived as the solution of a system of ordinarydifferential equations and specified as such in SAS=IML Additional details andexample NLINMIX code are available in Appendix A
Correspondence Andrzej T Galecki Institute of Gerontology University of MichiganAnn Arbor MI 48109-2007 USA E-mail agaleckiumichedu
JOURNAL OF BIOPHARMACEUTICAL STATISTICS
Vol 14 No 2 pp 483ndash503 2004
483
DOI 101081BIP-120037194 1054-3406 (Print) 1520-5711 (Online)
Copyright 2004 by Marcel Dekker Inc wwwdekkercom
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Key Words Nonlinear mixed effects model Longitudinal data analysisPopulation pharmacokinetics and pharmacodynamics models Linearizationmethod SAS=IML macro Glucose disappearance model
Mathematics Subject Classification 62-07 62H12 62P10 65Y15 65L99
INTRODUCTION
Population pharmacokinetics and pharmacodynamics (PK=PD) data consist ofrepeated measurements taken on each of a number of individuals In PK studiesblood samples are drawn several times from each subject to investigate levels of a testagent in the blood and=or in the body over time In PD studies we measure aphysiological effect of a drug administered using different doses
Both population PK and PD data can be analyzed in the framework of nonlinearmixed effects models (NonLinMEM) (Davidian and Giltinan 1995) Inference aboutNonLinMEM parameters is one of the most challenging tasks in statistical modelingas it is necessary to take into account several aspects of the study design includingthe nonlinear shape of the response with respect to a set of parameters of interestand the fact that measurements taken from the same individual are likely to becorrelated In addition overall variation between measurements has to be properlypartitioned into between-and within-subject variation Population PK=PD data areespecially interesting examples of NonLinMEM in which a model for each subject isoften represented as a solution of a system of ordinary differential equations (ODE)
There are two common groups of methods to make inference on parametricNonLinMEM models those based on individual estimates and those based onapproximation of a marginal likelihood function The first group of methods is oftenreferred as two-stage approaches where parameters for each subject are estimated inthe first stage and these estimates are used as data in the second stage of analysis toestimate population parameters (Davidian and Giltinan 1995) These techniques areappealing in their computational simplicity and they naturally reflect hierarchies in aNonLinMEM model (eg within-and between-subject models) Two-stage methodsperform fairly well when the number of observations per individual is sufficient toreliably estimate individual parameters
The second group of estimation methods is based on approximation of amarginal likelihood function This group of methods is usually computationallymore intensive than the first one and are the methods of choice when data are sparseor when time-dependent covariates are present The main difficulty is that the mar-ginal likelihood function involves integration over the distribution of the randomeffects In the context of NonLinMEM this integral usually does not have a closedform solution so approximation of this integral is necessary Possible integralapproximations of the marginal likelihood function include those based on quadra-ture methods and on Taylor-series linearization (Davidian and Giltinan 1995Pinheiro and Bates 1995 Vonesh and Chinchilli 1997)
In this paper we focus our attention on linearization approximations in particu-lar those based on iteratively fitting a set of corresponding estimating equations(Wolfinger and Lin 1997) This kind of approach is often less accurate than other
484 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
more complex approximations but is usually more computationally robust It ismost effective in the common case in which the within- and between-subject errorsare approximately normally distributed and is similar but not identical to the first-order method popularized by the NONMEM package of Beal and Sheiner (1992)and also available in the NLMIXED procedure (SAS Institute Inc 1999b) It isimplemented in the nlme function in Splus and R (Pinheiro and Bates 2000) andin the SAS macros MIXNLIN (Vonesh and Chinchilli 1997) and NLINMIX
The main purpose of this paper is to present recently implemented new featuresto NLINMIX enabling a wide range of population PK=PD models One of thecritical developments is that a formerly independent NLMEM macro (Galecki1998) has been integrated into NLINMIX so that models specified as a solutionof a system of ODE can now be addressed The next sections describe the modeland estimation algorithms and these are then illustrated with a new data set onglucose elimination Other improvements and implemented features of NLINMIXare presented in detail in the Appendix A
STATISTICAL MODEL
Using the notation presented in Table 1 the hierarchical nonlinear modelconsidered here is specified as follows
Stage 1 Within-subject (WS) variation
yij frac14 f ethxij d iTHORN thorn eij
for j frac14 1 mi or in vector notation
yi frac14 f iethd iTHORN thorn ei eth1THORNei jd iNeth0Riethd i hRTHORNTHORN
Stage 2 Between-subjects (BS) variation
d i frac14 dethai b biTHORNbi Neth0G iethhGTHORNTHORN
The model is similar to that specified in Davidian and Giltinan (1995) The onlydifference is how the intra-individual covariance structure Ri is factored In thisfactorization the diagonal weight matrix W i and covariance matrix Ri are usedconsistent with the syntax of the NLINMIX macro In Davidian and Giltinan(1995) the specification of the variance function is used instead of a weight functionIn contrast to the specification of Lindstrom and Bates (1990) a nonlinear model isallowed at the second stage of the hierarchy for between-subject variation
The specification of the model is general and can be further extended to addressother aspects of longitudinal data analysis In particular multiple outcomes canbe accommodated by allowing the model function f to be a vector This extensionleads to stacking response vectors for different dependent variables from thesame individual in the model formula (1) In addition to time-dependent covariates
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 485
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
being addressed in stage 1 they also can be addressed at stage 2 of the hierarchyby allowing the individual regression parameters d i to depend on time-varyingindividual-specific information Another possible extension is to introduce morethan two stages of hierarchy so multilevel hierarchical models can be addressedAll these extensions of the two-stage model can be addressed using the NLINMIXmacro presented in this paper
ESTIMATION
This section describes the linear approximation of the hierarchical nonlinearmodel This approximation is a basis of the estimation algorithm presented laterin this section
Linearization of the Model
Given b frac14 b and bi frac14 bi the two stages of hierarchical model presented in theprevious section can be approximated using a Taylor-series linearization in the
Table 1 Notation for nonlinear mixed effects model specification and related derivativefunctions
i Subject indexmi Number of measurements per subject ij Measurement index for subject i j frac14 1 2 mi
yi A mi 1 vector of responses yij for subject ixij A vector of time-dependent covariates for a subject i
describing condition(s) at which jth measurement was takend i A p 1 vector of subject-specific regression parametersf ethxij d iTHORN An expected conditional mean of the jth response yij for subject if iethd iTHORN A nonlinear vector function of d i whose jth component is equal to f ethxij d iTHORNDiethd iTHORN frac14 f ethd iTHORN=d i is a mi p matrix function of derivatives with respect to (wrt) d i
ei A mi 1 vector of residuals eij j frac14 1 2 mi for subject ihR Vector of covariance parameters for within-subject variationRiethhR d iTHORN A mi mi covariance matrix function for within-subject
heterogeneity of varianceW iethd iTHORN A mi mi diagonal weight matrix function depending on d i
Riethd i hRTHORN frac14W1=2i ethd iTHORNRiethd i hRTHORNW1=2
i ethd iTHORNai A a 1 vector of time-independent covariates for subject ib A r 1 vector regression parameters for the fixed effectsbi A q 1 vector of random effects associated with subject idethai b biTHORN A nonlinear vector function of ai b and bi differentiable wrt b and biAethai b biTHORN frac14 dethai b biTHORN=b a p r matrix function of partial derivatives wrt bBethai b biTHORN frac14 dethai b biTHORN=bi a p q matrix function of partial derivatives wrt bihG Vector of covariance parameters for between-subject variationG iethhGTHORN A q q covariance matrix function for the between-subjects heterogeneity
of variance depending on a vector of covariance parameters hG
486 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
neighborhood of b and bi as follows
Stage 1 Approximation
yi frac14 f iethdi THORN thornDi ethd i di THORN thorn ei eth2THORNei jd i Neth0Ri ethhRTHORNTHORNStage 2 Approximation
d i frac14 di thorn Ai eth b bTHORN thorn Bi ethbi bi THORN eth3THORNbi Neth0G iethhGTHORNTHORN
where di frac14 dethai b bi THORN Di frac14 Diethdi THORN Ai frac14 Aethai b bi THORN Bi frac14 Bethai b bi THORN Wi frac14
W iethdi THORN Ri ethYRTHORN frac14 Riethdi YRTHORN and Ri ethYRTHORN frac14Weth1=2THORNi Ri ethYRTHORNWeth1=2THORN
i
The two stages of the hierarchy (Eqs 2 and 3) can be combined into thefollowing model
yi frac14 f iethdi THORN thorn Xi ethb bTHORN thorn Zi ethbi bi THORN thorn ei eth4THORNwhere Xi frac14 DiA
i and Zi frac14 Di B
i
After rearranging terms in Eq (4) the model can be expressed as a linear mixedeffects model in terms of b and the birsquos
vi frac14 Xi b thorn Zi bi thorn ei eth5THORNwhere
vi frac14 yi f iethdi THORN thorn Xi b thorn Zi b
i
Note that in this approximation the matrix of derivatives Bi and consequentlyexpression Zi b
i are evaluated at bi frac14 bi This approximation is referred to as a
second-order linearization (Lindstrom and Bates 1990) or a conditional first-orderlinearization (Davidian and Giltinan 1995) The second-order approximation maybe simplified by omitting term Zi bi from expression (5) which is equivalent tosetting bi frac14 0 This simplified approximation is referred as a first-order linearizationAn intermediate case in which selected elements of vector bi are set to zero in Zi b
i is
referred to as a hybrid linearization The linear approximation Eq (5) is used in thelinear mixed effects (LME) step of the iterative algorithm presented in the nextsection Additional details can be found in Vonesh and Chinchilli (1997)
Computational Algorithm
Several iterative algorithms have been proposed to implement a linearizationmethod The algorithm used in NLINMIX are presented in Wolfinger and Lin(1997) Details of the algorithm are illustrated in Fig 1
The algorithm optionally uses an initial call to the nonlinear regression (NLINstep) to refine initial values for b estimates Predictors of bi are set to zero and are notupdated at the initial NLIN step By default during subsequent iterations the
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 487
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
algorithm alternates between the following two steps (1) the pseudo-data (P-D)generation step and (2) the linear mixed effects (LME) step
In the P-D generation step derivative matrices Ai Bi D
i X
i Z
i and weighting
matrix Wi are calculated at current values of b frac14 b and bi frac14 0 (first-order lineariza-
tion) In case we want to apply second-order linearization we set bi frac14 bi Similarilyin case of hybrid linearization selected elements of bi are set to zero Matrices Xiand Zi are subsequently used to calculate a working dependent vector vi so theLME step can be performed using Eq (5)
In the LME step ML or REML estimates of covariance parameters hR and hGfrom a previous iteration are refined iteratively Given hR and hG vectors b
and biare updated by solving mixed model equations (MME) which completes LME step
New b and bi values are then used in subsequent P-D step New YR and YG
estimates are used in a subsequent LME step to initiate ML or REML subiterationsThe iterative process is continued until the difference between estimates of b and thecovariance parameter estimates between the current and previous iteration satisfiesconvergence criteria
EXAMPLE
The use of NLINMIX for models specified using SAS=IML is illustrated usingoriginal data from a population pharmacokinetics study of the glucose disappear-ance in old subjects with a normal glucose tolerance Each subject underwentfrequently sampled intravenous glucose test (FSIVGTT) An initial bolus dose ofglucose was administered intravenously to each of 10 subjects
For a given subject glucose and insulin concentration plasma levels are mea-sured m frac14 30 times between 0 minutes and 180 minutes after glucose injectionFor notational simplicity and to be consistent with IML modules syntax the subjectsubscript i frac14 1 10 is omitted in considerations below
The data consist of 30 glucose and insulin plasma concentrationsGeth1THORN Geth30THORN from each subject measured at prespecified time points t1 t30
Figure 1 Computational algorithm
488 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Key Words Nonlinear mixed effects model Longitudinal data analysisPopulation pharmacokinetics and pharmacodynamics models Linearizationmethod SAS=IML macro Glucose disappearance model
Mathematics Subject Classification 62-07 62H12 62P10 65Y15 65L99
INTRODUCTION
Population pharmacokinetics and pharmacodynamics (PK=PD) data consist ofrepeated measurements taken on each of a number of individuals In PK studiesblood samples are drawn several times from each subject to investigate levels of a testagent in the blood and=or in the body over time In PD studies we measure aphysiological effect of a drug administered using different doses
Both population PK and PD data can be analyzed in the framework of nonlinearmixed effects models (NonLinMEM) (Davidian and Giltinan 1995) Inference aboutNonLinMEM parameters is one of the most challenging tasks in statistical modelingas it is necessary to take into account several aspects of the study design includingthe nonlinear shape of the response with respect to a set of parameters of interestand the fact that measurements taken from the same individual are likely to becorrelated In addition overall variation between measurements has to be properlypartitioned into between-and within-subject variation Population PK=PD data areespecially interesting examples of NonLinMEM in which a model for each subject isoften represented as a solution of a system of ordinary differential equations (ODE)
There are two common groups of methods to make inference on parametricNonLinMEM models those based on individual estimates and those based onapproximation of a marginal likelihood function The first group of methods is oftenreferred as two-stage approaches where parameters for each subject are estimated inthe first stage and these estimates are used as data in the second stage of analysis toestimate population parameters (Davidian and Giltinan 1995) These techniques areappealing in their computational simplicity and they naturally reflect hierarchies in aNonLinMEM model (eg within-and between-subject models) Two-stage methodsperform fairly well when the number of observations per individual is sufficient toreliably estimate individual parameters
The second group of estimation methods is based on approximation of amarginal likelihood function This group of methods is usually computationallymore intensive than the first one and are the methods of choice when data are sparseor when time-dependent covariates are present The main difficulty is that the mar-ginal likelihood function involves integration over the distribution of the randomeffects In the context of NonLinMEM this integral usually does not have a closedform solution so approximation of this integral is necessary Possible integralapproximations of the marginal likelihood function include those based on quadra-ture methods and on Taylor-series linearization (Davidian and Giltinan 1995Pinheiro and Bates 1995 Vonesh and Chinchilli 1997)
In this paper we focus our attention on linearization approximations in particu-lar those based on iteratively fitting a set of corresponding estimating equations(Wolfinger and Lin 1997) This kind of approach is often less accurate than other
484 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
more complex approximations but is usually more computationally robust It ismost effective in the common case in which the within- and between-subject errorsare approximately normally distributed and is similar but not identical to the first-order method popularized by the NONMEM package of Beal and Sheiner (1992)and also available in the NLMIXED procedure (SAS Institute Inc 1999b) It isimplemented in the nlme function in Splus and R (Pinheiro and Bates 2000) andin the SAS macros MIXNLIN (Vonesh and Chinchilli 1997) and NLINMIX
The main purpose of this paper is to present recently implemented new featuresto NLINMIX enabling a wide range of population PK=PD models One of thecritical developments is that a formerly independent NLMEM macro (Galecki1998) has been integrated into NLINMIX so that models specified as a solutionof a system of ODE can now be addressed The next sections describe the modeland estimation algorithms and these are then illustrated with a new data set onglucose elimination Other improvements and implemented features of NLINMIXare presented in detail in the Appendix A
STATISTICAL MODEL
Using the notation presented in Table 1 the hierarchical nonlinear modelconsidered here is specified as follows
Stage 1 Within-subject (WS) variation
yij frac14 f ethxij d iTHORN thorn eij
for j frac14 1 mi or in vector notation
yi frac14 f iethd iTHORN thorn ei eth1THORNei jd iNeth0Riethd i hRTHORNTHORN
Stage 2 Between-subjects (BS) variation
d i frac14 dethai b biTHORNbi Neth0G iethhGTHORNTHORN
The model is similar to that specified in Davidian and Giltinan (1995) The onlydifference is how the intra-individual covariance structure Ri is factored In thisfactorization the diagonal weight matrix W i and covariance matrix Ri are usedconsistent with the syntax of the NLINMIX macro In Davidian and Giltinan(1995) the specification of the variance function is used instead of a weight functionIn contrast to the specification of Lindstrom and Bates (1990) a nonlinear model isallowed at the second stage of the hierarchy for between-subject variation
The specification of the model is general and can be further extended to addressother aspects of longitudinal data analysis In particular multiple outcomes canbe accommodated by allowing the model function f to be a vector This extensionleads to stacking response vectors for different dependent variables from thesame individual in the model formula (1) In addition to time-dependent covariates
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 485
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
being addressed in stage 1 they also can be addressed at stage 2 of the hierarchyby allowing the individual regression parameters d i to depend on time-varyingindividual-specific information Another possible extension is to introduce morethan two stages of hierarchy so multilevel hierarchical models can be addressedAll these extensions of the two-stage model can be addressed using the NLINMIXmacro presented in this paper
ESTIMATION
This section describes the linear approximation of the hierarchical nonlinearmodel This approximation is a basis of the estimation algorithm presented laterin this section
Linearization of the Model
Given b frac14 b and bi frac14 bi the two stages of hierarchical model presented in theprevious section can be approximated using a Taylor-series linearization in the
Table 1 Notation for nonlinear mixed effects model specification and related derivativefunctions
i Subject indexmi Number of measurements per subject ij Measurement index for subject i j frac14 1 2 mi
yi A mi 1 vector of responses yij for subject ixij A vector of time-dependent covariates for a subject i
describing condition(s) at which jth measurement was takend i A p 1 vector of subject-specific regression parametersf ethxij d iTHORN An expected conditional mean of the jth response yij for subject if iethd iTHORN A nonlinear vector function of d i whose jth component is equal to f ethxij d iTHORNDiethd iTHORN frac14 f ethd iTHORN=d i is a mi p matrix function of derivatives with respect to (wrt) d i
ei A mi 1 vector of residuals eij j frac14 1 2 mi for subject ihR Vector of covariance parameters for within-subject variationRiethhR d iTHORN A mi mi covariance matrix function for within-subject
heterogeneity of varianceW iethd iTHORN A mi mi diagonal weight matrix function depending on d i
Riethd i hRTHORN frac14W1=2i ethd iTHORNRiethd i hRTHORNW1=2
i ethd iTHORNai A a 1 vector of time-independent covariates for subject ib A r 1 vector regression parameters for the fixed effectsbi A q 1 vector of random effects associated with subject idethai b biTHORN A nonlinear vector function of ai b and bi differentiable wrt b and biAethai b biTHORN frac14 dethai b biTHORN=b a p r matrix function of partial derivatives wrt bBethai b biTHORN frac14 dethai b biTHORN=bi a p q matrix function of partial derivatives wrt bihG Vector of covariance parameters for between-subject variationG iethhGTHORN A q q covariance matrix function for the between-subjects heterogeneity
of variance depending on a vector of covariance parameters hG
486 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
neighborhood of b and bi as follows
Stage 1 Approximation
yi frac14 f iethdi THORN thornDi ethd i di THORN thorn ei eth2THORNei jd i Neth0Ri ethhRTHORNTHORNStage 2 Approximation
d i frac14 di thorn Ai eth b bTHORN thorn Bi ethbi bi THORN eth3THORNbi Neth0G iethhGTHORNTHORN
where di frac14 dethai b bi THORN Di frac14 Diethdi THORN Ai frac14 Aethai b bi THORN Bi frac14 Bethai b bi THORN Wi frac14
W iethdi THORN Ri ethYRTHORN frac14 Riethdi YRTHORN and Ri ethYRTHORN frac14Weth1=2THORNi Ri ethYRTHORNWeth1=2THORN
i
The two stages of the hierarchy (Eqs 2 and 3) can be combined into thefollowing model
yi frac14 f iethdi THORN thorn Xi ethb bTHORN thorn Zi ethbi bi THORN thorn ei eth4THORNwhere Xi frac14 DiA
i and Zi frac14 Di B
i
After rearranging terms in Eq (4) the model can be expressed as a linear mixedeffects model in terms of b and the birsquos
vi frac14 Xi b thorn Zi bi thorn ei eth5THORNwhere
vi frac14 yi f iethdi THORN thorn Xi b thorn Zi b
i
Note that in this approximation the matrix of derivatives Bi and consequentlyexpression Zi b
i are evaluated at bi frac14 bi This approximation is referred to as a
second-order linearization (Lindstrom and Bates 1990) or a conditional first-orderlinearization (Davidian and Giltinan 1995) The second-order approximation maybe simplified by omitting term Zi bi from expression (5) which is equivalent tosetting bi frac14 0 This simplified approximation is referred as a first-order linearizationAn intermediate case in which selected elements of vector bi are set to zero in Zi b
i is
referred to as a hybrid linearization The linear approximation Eq (5) is used in thelinear mixed effects (LME) step of the iterative algorithm presented in the nextsection Additional details can be found in Vonesh and Chinchilli (1997)
Computational Algorithm
Several iterative algorithms have been proposed to implement a linearizationmethod The algorithm used in NLINMIX are presented in Wolfinger and Lin(1997) Details of the algorithm are illustrated in Fig 1
The algorithm optionally uses an initial call to the nonlinear regression (NLINstep) to refine initial values for b estimates Predictors of bi are set to zero and are notupdated at the initial NLIN step By default during subsequent iterations the
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 487
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
algorithm alternates between the following two steps (1) the pseudo-data (P-D)generation step and (2) the linear mixed effects (LME) step
In the P-D generation step derivative matrices Ai Bi D
i X
i Z
i and weighting
matrix Wi are calculated at current values of b frac14 b and bi frac14 0 (first-order lineariza-
tion) In case we want to apply second-order linearization we set bi frac14 bi Similarilyin case of hybrid linearization selected elements of bi are set to zero Matrices Xiand Zi are subsequently used to calculate a working dependent vector vi so theLME step can be performed using Eq (5)
In the LME step ML or REML estimates of covariance parameters hR and hGfrom a previous iteration are refined iteratively Given hR and hG vectors b
and biare updated by solving mixed model equations (MME) which completes LME step
New b and bi values are then used in subsequent P-D step New YR and YG
estimates are used in a subsequent LME step to initiate ML or REML subiterationsThe iterative process is continued until the difference between estimates of b and thecovariance parameter estimates between the current and previous iteration satisfiesconvergence criteria
EXAMPLE
The use of NLINMIX for models specified using SAS=IML is illustrated usingoriginal data from a population pharmacokinetics study of the glucose disappear-ance in old subjects with a normal glucose tolerance Each subject underwentfrequently sampled intravenous glucose test (FSIVGTT) An initial bolus dose ofglucose was administered intravenously to each of 10 subjects
For a given subject glucose and insulin concentration plasma levels are mea-sured m frac14 30 times between 0 minutes and 180 minutes after glucose injectionFor notational simplicity and to be consistent with IML modules syntax the subjectsubscript i frac14 1 10 is omitted in considerations below
The data consist of 30 glucose and insulin plasma concentrationsGeth1THORN Geth30THORN from each subject measured at prespecified time points t1 t30
Figure 1 Computational algorithm
488 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
more complex approximations but is usually more computationally robust It ismost effective in the common case in which the within- and between-subject errorsare approximately normally distributed and is similar but not identical to the first-order method popularized by the NONMEM package of Beal and Sheiner (1992)and also available in the NLMIXED procedure (SAS Institute Inc 1999b) It isimplemented in the nlme function in Splus and R (Pinheiro and Bates 2000) andin the SAS macros MIXNLIN (Vonesh and Chinchilli 1997) and NLINMIX
The main purpose of this paper is to present recently implemented new featuresto NLINMIX enabling a wide range of population PK=PD models One of thecritical developments is that a formerly independent NLMEM macro (Galecki1998) has been integrated into NLINMIX so that models specified as a solutionof a system of ODE can now be addressed The next sections describe the modeland estimation algorithms and these are then illustrated with a new data set onglucose elimination Other improvements and implemented features of NLINMIXare presented in detail in the Appendix A
STATISTICAL MODEL
Using the notation presented in Table 1 the hierarchical nonlinear modelconsidered here is specified as follows
Stage 1 Within-subject (WS) variation
yij frac14 f ethxij d iTHORN thorn eij
for j frac14 1 mi or in vector notation
yi frac14 f iethd iTHORN thorn ei eth1THORNei jd iNeth0Riethd i hRTHORNTHORN
Stage 2 Between-subjects (BS) variation
d i frac14 dethai b biTHORNbi Neth0G iethhGTHORNTHORN
The model is similar to that specified in Davidian and Giltinan (1995) The onlydifference is how the intra-individual covariance structure Ri is factored In thisfactorization the diagonal weight matrix W i and covariance matrix Ri are usedconsistent with the syntax of the NLINMIX macro In Davidian and Giltinan(1995) the specification of the variance function is used instead of a weight functionIn contrast to the specification of Lindstrom and Bates (1990) a nonlinear model isallowed at the second stage of the hierarchy for between-subject variation
The specification of the model is general and can be further extended to addressother aspects of longitudinal data analysis In particular multiple outcomes canbe accommodated by allowing the model function f to be a vector This extensionleads to stacking response vectors for different dependent variables from thesame individual in the model formula (1) In addition to time-dependent covariates
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 485
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
being addressed in stage 1 they also can be addressed at stage 2 of the hierarchyby allowing the individual regression parameters d i to depend on time-varyingindividual-specific information Another possible extension is to introduce morethan two stages of hierarchy so multilevel hierarchical models can be addressedAll these extensions of the two-stage model can be addressed using the NLINMIXmacro presented in this paper
ESTIMATION
This section describes the linear approximation of the hierarchical nonlinearmodel This approximation is a basis of the estimation algorithm presented laterin this section
Linearization of the Model
Given b frac14 b and bi frac14 bi the two stages of hierarchical model presented in theprevious section can be approximated using a Taylor-series linearization in the
Table 1 Notation for nonlinear mixed effects model specification and related derivativefunctions
i Subject indexmi Number of measurements per subject ij Measurement index for subject i j frac14 1 2 mi
yi A mi 1 vector of responses yij for subject ixij A vector of time-dependent covariates for a subject i
describing condition(s) at which jth measurement was takend i A p 1 vector of subject-specific regression parametersf ethxij d iTHORN An expected conditional mean of the jth response yij for subject if iethd iTHORN A nonlinear vector function of d i whose jth component is equal to f ethxij d iTHORNDiethd iTHORN frac14 f ethd iTHORN=d i is a mi p matrix function of derivatives with respect to (wrt) d i
ei A mi 1 vector of residuals eij j frac14 1 2 mi for subject ihR Vector of covariance parameters for within-subject variationRiethhR d iTHORN A mi mi covariance matrix function for within-subject
heterogeneity of varianceW iethd iTHORN A mi mi diagonal weight matrix function depending on d i
Riethd i hRTHORN frac14W1=2i ethd iTHORNRiethd i hRTHORNW1=2
i ethd iTHORNai A a 1 vector of time-independent covariates for subject ib A r 1 vector regression parameters for the fixed effectsbi A q 1 vector of random effects associated with subject idethai b biTHORN A nonlinear vector function of ai b and bi differentiable wrt b and biAethai b biTHORN frac14 dethai b biTHORN=b a p r matrix function of partial derivatives wrt bBethai b biTHORN frac14 dethai b biTHORN=bi a p q matrix function of partial derivatives wrt bihG Vector of covariance parameters for between-subject variationG iethhGTHORN A q q covariance matrix function for the between-subjects heterogeneity
of variance depending on a vector of covariance parameters hG
486 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
neighborhood of b and bi as follows
Stage 1 Approximation
yi frac14 f iethdi THORN thornDi ethd i di THORN thorn ei eth2THORNei jd i Neth0Ri ethhRTHORNTHORNStage 2 Approximation
d i frac14 di thorn Ai eth b bTHORN thorn Bi ethbi bi THORN eth3THORNbi Neth0G iethhGTHORNTHORN
where di frac14 dethai b bi THORN Di frac14 Diethdi THORN Ai frac14 Aethai b bi THORN Bi frac14 Bethai b bi THORN Wi frac14
W iethdi THORN Ri ethYRTHORN frac14 Riethdi YRTHORN and Ri ethYRTHORN frac14Weth1=2THORNi Ri ethYRTHORNWeth1=2THORN
i
The two stages of the hierarchy (Eqs 2 and 3) can be combined into thefollowing model
yi frac14 f iethdi THORN thorn Xi ethb bTHORN thorn Zi ethbi bi THORN thorn ei eth4THORNwhere Xi frac14 DiA
i and Zi frac14 Di B
i
After rearranging terms in Eq (4) the model can be expressed as a linear mixedeffects model in terms of b and the birsquos
vi frac14 Xi b thorn Zi bi thorn ei eth5THORNwhere
vi frac14 yi f iethdi THORN thorn Xi b thorn Zi b
i
Note that in this approximation the matrix of derivatives Bi and consequentlyexpression Zi b
i are evaluated at bi frac14 bi This approximation is referred to as a
second-order linearization (Lindstrom and Bates 1990) or a conditional first-orderlinearization (Davidian and Giltinan 1995) The second-order approximation maybe simplified by omitting term Zi bi from expression (5) which is equivalent tosetting bi frac14 0 This simplified approximation is referred as a first-order linearizationAn intermediate case in which selected elements of vector bi are set to zero in Zi b
i is
referred to as a hybrid linearization The linear approximation Eq (5) is used in thelinear mixed effects (LME) step of the iterative algorithm presented in the nextsection Additional details can be found in Vonesh and Chinchilli (1997)
Computational Algorithm
Several iterative algorithms have been proposed to implement a linearizationmethod The algorithm used in NLINMIX are presented in Wolfinger and Lin(1997) Details of the algorithm are illustrated in Fig 1
The algorithm optionally uses an initial call to the nonlinear regression (NLINstep) to refine initial values for b estimates Predictors of bi are set to zero and are notupdated at the initial NLIN step By default during subsequent iterations the
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 487
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
algorithm alternates between the following two steps (1) the pseudo-data (P-D)generation step and (2) the linear mixed effects (LME) step
In the P-D generation step derivative matrices Ai Bi D
i X
i Z
i and weighting
matrix Wi are calculated at current values of b frac14 b and bi frac14 0 (first-order lineariza-
tion) In case we want to apply second-order linearization we set bi frac14 bi Similarilyin case of hybrid linearization selected elements of bi are set to zero Matrices Xiand Zi are subsequently used to calculate a working dependent vector vi so theLME step can be performed using Eq (5)
In the LME step ML or REML estimates of covariance parameters hR and hGfrom a previous iteration are refined iteratively Given hR and hG vectors b
and biare updated by solving mixed model equations (MME) which completes LME step
New b and bi values are then used in subsequent P-D step New YR and YG
estimates are used in a subsequent LME step to initiate ML or REML subiterationsThe iterative process is continued until the difference between estimates of b and thecovariance parameter estimates between the current and previous iteration satisfiesconvergence criteria
EXAMPLE
The use of NLINMIX for models specified using SAS=IML is illustrated usingoriginal data from a population pharmacokinetics study of the glucose disappear-ance in old subjects with a normal glucose tolerance Each subject underwentfrequently sampled intravenous glucose test (FSIVGTT) An initial bolus dose ofglucose was administered intravenously to each of 10 subjects
For a given subject glucose and insulin concentration plasma levels are mea-sured m frac14 30 times between 0 minutes and 180 minutes after glucose injectionFor notational simplicity and to be consistent with IML modules syntax the subjectsubscript i frac14 1 10 is omitted in considerations below
The data consist of 30 glucose and insulin plasma concentrationsGeth1THORN Geth30THORN from each subject measured at prespecified time points t1 t30
Figure 1 Computational algorithm
488 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
being addressed in stage 1 they also can be addressed at stage 2 of the hierarchyby allowing the individual regression parameters d i to depend on time-varyingindividual-specific information Another possible extension is to introduce morethan two stages of hierarchy so multilevel hierarchical models can be addressedAll these extensions of the two-stage model can be addressed using the NLINMIXmacro presented in this paper
ESTIMATION
This section describes the linear approximation of the hierarchical nonlinearmodel This approximation is a basis of the estimation algorithm presented laterin this section
Linearization of the Model
Given b frac14 b and bi frac14 bi the two stages of hierarchical model presented in theprevious section can be approximated using a Taylor-series linearization in the
Table 1 Notation for nonlinear mixed effects model specification and related derivativefunctions
i Subject indexmi Number of measurements per subject ij Measurement index for subject i j frac14 1 2 mi
yi A mi 1 vector of responses yij for subject ixij A vector of time-dependent covariates for a subject i
describing condition(s) at which jth measurement was takend i A p 1 vector of subject-specific regression parametersf ethxij d iTHORN An expected conditional mean of the jth response yij for subject if iethd iTHORN A nonlinear vector function of d i whose jth component is equal to f ethxij d iTHORNDiethd iTHORN frac14 f ethd iTHORN=d i is a mi p matrix function of derivatives with respect to (wrt) d i
ei A mi 1 vector of residuals eij j frac14 1 2 mi for subject ihR Vector of covariance parameters for within-subject variationRiethhR d iTHORN A mi mi covariance matrix function for within-subject
heterogeneity of varianceW iethd iTHORN A mi mi diagonal weight matrix function depending on d i
Riethd i hRTHORN frac14W1=2i ethd iTHORNRiethd i hRTHORNW1=2
i ethd iTHORNai A a 1 vector of time-independent covariates for subject ib A r 1 vector regression parameters for the fixed effectsbi A q 1 vector of random effects associated with subject idethai b biTHORN A nonlinear vector function of ai b and bi differentiable wrt b and biAethai b biTHORN frac14 dethai b biTHORN=b a p r matrix function of partial derivatives wrt bBethai b biTHORN frac14 dethai b biTHORN=bi a p q matrix function of partial derivatives wrt bihG Vector of covariance parameters for between-subject variationG iethhGTHORN A q q covariance matrix function for the between-subjects heterogeneity
of variance depending on a vector of covariance parameters hG
486 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
neighborhood of b and bi as follows
Stage 1 Approximation
yi frac14 f iethdi THORN thornDi ethd i di THORN thorn ei eth2THORNei jd i Neth0Ri ethhRTHORNTHORNStage 2 Approximation
d i frac14 di thorn Ai eth b bTHORN thorn Bi ethbi bi THORN eth3THORNbi Neth0G iethhGTHORNTHORN
where di frac14 dethai b bi THORN Di frac14 Diethdi THORN Ai frac14 Aethai b bi THORN Bi frac14 Bethai b bi THORN Wi frac14
W iethdi THORN Ri ethYRTHORN frac14 Riethdi YRTHORN and Ri ethYRTHORN frac14Weth1=2THORNi Ri ethYRTHORNWeth1=2THORN
i
The two stages of the hierarchy (Eqs 2 and 3) can be combined into thefollowing model
yi frac14 f iethdi THORN thorn Xi ethb bTHORN thorn Zi ethbi bi THORN thorn ei eth4THORNwhere Xi frac14 DiA
i and Zi frac14 Di B
i
After rearranging terms in Eq (4) the model can be expressed as a linear mixedeffects model in terms of b and the birsquos
vi frac14 Xi b thorn Zi bi thorn ei eth5THORNwhere
vi frac14 yi f iethdi THORN thorn Xi b thorn Zi b
i
Note that in this approximation the matrix of derivatives Bi and consequentlyexpression Zi b
i are evaluated at bi frac14 bi This approximation is referred to as a
second-order linearization (Lindstrom and Bates 1990) or a conditional first-orderlinearization (Davidian and Giltinan 1995) The second-order approximation maybe simplified by omitting term Zi bi from expression (5) which is equivalent tosetting bi frac14 0 This simplified approximation is referred as a first-order linearizationAn intermediate case in which selected elements of vector bi are set to zero in Zi b
i is
referred to as a hybrid linearization The linear approximation Eq (5) is used in thelinear mixed effects (LME) step of the iterative algorithm presented in the nextsection Additional details can be found in Vonesh and Chinchilli (1997)
Computational Algorithm
Several iterative algorithms have been proposed to implement a linearizationmethod The algorithm used in NLINMIX are presented in Wolfinger and Lin(1997) Details of the algorithm are illustrated in Fig 1
The algorithm optionally uses an initial call to the nonlinear regression (NLINstep) to refine initial values for b estimates Predictors of bi are set to zero and are notupdated at the initial NLIN step By default during subsequent iterations the
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 487
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
algorithm alternates between the following two steps (1) the pseudo-data (P-D)generation step and (2) the linear mixed effects (LME) step
In the P-D generation step derivative matrices Ai Bi D
i X
i Z
i and weighting
matrix Wi are calculated at current values of b frac14 b and bi frac14 0 (first-order lineariza-
tion) In case we want to apply second-order linearization we set bi frac14 bi Similarilyin case of hybrid linearization selected elements of bi are set to zero Matrices Xiand Zi are subsequently used to calculate a working dependent vector vi so theLME step can be performed using Eq (5)
In the LME step ML or REML estimates of covariance parameters hR and hGfrom a previous iteration are refined iteratively Given hR and hG vectors b
and biare updated by solving mixed model equations (MME) which completes LME step
New b and bi values are then used in subsequent P-D step New YR and YG
estimates are used in a subsequent LME step to initiate ML or REML subiterationsThe iterative process is continued until the difference between estimates of b and thecovariance parameter estimates between the current and previous iteration satisfiesconvergence criteria
EXAMPLE
The use of NLINMIX for models specified using SAS=IML is illustrated usingoriginal data from a population pharmacokinetics study of the glucose disappear-ance in old subjects with a normal glucose tolerance Each subject underwentfrequently sampled intravenous glucose test (FSIVGTT) An initial bolus dose ofglucose was administered intravenously to each of 10 subjects
For a given subject glucose and insulin concentration plasma levels are mea-sured m frac14 30 times between 0 minutes and 180 minutes after glucose injectionFor notational simplicity and to be consistent with IML modules syntax the subjectsubscript i frac14 1 10 is omitted in considerations below
The data consist of 30 glucose and insulin plasma concentrationsGeth1THORN Geth30THORN from each subject measured at prespecified time points t1 t30
Figure 1 Computational algorithm
488 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
neighborhood of b and bi as follows
Stage 1 Approximation
yi frac14 f iethdi THORN thornDi ethd i di THORN thorn ei eth2THORNei jd i Neth0Ri ethhRTHORNTHORNStage 2 Approximation
d i frac14 di thorn Ai eth b bTHORN thorn Bi ethbi bi THORN eth3THORNbi Neth0G iethhGTHORNTHORN
where di frac14 dethai b bi THORN Di frac14 Diethdi THORN Ai frac14 Aethai b bi THORN Bi frac14 Bethai b bi THORN Wi frac14
W iethdi THORN Ri ethYRTHORN frac14 Riethdi YRTHORN and Ri ethYRTHORN frac14Weth1=2THORNi Ri ethYRTHORNWeth1=2THORN
i
The two stages of the hierarchy (Eqs 2 and 3) can be combined into thefollowing model
yi frac14 f iethdi THORN thorn Xi ethb bTHORN thorn Zi ethbi bi THORN thorn ei eth4THORNwhere Xi frac14 DiA
i and Zi frac14 Di B
i
After rearranging terms in Eq (4) the model can be expressed as a linear mixedeffects model in terms of b and the birsquos
vi frac14 Xi b thorn Zi bi thorn ei eth5THORNwhere
vi frac14 yi f iethdi THORN thorn Xi b thorn Zi b
i
Note that in this approximation the matrix of derivatives Bi and consequentlyexpression Zi b
i are evaluated at bi frac14 bi This approximation is referred to as a
second-order linearization (Lindstrom and Bates 1990) or a conditional first-orderlinearization (Davidian and Giltinan 1995) The second-order approximation maybe simplified by omitting term Zi bi from expression (5) which is equivalent tosetting bi frac14 0 This simplified approximation is referred as a first-order linearizationAn intermediate case in which selected elements of vector bi are set to zero in Zi b
i is
referred to as a hybrid linearization The linear approximation Eq (5) is used in thelinear mixed effects (LME) step of the iterative algorithm presented in the nextsection Additional details can be found in Vonesh and Chinchilli (1997)
Computational Algorithm
Several iterative algorithms have been proposed to implement a linearizationmethod The algorithm used in NLINMIX are presented in Wolfinger and Lin(1997) Details of the algorithm are illustrated in Fig 1
The algorithm optionally uses an initial call to the nonlinear regression (NLINstep) to refine initial values for b estimates Predictors of bi are set to zero and are notupdated at the initial NLIN step By default during subsequent iterations the
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 487
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
algorithm alternates between the following two steps (1) the pseudo-data (P-D)generation step and (2) the linear mixed effects (LME) step
In the P-D generation step derivative matrices Ai Bi D
i X
i Z
i and weighting
matrix Wi are calculated at current values of b frac14 b and bi frac14 0 (first-order lineariza-
tion) In case we want to apply second-order linearization we set bi frac14 bi Similarilyin case of hybrid linearization selected elements of bi are set to zero Matrices Xiand Zi are subsequently used to calculate a working dependent vector vi so theLME step can be performed using Eq (5)
In the LME step ML or REML estimates of covariance parameters hR and hGfrom a previous iteration are refined iteratively Given hR and hG vectors b
and biare updated by solving mixed model equations (MME) which completes LME step
New b and bi values are then used in subsequent P-D step New YR and YG
estimates are used in a subsequent LME step to initiate ML or REML subiterationsThe iterative process is continued until the difference between estimates of b and thecovariance parameter estimates between the current and previous iteration satisfiesconvergence criteria
EXAMPLE
The use of NLINMIX for models specified using SAS=IML is illustrated usingoriginal data from a population pharmacokinetics study of the glucose disappear-ance in old subjects with a normal glucose tolerance Each subject underwentfrequently sampled intravenous glucose test (FSIVGTT) An initial bolus dose ofglucose was administered intravenously to each of 10 subjects
For a given subject glucose and insulin concentration plasma levels are mea-sured m frac14 30 times between 0 minutes and 180 minutes after glucose injectionFor notational simplicity and to be consistent with IML modules syntax the subjectsubscript i frac14 1 10 is omitted in considerations below
The data consist of 30 glucose and insulin plasma concentrationsGeth1THORN Geth30THORN from each subject measured at prespecified time points t1 t30
Figure 1 Computational algorithm
488 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
algorithm alternates between the following two steps (1) the pseudo-data (P-D)generation step and (2) the linear mixed effects (LME) step
In the P-D generation step derivative matrices Ai Bi D
i X
i Z
i and weighting
matrix Wi are calculated at current values of b frac14 b and bi frac14 0 (first-order lineariza-
tion) In case we want to apply second-order linearization we set bi frac14 bi Similarilyin case of hybrid linearization selected elements of bi are set to zero Matrices Xiand Zi are subsequently used to calculate a working dependent vector vi so theLME step can be performed using Eq (5)
In the LME step ML or REML estimates of covariance parameters hR and hGfrom a previous iteration are refined iteratively Given hR and hG vectors b
and biare updated by solving mixed model equations (MME) which completes LME step
New b and bi values are then used in subsequent P-D step New YR and YG
estimates are used in a subsequent LME step to initiate ML or REML subiterationsThe iterative process is continued until the difference between estimates of b and thecovariance parameter estimates between the current and previous iteration satisfiesconvergence criteria
EXAMPLE
The use of NLINMIX for models specified using SAS=IML is illustrated usingoriginal data from a population pharmacokinetics study of the glucose disappear-ance in old subjects with a normal glucose tolerance Each subject underwentfrequently sampled intravenous glucose test (FSIVGTT) An initial bolus dose ofglucose was administered intravenously to each of 10 subjects
For a given subject glucose and insulin concentration plasma levels are mea-sured m frac14 30 times between 0 minutes and 180 minutes after glucose injectionFor notational simplicity and to be consistent with IML modules syntax the subjectsubscript i frac14 1 10 is omitted in considerations below
The data consist of 30 glucose and insulin plasma concentrationsGeth1THORN Geth30THORN from each subject measured at prespecified time points t1 t30
Figure 1 Computational algorithm
488 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
from 0 to 180 minutes Patientrsquos age is used as a covariate in this example Profiles ofthe 10 patients are displayed in Fig 2
Glucose disappearance is assumed to conform a nonlinear two-compartmentmodel with intravenous bolus of glucose administration Following Wastney et al(1999) the model is graphically presented in Fig 3 This model is also referred asa minimal model proposed by Bergman and Bowden (1981)
The model implies that a predicted glucose concentration gethtTHORN at time t in aprimary compartment and insulin level xethtTHORN in a so-called remote compartment
Figure 2 Individual profiles for 10 subjects
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 489
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
conform to the following system of two nonlinear ODE after a glucose bolus
_ggethtTHORN frac14 ethp1 thorn xethtTHORNTHORNgethtTHORN thorn p1Gb
_xxethtTHORN frac14 p2xethtTHORN thorn p3ethIethtTHORN IbTHORN
eth6THORN
with initial values at t frac14 0 geth0THORN frac14 g0 and xeth0THORN frac14 0 The system does not have aclosed form solution Gb and Ib called basal glucose and insulin respectively aresubject characteristics derived empirically We denote by d frac14 frac12p1 p2 p3 g00 a vectorof parameters for this model The parameter p1 is interpreted as glucose sensitivityand g0 is an estimated glucose level at time t1 frac14 0 The ratio of parameters sI frac14 p2=p3is interpreted as insulin sensitivity
Note that so far in this section we have assumed that the parameter vector d isgiven and consequently gdethtTHORN frac14 gethtTHORN and xdethtTHORN frac14 xethtTHORN are functions of time only Byallowing d to vary the model functions can be defined as follows
getht dTHORN frac14 gdethtTHORNxetht dTHORN frac14 xdethtTHORN
(
Then the population model for IVGTT is specified in the following two stages
Stage 1 Within-subject (WS) model
y frac14 gtethdTHORN thorn e
e j d Neth0 s2THORN
e j d N 0 s2g2etht1 dTHORN 0
0 g2ethtm dTHORN
2664
3775
0BB
1CCA eth7THORN
where y frac14 frac12y1 ym0 and gtethdTHORN frac14 frac12getht1 dTHORN gethtm dTHORN0
Figure 3 Model of glucose disappearance
490 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Stage 2 Nonlinear model for between-subjects (BS) variation
p1 frac14 b1 thorn u1
log10ethp2THORN frac14 b2 thorn u2
log10ethsI THORN frac14 b3 thorn ethage 70THORNb5 thorn u3
log10ethp3THORN frac14 log10ethp2THORN thorn log10ethsITHORN
u frac14u1u2u3
24
35 N 0
s211 s212 s213
s212 s222 s223
s213 s223 s233
2664
3775
0BB
1CCA
Note that the covariance matrix in Eq (7) implies conditional independence of thewithin-subject residual errors with a constant coefficient of variation
Calculations are performed using the NLINMIX macro in SAS=IML executionmode refer to Appendix A for details The remaining part of this sectiondescribes how to use the macro to fit this model to the IVGTT data The data arestored in a SAS dataset called IVGTT containing 300 records and five variablesID TIME AGE G T I T The code in Appendix A includes both the user-providedIML functions and the NLINMIX macro invocation for the two-compartmentmodel
The key part is the user-defined IML functions invoked from the useriml
macro The function GLCD defines the integrand function Eq (6) for an ODE Itis invoked from the function GLC SOLV which solves the ODE using theSAS=IML ODE function and returns the vector PREDV of predicted glucose valuesin compartment 1 Integration for each subject is performed numerically over timeintervals determined by the vector TIME with 30 elements Note that the functionGLCD contains a definition of six additional differential equations the so-calledsensitivity equations The sensitivity equations are integrated in the GLC SOLVfunction to calculate the partial derivatives getht dTHORN=d and xetht dTHORN=d Thefunction BSM defines the between-subject model and its derivatives with respectto bi
The SAS=IML functions defined in the useriml macro are then used in the model
argument to define a mapping from b bi ( B and U row vectors respectively in SASnotation) to f iethdethai b biTHORNTHORN (PREDV column vector in SAS notation) Partial deriva-tives of the d function with respect to the fixed effects and random effects arecomputed analytically by BSM SAS=IML function and returned by the DBSM func-tion Partial derivatives for superimposed functions f i and d are calculated using thechain rule and are stored in the matrix DPREDV Note that DPREDV is listed inthe globvar argument so that it can be passed from a SAS=IML function definedby model to a function defined by the derivs argument In this way the derivativematrices DB and DU can be extracted from DPREDV in derivs argument asneeded To address rounding errors during numerical integration the convergencecriterion is set to a more liberal value 1E-3 increased from the default value of 1E-8
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 491
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Calculations were performed on a Sun Blade 1000 workstation (Solaris 8) usingSAS Version 82 The algorithm converged successfully in five iterations (27 secCPU) and produces the following parameter estimates
Iteration History Extracted from SAS Log
The NLINMIX Macro
Data Set fsivgtt
Response g_t
Fixed-Effect Parameters beta1 beta2 beta3 beta4 beta5
Random-Effect Parameters u1 u2 u3
Expansion Point zero
Iteratively calling PROC MIXED
PROC MIXED call 0
iteration = 0
convergence criterion =
beta1=002 beta2=-2 beta3=-3 beta4=250 beta5=0
COVP1=0000117471
COVP2=-000244529 COVP3= 0128204017
COVP4= 000282178 COVP5=-0084482893 COVP6=00917336449
COVP7=00070584159
(iterations 1 through 3 omitted)
iteration = 4
beta1=0023464368 beta2=-1647843655 beta3=-3402938866
beta4=2788343188 beta5=-0213441218
COVP1= 000012790
COVP2=-000209429 COVP3 =0110625648
COVP4=0001486708 COVP5=-0031203057 COVP6=00535009216
COVP7=00064359279
NLINMIX convergence criteria met
Parameter Estimates Extracted from SAS Output
Standard 95 CI
Effect Estimate Error Lower Upper
D_BETA1 00235 00040 00156 00313 b1D_BETA2 -16476 01346 -19129 -13823 b2D_BETA3 -34031 00795 -35598 -32468 b3D_BETA4 27884 221 27448 28319 b4D_BETA5 -02135 08619 -19116 14846 b5
492 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(11) id 0000128 s211UN(21) id -0210 s212UN(22) id 01108 s222UN(31) id 01487 s213UN(32) id -00313 s223UN(33) id 00536 s233Residual 00064 s2
Population estimate for glucose sensitivity p1 is 00235E(SEfrac14 0004) Similarlythe estimate for a population insulin sensitivity sI expressed on an original scale is0003954 (0002763 000567 95 CI)
DISCUSSION
The SAS=IML execution mode of the NLINMIX macro presented in this paperis a substantial new feature which allows the fitting of ODE and other models thatare not tractable in the non-SAS=IML execution mode This new execution modemay be considered as an interface to IML for the NLINMIX macro The programretains all the advantages of the non-SAS=IML execution mode and adds the flexibleand powerful IML environment In particular the program can fit models in whichfunctions f i and d are defined implicitly Important examples are when f i isexpressed as a numerical solution to a set of ODEs for pharmacokinetics andpharmacodynamics modeling
SAS=IML also substantially simplifies the specification of the model Whenusing a naming convention for selected variables (eg Y for the dependent variableTIME for experiment time or DOSE for instantaneous bolus doses into dosecompartment) a library of SAS=IML functions for selected within-subject modelscan be created and user-defined IML code can be further simplified The use ofthe SAS environment also allows users to use several powerful features to processoutput datasets from NLINMIX especially in combination with the accumulationof intermediate results using the append argument The macro has been extensivelytested using several population PK=PD data In one group of tests parameterestimates and their standard errors were compared to those obtained using othersoftware Other tests involved comparing results for ODE models which had bothnumerical and analytical solution All tests led to very similar results As with mostiterative numerical procedures stability and performance can degrade when theselected model (including starting values) and data do not match well Examplesof this include cases when the data are too noisy to extract pharmacokinetic trendsor when an overly complex model is fitted to a small data set However for standardPK=PD data sets like the one considered in the example the method convergesrobustly and parameter estimates are stable To conclude the NLINMIX macroexecuted in SAS=IML mode constitutes an attractive option for the analysis ofpopulation pharmacokinetics and pharmacodynamics studies
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 493
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
APPENDIX A
THE NLINMIX MACRO
NLINMIX is a SAS macro that estimates nonlinear mixed models using alinearization approximation It has been under development for about 10 yearsand the most current version is compatible with SAS Version 8 Source code fornon-SAS=IML including documentation and examples is available at http==ftpsascom=techsup=download=stat=nlmm800sas
Additional code that allows NLINMIX to run in SAS=IML mode is available inthe NLMEM macro (Galecki 1998) Starting with SAS Version 8 NLMEM hasbeen redesigned so that it can be called directly from NLINMIX Relevant NLMEMcode can be downloaded at http==www-personalumichedu=agalecki Examplesand documentation are also available
SYNTAX
The macro can be executed in two different modes depending on the value of thenlmem macro argument By default nlmem is blank and NLINMIX is executed instandard (non-SAS=IML) mode otherwise NLINMIX loads a source file with aset of NLMEM macros from the file indicated by the nlmem argument and NLIN-MIX is executed in SAS=IML mode Since the syntax of several of the macroarguments is different in these two modes we describe the syntax separately fornon-SAS=IML and SAS=IML execution modes
Standard (Non-SAS=IML) Execution Mode
Non-SAS=IML execution mode has been available in all previous versions of theNLINMIX macro Similar to previous versions the execution in a default mode iscontrolled by several macroarguments listed in Table 2
Arguments are arranged in five groups depending on their role in the macro-execution and default values for selected arguments are provided Detailed syntaxfor these macroarguments can be found in the NLINMIX documentation andexamples Note that all arguments listed in groups 1ndash4 are also valid in SAS=IMLexecution mode
The key macroargument introduced in NLINMIX Version 8 and controllingexecution of LME step is called stmts It contains SAS code executed as a part ofPROC MIXED Another new argument called append allows accumulation of awide range of results from all iterations This feature may serve as a debugging toolor to provide insight into execution of the macro Other recently added featuresspecified by arguments (specified in parantheses) include linear nonequality con-straints (neq constraintsfrac14) extensive user-defined debugging features (user debugfrac14)and choosing parameters not to be adjusted during NLINMIX iterations(paramfixedfrac14)
The syntax of the derivs and expand arguments is now more flexible In previousNLINMIX releases the derivs argument required specification of analytical
494 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
derivatives ethf ifrac12dethai b biTHORNTHORN=b and ethf ifrac12dethai b biTHORNTHORN=bi with respect to all fixedand random effects If none of the derivatives were specified numerical derivativeswere computed instead In the new release selected derivatives can be specifiedanalytically and the remaining ones are calculated numerically The new syntaxfor the expand argument enables a hybrid linearization approach in the estimationprocess
SAS=IML Execution Mode
If the macroargument nlmem is not blank and points to a file containingsource code with a set of NLMEM macros NLINMIX is executed in SAS=IML mode
Table 2 NLINMIX macro arguments and their role in a default (non-SAS=IML) modelspecification
Group 1 User Input Informationdata Input datasetparmsa Specifies initial values and variables containing b estimatesparamfixed Specifies b parameters not adjusted during NLINMIX iterations
Group 2 Pseudo Data (P-D) Stepmodela Systematic part of the model f iethdethai b biTHORNTHORNmodinita Auxiliary to model argument useful in recursively defined modelsderivsa Derivatives ethf iethdethai b biTHORNTHORNTHORN=b and eth f iethdethai b biTHORNTHORNTHORN=bitolfrac14 1endash5 Specifies tolerance if finite differences derivatives calculatedexpandfrac14 zero Expansion method first-order second-order or hybrid linearizationweighta Weight matrix function
Group 3 LME Stepstmts Specifies LME step (Eq 5)procopt Auxiliary to stmts argumentneq constraints Points to a macro containing linear nonequality constraints
Group 4 Iteration and Output Controlconvergefrac14 1endash8 Convergence criterionmaxitfrac14 30 Maximum number of iterationsswitchfrac14 0 Specifies iteration number at which expansion method indicated
by expand argument switches to first-order linearizationappend Specifies datasets to append during subsequent iterationsuser debug Points to a dataset containing list of user defined
debugging macrosoutdatafrac14 nlinmix Working datasetoptions Options skipnlin and others
Group 5a NLIN Step (non-IML Specification Only)nlinopt PROC NLIN optionsnlinstmt Additional PROC NLIN statements
aMacro arguments that have different syntax in non-SAS=IML and SAS=IML specification
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 495
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
All arguments listed in Table 2 (except group 5a) can be used in SAS=IMLexecution mode The user should be aware that some of these arguments havedifferent syntax in non-SAS=IML and SAS=IML modes More specifically in modelmodinit derivs and weight arguments SAS=IML as opposed to PROC NLINprogramming statements are used In the parms argument one initial value per fixedeffect in SAS=IML mode is allowed as opposed to multiple values in non-SAS=IML mode All remaining arguments from groups 1 through 4 in Table 2 playthe same role and have exactly the same syntax in both non-SAS=IML andSAS=IML execution modes
In addition to arguments from groups 1ndash4 listed in Table 2 all arguments listedin Table 3 can also be used in SAS=IML execution mode The macroarguments inGroup 1 from Table 3 enhance the way the input dataset can be read in duringNLIN and P-D steps In non-SAS=IML mode the only option available is thatNLINMIX reads in one record at a time from an input dataset and consequentlyone record is processed at a time In SAS=IML mode one or more records can beread at a time and subsequently multiple records can be processed at once If nextis a number a fixed number of records are read at a time By default this numberis 1 which means that one record is read at a time If next is a variable which iden-tifies a subject in a dataset multiple records are read at a time Note that the next
argument affects the way NLIN and P-D steps are executed and it does not directlyaffect the LME step execution
The arguments tvar and xvar indicate disjoint lists of time-dependent variablesand time-independent variables respectively By default tvar and xvar are blankand all variables are read in from a dataset and considered to be time-dependentexcept for the subject-identifying variable
Table 3 Additional NLINMIX macro arguments used for a model specified using SAS=IMLsyntax (SAS=IML execution model)
Group 1 User Input Informationnlmem File with a source code for a set of NLMEM macrosnextfrac14 1 Indicates how many records are read at a timexvar List of time-independent covariatestvar List of time-dependent covariates
Group 2 Pseudo Data (P-D) Stepimlfun Macro containing user-defined SAS=IML functionsglobvar List of user-defined global vectors or matricesdtmplt Indicates which derivatives returned by derivsfrac14 argumant are not
recomputed using finite difference derivativesretain For recursively specified models
Group 4 Output Controlsavevar List of output vectors to save in outdatafrac14 datasetdebug Points to a user-defined SAS=IML function for debugging model specification
Group 5b NLIN Step (SAS=IML Specification Only)imlnlin NLIN step using SAS=IML statements stored in default nlin default objf and
default initobjf macros
496 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
If more than one record is read at a time then for each time-dependent variablea SAS=IML column vector with the same name is extracted from the input datasetThe number of elements in a vector is determined by the number of records read at atime For time-independent variables an IML constant with the same name repre-sents an entire vector All constants and vectors created this way are put in a listof global SAS=IML objects and can be potentially used in specification of NLINor P-D step By using constants instead of vectors for time-independent variablesthe specification of the model and calculations in the NLIN and P-D steps can besimplified
The arguments model modinit derivs and weight play a key role in specifyingNLIN and P-D step Auxiliary argument globvar provides the user with a mechanismof sharing SAS=IML data objects eg matrices vectors and scalars betweenSAS=IML function arguments defining the NLIN and P-D step
EXECUTION
During the initial step common to both non-SAS=IML and SAS=IMLexecution NLINMIX extracts the names of fixed and random effects from theparms and RANDOM statements specified in the stmt macro argument Otherinformation related to controlling the P-D and LME execution is also extractedat this stage
Initial Values
Initial values for fixed effects are usually specified through the parms argumentBy default random effects are assumed to be zero If variables corresponding to fixedand=or random effects are already included in an input dataset it is not necessary tospecify initial values in the parms argument If present initial values for the fixedand=or random effects will be taken from the input dataset and those from parms willbe ignored
Psuedo-Data and NLIN Steps
In a non-SAS=IML execution mode programming statements from modelmodinit derivs and weight are built into PROC NLIN to optionally execute anNLIN step A refined set of fixed parameter estimates and other auxiliary variablesare stored in a working dataset specified by the outdata macroargument Similarilythe same statements are included into an SAS DATA step so that a P-D step can beexecuted The P-D step is completed by storing resulting derivatives weight vectorand working dependent variables in a working dataset
In SAS=IML execution mode an optional NLIN step is executed after program-ming statements from model modinit derivs and weight are incorporated intoSAS=IML functions Note that the generated SAS=IML function returns a vectorof weighted differences and their corresponding derivatives By default the imlnlin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 497
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
argument implies that a least squares optimization is performed using theLevenbergndashMarquardt algorithm By specifying a different set of SAS=IMLstatements in macros specified by the imlnlin argument the user can implementdifferent optimization methods for the NLIN step
The P-D step is executed as previously except that contents of the modelmodinit derivs and weight arguments are incorporated into analogous SAS=IMLfunctions The resulting functions are executed in a separate PROC IML call andthe resulting matrix derivatives weight vector and other auxiliary variables arestored in a working dataset to complete the P-D step
LME Step
In both SAS=IML and non-SAS=IML runs the LME step is executed usingPROC MIXED applied to a working dependent variable created in a workingdataset Derivatives with respect to fixed effects are used to construct a design matrixspecified as effects in the MODEL statement Derivatives with respect to randomeffects are used to specify effects in the RANDOM statement By default the YR
and YG estimates from the previous iteration are introduced through a PARMSstatement to initiate ML or REML subiterations
EXAMPLE CODE
This section details the code needed to execute the NLINMIX macro inSAS=IML mode for the glucose disappearance data The within-subject two-compartment model is specified as an ODE solution
filename nlmem rsquonlmemsasrsquo NLMEM source
filename nlinmix rsquonlmm800sasrsquo NLINMIX source
include nlinmix nosource
data fsivgtt1
----------------------------------------------------------------
Data from 10 old subjects with normal glucose tolerance
collected by Dr Halter and his collaborators
at the University of Michigan
----------------------------------------------------------------
input id time age g_t i_t
cards
2 0 82 99333 8333
28 2 82 363000 112900
more data
run
498 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
macro useriml
----------------------------------------------------------------
-- --
-- MINMOD Glucose disappearance model --
-- Coded using SASIML A Galecki June 2002 --
-- --
-- glcd - integrand function for MINMOD model --
-- and sensitivity eqs --
-- glc_solv - solves glucose disappearance model --
-- wghtc - weight for observations --
-- interpolate - interpolation Auxiliary function --
-- --
----------------------------------------------------------------
start glcd(ty) global(ddI_bG_bI_ttime)
Integrand for glucose disappearance model
time is a vector
t is a scalar
function interpolate interpolates insulin level at time t
d=dd
p1=d[1] S_G Glucose sensitivity
p2=d[2] p_2
p3=d[3] p_3
G0=d[4] G_0 Predicted glucose at time 0
g_t =y[1]
x_t =y[2]
idiff= interpolate(ttimeI_t) - I_b
Prevents idiff to be less than zero
idiff= choose(idiffgt0idiff0)
dg_dt= -(p1+x_t)g_t + p1G_b
dx_dt= -p2x_t + p3idiff
--- Integrand function for sensitivity equations ---
g_1=y[3]
g_2=y[4] x_2=y[7]
g_3=y[5] x_3=y[8]
g_4=y[6]
c=p1+x_t
dg_1=-cg_1 - (g_t - G_b)
dg_2=-cg_2 - g_tx_2
dg_3=-cg_3 - g_tx_3
dg_4=-cg_4
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 499
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
dx_2=-p2x_2-x_t
dx_3=-p2x_3+idiff
return(dg_dtdx_dt
dg_1dg_2dg_3dg_4
dx_2dx_3)
finish glcd
start glc_solv(d) global(ddI_tg_ttimeid)
--- Function returns solution vector for G_t and X_t ---
--- and solves sensitivity eqs Invokes GLCD function ---
dd=d
hmin hmax hinit step size
h1=10(-12)
h2=1
h3=10(-5)
h=h1||h2||h3
c= d[4] 0000100 Initial condition y(0)=c
eps=10(-4)
call ode(resglcdctimeh) eps=eps
glc_solv=t(c)t(res)
return(glc_solv)
finish glc_solv
start interpolate(x0xy)
-- This is an auxiliary function to perform linear interpolation --
statements omitted
finish interpolate
------ Between-subject model -----------
start bsm(bu) global(der_buage)
Derivs for p1p2p3G0
wrt b and u stored in der_bu
p1 = b[1] + u[1]
logp2 = b[2] + u[2]
logsi = b[3] + (age-70)b[5]100 + u[3] Linear model for log(si)
G0 = b[4]
db = i(4) || j(410)
db[35] = (age-70)100
500 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
du = 1 0 0
0 1 0
0 0 1
0 0 0
logp3 = logp2 + logsi
dlogp3b = 1 1 db[23]
dlogp3u = 1 1 du[23]
p2 = exp(logp2)
db[22] = p2 db[22]
du[22] = p2 du[22]
p3 = exp(logp3)
db[3] = p3 dlogp3b
du[3] = p3 dlogp3u
der_bu = db || du
return(p1p2p3G0)
finish bsm
start dbsm(bu) global(der_bu)
return(der_bu)
finish
start wghtc(dummy) global(g_ttime)
Vector of weights
g_weight= choose(timegt=810) Zero-weighted measures for
timelt8 mins
g_weight[6]=50 Overweighted measure for time=8
w= g_weight(g_tg_t)
return(w)
finish
mend useriml
nlinmix(data = fsivgtt1
next = id
xvar = age
globvar = predv dpredv dd g_b i_b x_solv ins_action
stmts = str(
class id
model pseudo_g_t = d_beta1 d_beta2 d_beta3 d_beta4 d_beta5
noint notest solution cl
random d_u1 d_u2 d_u3 subject=id solution cl type=un
weight _weight_
)
model = str(
g_b=g_t[1] Baseline glucose
i_b=i_t[1] Baseline insulin
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 501
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Between subject model
_d=bsm(_b_u)
der_bu=dbsm(_b_u)
Within-subject model
d=_d
g_solv= glc_solv(d) Solving ODE
predv = g_solv[1] Predicted glucose
x_solv= g_solv[2] Predicted insulin in a remote
compartment
jacs = g_solv[36] Solution for sensitivity eqs
dpredv= jacs der_bu
ins_action = 100x_solv(d[1]+x_solv) Insulin action
)
derivs = str(
_db=dpredv[15] Derivatives wrt _b
_du=dpredv[68] Derivatives wrt _u
)
savevar = x_solv ins_action
weight = str( _weight_= wghtc())
parms = str(beta1=2 beta2=0 beta3=0 beta4=25 beta5=0)
expand = zero
imlfun = useriml Points to a user defined SAS macro
options = skipnlin
converge = 1e-3
nlmem = nlmem nosource Points to NLMEM macro
)
ACKNOWLEDGMENTS
The authors thank Jose Pinheiro and Richard Watanabe for their helpfulcomments and suggestions and Shu Chen for technical assistance Support for thisresearch was provided in part by NIA grant No P30 AG08808
REFERENCES
Beal S L Sheiner L B (1992) NONMEM Userrsquos Guides San FranciscoNONMEM Project Group University of California
Bergman R N Bowden C R (1981) The minimal model approach to quantifica-tion of factors controlling glucose disposal in man In Cobelli C BergmanR N eds Carbohydrate Metabolism Wiley pp 269ndash296
Davidian M Giltinan D M (1995) Nonlinear Models for Repeated MeasurementData London Chapman amp Hall
502 Galecki et al
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
ORDER REPRINTS
Galecki A T (1998) NLMEM A new SAS=IML macro for hierarchical modelsComput Methods Progra Biomed 55207ndash216
Lindstrom M J Bates D M (1990) Nonlinear mixed effects models for repeatedmeasures data Biometrics 46673ndash687
Pinheiro J C Bates D M (1995) Approximations to the log-likelihood functionin the nonlinear mixed-effects model J Computat Graph Statist 412ndash35
Pinheiro J C Bates D M (2000) Mixed-Effects Models in S and S-PLUSNew York Springer-Verlag
SAS Institute Inc (1999a) SAS=IML Userrsquos Guide Version 7 Cary NC SASInstitute Inc
SAS Institute Inc (1999b) SAS=STAT Userrsquos Guide Version 8 Cary NC SASInstitute Inc
Vonesh E F Chinchilli V M (1997) Linear and Nonlinear Models for the Analysisof Repeated Measurements New York Marcel Decker Inc
Wastney M E Patterson B H Linares O A Greif P C Boston R C (1999)Investigating Biological Systems Using Modelling San Diego Academic Press
Wolfinger R D (1993) Laplacersquos approximation for nonlinear mixed effectsmodels Biometrika 80791ndash795
Wolfinger R D Lin X (1997) Two Taylor-series approximation methods fornonlinear mixed models Computat Statist Data Analy 25465ndash490
Received February 2003Accepted July 2003
Ordinary Differential Equation PKPD Using SAS Macro NLINMIX 503
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14
Request PermissionOrder Reprints
Reprints of this article can also be ordered at
httpwwwdekkercomservletproductDOI101081BIP120037194
Request Permission or Order Reprints Instantly
Interested in copying and sharing this article In most cases US Copyright Law requires that you get permission from the articlersquos rightsholder before using copyrighted content
All information and materials found in this article including but not limited to text trademarks patents logos graphics and images (the Materials) are the copyrighted works and other forms of intellectual property of Marcel Dekker Inc or its licensors All rights not expressly granted are reserved
Get permission to lawfully reproduce and distribute the Materials or order reprints quickly and painlessly Simply click on the Request Permission Order Reprints link below and follow the instructions Visit the US Copyright Office for information on Fair Use limitations of US copyright law Please refer to The Association of American Publishersrsquo (AAP) website for guidelines on Fair Use in the Classroom
The Materials are for your personal use only and cannot be reformatted reposted resold or distributed by electronic means or otherwise without permission from Marcel Dekker Inc Marcel Dekker Inc grants you the limited right to display the Materials only on your personal computer or personal wireless device and to copy and download single copies of such Materials provided that any copyright trademark or other notice appearing on such Materials is also retained by displayed copied or downloaded as part of the Materials and is not removed or obscured and provided you do not edit modify alter or enhance the Materials Please refer to our Website User Agreement for more details
Dow
nloa
ded
by [
Nor
th D
akot
a St
ate
Uni
vers
ity]
at 2
004
02
Dec
embe
r 20
14