Date: Fri, 23 Jun 2000 13:30:12 +0200
From: "Rik Schoemaker" <RS@chdr.nl>
Subject: weighted residuals

Dear all,

I'm trying to produce weighted residuals for the combined additive and constant CV error model. My residuals end up as plus or minus infinity indicating that the W variable is somehow set to zero. Any clues?

I've tried two implementations, first:

$PROB 99107; PSD04 ;CL,Q,VSS,VC; PSD04_23
$INPUT ID OCC TRT EXPT ACTT TIME AMT RATE DV MDV
$DATA G:\1999\99107\STATS\PSD04NM.TXT
$SUBROUTINES ADVAN3,TRANS3
$PK
CL = THETA(1)*EXP(ETA(1))
Q = THETA(2)*EXP(ETA(2))
V = THETA(3)*EXP(ETA(3))
VSS = THETA(4)*EXP(ETA(4))
S1 = V
$ERROR
PREDI = F
W=F*ERR(1)+ERR(2)
Y=F+W
IRES=DV-PREDI
IWRES=IRES/W
$THETA (0.001, 3.3) 1 5 7
$OMEGA .1 0 FIXED .1 .1
$SIGMA .1 30000
$EST PRINT=1 MAXEVAL 9999 POSTHOC NOABORT METHOD=1 INTERACTION
$COV
$TABLE ID OCC TRT EXPT ACTT TIME DV PREDI IRES IWRES FILE = PSD04_23.ASC
NOHEADER NOAPPEND NOPRINT
$TABLE ID CL Q V VSS FILE=PSD04_23.PAR
NOHEADER NOPRINT NOAPPEND FIRSTONLY.

for the second, I used the syntax as supplied in an email from Lew Sheiner on 12.12.94 for the alternative error block:

$ERROR
W=THETA(5)*F*ERR(1)+THETA(6)*ERR(2)
Y=F+W
PREDI = F
IRES=DV-PREDI
IWRES=IRES/W

both have the same results!

Cheers,
Rik Schoemaker


*****


From: "Bachman, William" <bachmanw@globomax.com>
Subject: RE: weighted residuals
Date: Fri, 23 Jun 2000 08:02:52 -0400

Rik

Try the following implementation:

$ERROR
W1=1
W2=F
IPRED=F
IRES=DV-IPRED
IWRES=IRES/(W1+W2)
Y=F + W1*ERR(1) + W2*ERR(2)

William J. Bachman, Ph.D.
GloboMax LLC
Senior Scientist
7250 Parkway Drive, Suite 430
Hanover, MD 21076
Voice (410) 782-2212
FAX (410) 712-0737
bachmanw@globomax.com


*****


From: "Bachman, William" <bachmanw@globomax.com>
Subject: RE: weighted residuals
Date: Fri, 23 Jun 2000 08:10:24 -0400

Rik

This is the version I intended to send:

$ERROR
DEL=0
IF (F.EQ.0) DEL=1
W=F
IPRED=F
IRES=DV-IPRED
IWRES=IRES/(W+DEL)
Y=F + F*ERR(1) + ERR(2)

William J. Bachman, Ph.D.
GloboMax LLC
Senior Scientist
7250 Parkway Drive, Suite 430
Hanover, MD 21076
Voice (410) 782-2212
FAX (410) 712-0737
bachmanw@globomax.com


*****


Date: Fri, 23 Jun 2000 14:22:13 +0200
From: "Rik Schoemaker" <RS@chdr.nl>
Subject: RE: weighted residuals

Bill,
What this means is that you weight by F (as if error is constant CV) unless your prediction is zero. This approximation won't work for me because I have a band of noise around say 100 ng/ml and I want to weight values below 100 with the same weight as values around 100...
What's your view?
Rik


*****


From: "Gibiansky, Leonid" <gibianskyl@globomax.com>
Subject: RE: weighted residuals
Date: Fri, 23 Jun 2000 08:27:06 -0400

Rik,
I think, the best way would be to use

$ERROR
W=THETA(5)*F*ERR(1)+THETA(6)*ERR(2)
Y=F+W
PREDI = F
IRES=DV-PREDI
IWRES=IRES/(THETA(5)**2*F**2+THETA(6)**2)**0.5
$OMEGA
1 FIXED
1 FIXED

Leonid Gibiansky


*****


From: "Gibiansky, Leonid" <gibianskyl@globomax.com>
Subject: RE: weighted residuals
Date: Fri, 23 Jun 2000 08:31:51 -0400

I am sorry,
$SIGMA
1 FIXED
1 FIXED

not $OMEGA

Leonid


*****


From: "Piotrovskij, Vladimir [JanBe]" <VPIOTROV@janbe.jnj.com>
Subject: RE: weighted residuals
Date: Fri, 23 Jun 2000 14:45:53 +0200

Dear Rik,

In case of combined constant-variance and constant-CV error model the weight is not equal to F*ERR(1)+ERR(2). Try the following:

W = SQRT(F*F*THETA(.)*THETA(.) + THETA(..)*THETA(..))
Y = F + F*THETA(.)*ERR(1) + THETA(..)*ERR(2)
IRES = DV-F
IWRE = IRES/W

$SIGMA 1 FIX 1 FIX

Regards,
Vladimir
----------------------------------------------------------------------
Vladimir Piotrovsky, Ph.D.
Janssen Research Foundation
Clinical Pharmacokinetics (ext. 5463)
B-2340 Beerse
Belgium
Email: vpiotrov@janbe.jnj.com


*****


Date: Fri, 23 Jun 2000 14:51:22 +0200
From: "Rik Schoemaker" <RS@chdr.nl>
Subject: RE: weighted residuals

Leonid,
Thanks! It works like a charm,
Rik


*****


Date: Fri, 23 Jun 2000 16:38:11 +0200
From: Mats Karlsson <Mats.Karlsson@biof.uu.se>
Subject: Re: weighted residuals

Dear Rik,

A slightly different coding:
W = SQRT(F*F*THETA(.)*THETA(.) + THETA(..)*THETA(..))
Y = F + W*ERR(1)
IRES = DV-F
IWRE = IRES/W
$SIGMA 1 FIX

will give you weighted residuals with unit variance, which makes it easier to interpret diagnostic plots.

Best regards,
Mats