NONMEM Users Network Archive

Hosted by Cognigen

RE: Epsilon shrinkage and IWRES

From: Bauer, Robert <Robert.Bauer>
Date: Thu, 22 Sep 2011 15:16:00 -0400

Hello all:
Sorry for my late response, but I had to browse through the source code
and verify a few things.

1) Based on my tests, NONMEM correctly assess epsilon shrinkage, even in
cases of multiple epsilons. I welcome looking at any problem a user may
have where this appears not to be the case.

2) The description in the nm720.pdf manual is intended as an approximate
description, although it is an exact representation for simple weighted
residual problems.

3) Leonid's e-mail from me regarding how NONMEM actually evaluates IWRES
for all cases, and how it parses each IWRES to a given epsilon for its
shrinkage calculation, provides the most systematic solution of epsilon
shrinkage, even for multiple epsilons, and even for mixed
heteroscedastic and homoscedastic residual variances. This embellished
description I shall add to the NONMEM_techinical_guide.pdf.

4) Unfortunately, there is no internal variable that holds the IWRES as
calculated by NONMEM. A future release version of NONMEM will supply
this extra variable. The manner in which NONMEM evaluates the IWRES is
entirely consistent with the way users typically evaluate IWRES,
whenever there are no L2 correlations in the model.

5) If there is L2 data, then the epsilon shrinkage is calculated by
NONMEM a little more complicatedly. In this case, the residual
information of two or more data points will be interconnected according
to the matrix version of (y-df)'[(H'SIGMAH) inverse ](y-df) among the
correlated data points in question. This will be more fully described
when I add to the technical guide.

Robert J. Bauer, Ph.D.
Vice President, Pharmacometrics
ICON Development Solutions
Tel: (215) 616-6428
Mob: (925) 286-0769
Email: Robert.Bauer

-----Original Message-----
From: Leonid Gibiansky [mailto:LGibiansky
Sent: Thursday, September 22, 2011 1:20 PM
To: Andrew Hooker
Cc: Rik Schoemaker; nmusers; Bauer, Robert
Subject: Re: [NMusers] Epsilon shrinkage and IWRES

Hi Andy,
Could you, please, provide an example of the model where Nonmem
computations are wrong? In my limited experience of comparison, they
always agree or very close to what I compute via IWRES.

Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
e-mail: LGibiansky at
tel: (301) 767 5566

On 9/22/2011 1:11 PM, Andrew Hooker wrote:
> Hi rik
> If you have multiple eps() in your model then the default nonmem
calculation will be wrong (understandably). In those instances I define
iwres myself and calculate using the psn option "-shrinkage".
> Best regards
> Andy
> On 22 sep 2011, at 17:14, "Rik Schoemaker"<Rik.Schoemaker
>> Dear Leonid,
>> Thank you!
>> I do believe this means that the simple representation in the manual
is not
>> covering this ingenious construct, and although theoretically they
might be
>> the same (who am I to judge? :-) ) it might explain why I get
>> numbers when I calculate it myself...
>> Kind regards,
>> Rik
>> -----Original Message-----
>> From: Leonid Gibiansky [mailto:LGibiansky
>> Sent: 22 September 2011 4:36 PM
>> To: Rik Schoemaker
>> Cc: 'nmusers'; Bauer, Robert
>> Subject: Re: [NMusers] Epsilon shrinkage and IWRES
>> I spare Bob Bauer from the need to re-type the answer since we
discussed it
>> at some point, and he provided the following info (see below). The
>> error model was discussed:
>> that is equivalent to
>> Y=IPRED + W*EPS(1)
>> where
>> W=SQRT(sigma1^2+sigma2^2*IPRED^2)
>> where sigma 1 and sigma 2 are some parameters and variance of EPS1 is
>> ;;;;;;;;;;;;;;;;;;;;;;
>> For each data point i,
>> Wi=SQRT(sigma1^2+sigma2^2*IPREDi^2)
>> Each Wi from each data point is used in assessing sigma1 and sigma2.
>> long as IPREDi is non-zero for every data point, then every Wi is
used in
>> assessing both sigma1 and sigma2 in the optimization process.
>> However, when IPREDi=0, then that particular Wi is
>> Wi=SQRT(sigma1^2)
>> Which contributes to evaluation of sigma1, but does not contribute to
>> sigma2. How does the EPSshrink algorithm figure this out? By in fact
>> the H gradient that NONMEM provides, which NONMEM uses to estimate
>> sigma1 and sigma2. The actual residual variance is in matrix form
>> as
>> H'SigmaH
>> Here H is the partial derivative of yi with respect to sigmaj. The Wi
>> itself not decomposed, but the decision to add the Wi to the
accumulator for
>> sigmaj is determined by whether partial hi with respect to sigmaj is
>> non-zero.
>> And wherever H' is not 0, the EPS shrink accumulator adds the
>> of that Wi for a sigma, and where-ever H is zero, it does not
attribute that
>> Wi for that sigma. This is how it is known which Wi pertain to PK
data, and
>> which Wi pertain to PD data as well, by assessment of the H gradient
>> NONMEM assesses.
>> The epsilon shrinkage formula honors the H'SigmaH structure, as it
>> since NONMEM's FO and FOCE methods themselves utilize that structure
>> estimate Sigma1 and Sigma2.
>> To reiterate, normally with proportional and additive sigma, all Wi
>> involved in both sigmas, and hence both sigmas have identical
>> since they are always having non-zero H together. But when some
IPREDi are
>> zero, the additive error has contributions from all Wi, whereas the
>> proportion sigma collects Wi information only from non-zero IPREDi.
>> --------------------------------------
>> Leonid Gibiansky, Ph.D.
>> President, QuantPharm LLC
>> web:
>> e-mail: LGibiansky at
>> tel: (301) 767 5566
>> On 9/22/2011 9:26 AM, Rik Schoemaker wrote:
>>> Dear all,
>>> Can someone enlighten me on a NONMEM implementation?
>>> Since NONMEM 7, epsilon shrinkage is reported in the output, and the
>>> manual states that it is calculated as:
>>> 100%*[1-SD(IWRES)]
>>> in accordance with "Karlsson MO and Savic RM. Diagnosing Model
>> Diagnostics.
>>> Clinical Pharmacology and Therapeutics, 2007; 82(1): 17-20" as one
>>> would expect.
>>> However, as far as I know, the user needs to manually code the IWRES
>>> bit using the "Uppsala implementation":
>>> IPRED = F
>>> W = THETA(3)
>>> Y = IPRED+W*EPS(1)
>>> So how does NONMEM arrive at epsilon shrinkage? And is there by any
>>> chance an (undocumented?) IWRES item that can be exported in a table
>> as well?
>>> Kind regards,
>>> Rik
>>> Rik Schoemaker, PhD
>>> Exprimo NV
>>> Tel: +31 (0)20 4416410
>>> E-mail: Rik.Schoemaker
>>> Web:
>>> This e-mail is confidential. It is also privileged or otherwise
>>> protected by work product immunity or other legal rules. The
>>> information is intended to be for use of the individual or entity
>>> named above. If you are not the intended recipient, please be aware
>>> that any disclosure, copying, distribution or use of the contents of
>>> this information is prohibited. You should therefore delete this
>>> message from your computer system. If you have received the message
>>> error, please notify us by reply e-mail. The integrity and security
>> this message cannot be guaranteed on the Internet.
>>> Thank you for your co-operation.
>>> ----------------------------
>>> This e-mail message has been scanned for Viruses by Norman Virus
>>> Control and it's Content by MailMarshal
ICON plc made the following annotations.
This e-mail transmission may contain confidential or legally privileged i=
that is intended only for the individual or entity named in the e-mail ad=
dress. If you
are not the intended recipient, you are hereby notified that any disclosu=
re, copying,
distribution, or reliance upon the contents of this e-mail is strictly pr=
ohibited. If
you have received this e-mail transmission in error, please reply to the =
sender, so that
ICON plc can arrange for proper delivery, and then please delete the mess=
Thank You,
ICON plc
South County Business Park
Dublin 18
Registered number: 145835

Received on Thu Sep 22 2011 - 15:16:00 EDT

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to:

Once subscribed, you may contribute to the discussion by emailing: