RE: [NMusers] IIV on %CV-Scale - Standard Error (SE)

2008-02-15 Thread Ribbing, Jakob
Thank you all for the clarifications on this,

James previously sent a good explanation outside of nm-users which I am
adding at the end, in case anyone still wants to understand where the
number 2 comes from.

Leonid, you are right there was a typo in my formula and your correction
is correct. What I meant to say was that if one calculates the relative
SE on the variance scale, one has to divide this number by 2 in order to
get the RSE on the appropriate scale. To make this clear to everyone
(stop reading here if you already understand the issue):

If your model is parameterised as:
CL=TVCL*EXP(ETA(1))
And OMEGA11 is estimated to 0.09, this means that the standard deviation
of ETA1 is sqrt(0.09)=0.3. The IIV in CL is then approximately 30%
around the typical CL (TVCL). If the SE of OMEGA11 is estimated to 0.009
the relative SE of OMEGA11 is 0.009/0.09=10% (on the variance scale). We
then report IIV in CL as 30% with RSE=5%.

Best

jakob

-Original Message-
From: James G Wright [mailto:[EMAIL PROTECTED] 
Sent: 15 February 2008 13:57
To: Ribbing, Jakob
Subject: RE: [NMusers] IIV on %CV-Scale - Standard Error (SE)

Hi Jakob,

The trick is just knowing that you need to apply Wald's formula because
the SE is a length (that depends on scale) and not a point.  Thus, to
get the right length, you need to apply a correction factor that depends
on the rescale.  For transformations like x^n, the rescale depends on x,
hence the need to include the derivative.  When I last taught calculus,
I explained this as follows (bear with me, and apologises if I have
missed the point of misunderstanding and inadvertently patronize).

Imagine you have a square, with sides of length 10 (x), it has area of
100 (x^2).  Now imagine, you increase the length of a side by 1.  The
are is now 121=(x+1)^2=x^2+2x+1.  Visually, you have added an extra
length on to each side of the square and extra +1 in the corner.  The 2x
is the first derivative of x^2, that is how much x^2 changes if you add
1 to x. 

What does this have to do with a confidence interval?  To calculate the
95% confidence interval you add/subtract 1.96 times the SE to x.   You
can estimate the impact this has on x^2, by using the first derivative.
Of course, you have to do all this backwards for the square root case.
For more complex functions, the formula is only approximate because
second-order terms can become important.

That's how I visualise the equations in my head anyway.  Best regards,
James

James G Wright PhD
Scientist
Wright Dose Ltd
Tel: 44 (0) 772 5636914


Re: [NMusers] IIV on %CV-Scale - Standard Error (SE)

2008-02-15 Thread Leonid Gibiansky

Jakob
I am not sure that the formula that you present is correct:

sqrt(SE.OMEGAnn)/(2*sqrt(OMEGAnn))*100%

I think, you do not need to take sqrt(). This is what I would use

SE.OMEGAnn/(2*OMEGAnn)*100%

Note that your S-plus function also does not take a sqrt, so it could be 
just a  typo.



Factor of 2 is derived from these calculations:

Assume that you have random variable

X=A+alpha*eps, where eps is the standard normal (mean(eps)=0, var(eps)=1)

Then

mean(X)=A
var(X)=mean( (X-mean(X))**2 ) = alpha**2
sd(X)=sqrt(Var(X))=alpha
CV(X)=SD/mean=alpha/A

Now, let Y=X**2=(A+alpha*eps)**2
Then
mean(Y)=mean(X**2)=mean(A**2+2 alpha A eps + alpha**2 mean(eps**2))=
   = A**2 + alpha**2 = A**2  ; (neglecting small terms alpha**2)
var(Y)=mean( (Y-mean(Y))**2 ) = mean( ((A+alpha*eps)**2-A**2 )**2 ) =
  =mean( (2 alpha A eps)**2) = 4 alpha**2 A**2 (again, keeping only 
the main term)

SD(Y) = 2 A alpha
CV(Y)=2 alpha/A

From here we have

CV(X)=CV(Y)/2

In the context of what we discuss, X is the estimated SD while Y is the 
estimated variance of OMEGA (or sigma) estimate:




Parameterization 1:

PAR=PAR0+THETA(1)*ETA(1)
$OMEGA
1 FIXED

(X from the discussion above is THETA(1) estimate)
---
Parameterization 1:

PAR=PAR0+ETA(1)
$OMEGA
estimated

Y in this case is the OMEGA estimate, and if the solution does not 
depend on the parameterization, Y=X**2


-

Another way to derive it is to think in terms of confidence intervals. 
In SD scale,


SD.CI = SD +/- 2* SE.SD
CV.SD = 2* SE.SD / SD / 2 = SE.SD / SD
In OMEGA scale this would result in

OMEGA.CI = (SD +/- 2* SE.SD)**2=SD**2 +/- 4 * SD * SE.SD (neglecting the 
term 4 SE.SD**2)


Then CV.OMEGA = 4 * SD * SE.SD / 2/ SD**2 = 2 SE.SD/SD = 2 CV.SD

CV.SD = CV.OMEGA/2

Leonid

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




Ribbing, Jakob wrote:

Hi all,

I think that Paul stumbled on a rather important issue. The SE of the residual 
error may not be of primary interest, but the same as discussed under this 
thread also applies to the standard error of omega. (I changed the name of the 
subject since this thread now is about omega)

I prefer to report IIV on the %CV scale, i.e. sqrt(OMEGAnn) for a parameter 
with log-normal distribution. It then makes no sense to report the standard 
error on any other scale. For log-normally distributed parameters the relative 
SE of IIV then becomes:
sqrt(SE.OMEGAnn)/(2*sqrt(OMEGAnn))*100%

Notice the factor 2 in the denominator. I got this from Mats Karlsson who 
picked it up from France Mentré, but I have never seen the actual mathematical 
derivation for this formula. I think this is what Varun is doing in his e-mail 
a few hours ago. However, I am not sure; being illiterate I could not 
understand the derivation. Either way, if we are satisfied with the 
approximation of IIV as the square root of omega, the factor 2 in the 
approximation of the SE on the %CV-scale is exact enough.

If you would like to convince yourself of that the factor 2 is correct (up to 3 
significant digits), you can load the below Splus function and then run with 
different CV:s, e.g:
ratio(IIV=1)
ratio(IIV=0.5)

Regards

Jakob


"ratio" <- function (IIV.stdev=1) {
ncol <- 1000 #1000 Studies, in which IIV is estimated
ETAS <- rnorm(n=1000*ncol, 0, IIV.stdev)
ETA  <- matrix(data=ETAS, ncol=ncol)
IIVs.stds<- colStdevs(ETA) #Estimate of IIV on sd-scale
IIVs.vars<- colVars(ETA)   #Estimate of IIV on var-scale

SE.std  <- stdev(IIVs.stds)/sqrt(ncol)
SE.var  <- stdev(IIVs.vars)/sqrt(ncol)
CV.std  <- SE.std/IIV.stdev
CV.var  <- SE.var/(IIV.stdev^2)
print(paste("SE on Var scale:", SE.var))
print(paste("SE on Std scale:", SE.std))
print(paste("Ratio CV var, CV std:", CV.var/CV.std))
invisible()
}




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of varun goel
Sent: 14 February 2008 23:07
To: [EMAIL PROTECTED]; NONMEM users forum
Subject: Re: [NMusers] Combined residual model and IWRES.

Dear Paul, 


You can use the delta method to compute the variance and expected value of a 
transformation, which is square in your case.

given y=theta^2


E(y)=theta^2
Var(y)=Var(theta)+(2*theta)^2 ; the later portion is square of the first derivative of  y with respect of theta. 


In your example theta is the standard deviation whereas error estimate is 
variance. I did not follow your values very well, so I ran a model with same 
reparameterization and got following results.

theta=2.65, rse=27.2%
err=7.04; rse=54.4%

theta.1<-2.65
rse<-27.2 
var.theta.1<-(rse*theta.1/100)^2  ## = 0.51955 


err.1<-7.04
rse.err.1<-54.4#%
var.err.1<-(rse.err.1*err.1/100)^2 ##  = 14.66

##now from delta method
 
E(err)=2.65^2 ## 7.025 close t

RE: [NMusers] IIV on %CV-Scale - Standard Error (SE)

2008-02-15 Thread Ken Kowalski
Hi Jakob,

The derivation for your expression comes from a first-order approximation of
the variance often referred to as the "delta method" in the statistical
literature.  The approximation is:

Var(f(x)) ~= [f'(x)^2]Var(x) or equivalently, SE(f(x)) ~= f'(x)SE(x)

If we want SE(omega) but have the SE(omega^2) then x=omega^2 and
f(x)=omega=x^0.5.  Using the first-order approximation we have

SE(omega) = SE(f(x)) 
  = SE(x^0.5)
  = f'(x)SE(x)
  = 0.5(x^-0.5)SE(x) and substituting x=omega^2
  = 0.5(omega^-1)SE(omega^2)
  = SE(omega^2)/(2*omega)

Kind regards,

Ken

Kenneth G. Kowalski
President & CEO
A2PG - Ann Arbor Pharmacometrics Group
110 E. Miller Ave., Garden Suite
Ann Arbor, MI 48104
Work:  734-274-8255
Cell:  248-207-5082
[EMAIL PROTECTED]



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Ribbing, Jakob
Sent: Friday, February 15, 2008 4:03 AM
To: NONMEM users forum
Cc: varun goel; [EMAIL PROTECTED]
Subject: [NMusers] IIV on %CV-Scale - Standard Error (SE)

Hi all,

I think that Paul stumbled on a rather important issue. The SE of the
residual error may not be of primary interest, but the same as discussed
under this thread also applies to the standard error of omega. (I changed
the name of the subject since this thread now is about omega)

I prefer to report IIV on the %CV scale, i.e. sqrt(OMEGAnn) for a parameter
with log-normal distribution. It then makes no sense to report the standard
error on any other scale. For log-normally distributed parameters the
relative SE of IIV then becomes:
sqrt(SE.OMEGAnn)/(2*sqrt(OMEGAnn))*100%

Notice the factor 2 in the denominator. I got this from Mats Karlsson who
picked it up from France Mentré, but I have never seen the actual
mathematical derivation for this formula. I think this is what Varun is
doing in his e-mail a few hours ago. However, I am not sure; being
illiterate I could not understand the derivation. Either way, if we are
satisfied with the approximation of IIV as the square root of omega, the
factor 2 in the approximation of the SE on the %CV-scale is exact enough.

If you would like to convince yourself of that the factor 2 is correct (up
to 3 significant digits), you can load the below Splus function and then run
with different CV:s, e.g:
ratio(IIV=1)
ratio(IIV=0.5)

Regards

Jakob


"ratio" <- function (IIV.stdev=1) {
ncol <- 1000 #1000 Studies, in which IIV is estimated
ETAS <- rnorm(n=1000*ncol, 0, IIV.stdev)
ETA  <- matrix(data=ETAS, ncol=ncol)
IIVs.stds<- colStdevs(ETA) #Estimate of IIV on sd-scale
IIVs.vars<- colVars(ETA)   #Estimate of IIV on var-scale

SE.std  <- stdev(IIVs.stds)/sqrt(ncol)
SE.var  <- stdev(IIVs.vars)/sqrt(ncol)
CV.std  <- SE.std/IIV.stdev
CV.var  <- SE.var/(IIV.stdev^2)
print(paste("SE on Var scale:", SE.var))
print(paste("SE on Std scale:", SE.std))
print(paste("Ratio CV var, CV std:", CV.var/CV.std))
invisible()
}




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of varun goel
Sent: 14 February 2008 23:07
To: [EMAIL PROTECTED]; NONMEM users forum
Subject: Re: [NMusers] Combined residual model and IWRES.

Dear Paul, 

You can use the delta method to compute the variance and expected value of a
transformation, which is square in your case.

given y=theta^2


E(y)=theta^2
Var(y)=Var(theta)+(2*theta)^2 ; the later portion is square of the first
derivative of  y with respect of theta. 

In your example theta is the standard deviation whereas error estimate is
variance. I did not follow your values very well, so I ran a model with same
reparameterization and got following results.

theta=2.65, rse=27.2%
err=7.04; rse=54.4%

theta.1<-2.65
rse<-27.2 
var.theta.1<-(rse*theta.1/100)^2  ## = 0.51955 

err.1<-7.04
rse.err.1<-54.4#%
var.err.1<-(rse.err.1*err.1/100)^2 ##  = 14.66

##now from delta method
 
E(err)=2.65^2 ## 7.025 close to 7.04
var(err)=(2*2.65)^2*0.51955 ##   14.59 close to 14.66

Hope it helps

Varun Goel
PhD Candidate, Pharmacometrics
Experimental and Clinical Pharmacology
University of Minnesota



RE: [NMusers] IIV on %CV-Scale - Standard Error (SE)

2008-02-15 Thread Mouksassi Mohamad-Samer
Hello Jakob,

I remember I developed code at one point to calculate a SE on a typical 
clearance which was a function of four covariates..

The general method is to use formula incorporating partial derivatives with 
respect to each parameter.

http://www.itl.nist.gov/div898/handbook/mpc/section5/mpc55.htm  this link gives 
good background information.


The S-plus piece of code that can be used is :


OM1  <- 0.16 
SE1 <- 0.04  

# PERCENTOM1<- sqrt(OM1) # the expression to calculate a standard error on it

D <- deriv(~ sqrt(OM1) ,
c("OM1"),function(OM1) NULL, formal=T)


DERIV <- D(OM1)   # .grad[, "OM1"] <- 0.5 * (OM1^-0.5) 
which is 1/ 2 . SQRT(OM1)
PARDERIV <- attr(DERIV,"gradient")

PERCENTOM1SE<- sqrt ( (PARDERIV[1]*SE1)^2)


For this simple example computing partial derivative by hand is easy but for 
more complex formulas things can be tricky and S-plus can calculate this for 
you.

http://statpages.org/erpropgt.html this link calculates SE of function of up to 
two variables.

Hope this helps,



Samer Mouksassi











-Original Message-
From: [EMAIL PROTECTED] on behalf of Ribbing, Jakob
Sent: Fri 2/15/2008 04:03
To: NONMEM users forum
Cc: varun goel; [EMAIL PROTECTED]
Subject: [NMusers] IIV on %CV-Scale - Standard Error (SE)
 
Hi all,

I think that Paul stumbled on a rather important issue. The SE of the residual 
error may not be of primary interest, but the same as discussed under this 
thread also applies to the standard error of omega. (I changed the name of the 
subject since this thread now is about omega)

I prefer to report IIV on the %CV scale, i.e. sqrt(OMEGAnn) for a parameter 
with log-normal distribution. It then makes no sense to report the standard 
error on any other scale. For log-normally distributed parameters the relative 
SE of IIV then becomes:
sqrt(SE.OMEGAnn)/(2*sqrt(OMEGAnn))*100%

Notice the factor 2 in the denominator. I got this from Mats Karlsson who 
picked it up from France Mentré, but I have never seen the actual mathematical 
derivation for this formula. I think this is what Varun is doing in his e-mail 
a few hours ago. However, I am not sure; being illiterate I could not 
understand the derivation. Either way, if we are satisfied with the 
approximation of IIV as the square root of omega, the factor 2 in the 
approximation of the SE on the %CV-scale is exact enough.

If you would like to convince yourself of that the factor 2 is correct (up to 3 
significant digits), you can load the below Splus function and then run with 
different CV:s, e.g:
ratio(IIV=1)
ratio(IIV=0.5)

Regards

Jakob


"ratio" <- function (IIV.stdev=1) {
ncol <- 1000 #1000 Studies, in which IIV is estimated
ETAS <- rnorm(n=1000*ncol, 0, IIV.stdev)
ETA  <- matrix(data=ETAS, ncol=ncol)
IIVs.stds<- colStdevs(ETA) #Estimate of IIV on sd-scale
IIVs.vars<- colVars(ETA)   #Estimate of IIV on var-scale

SE.std  <- stdev(IIVs.stds)/sqrt(ncol)
SE.var  <- stdev(IIVs.vars)/sqrt(ncol)
CV.std  <- SE.std/IIV.stdev
CV.var  <- SE.var/(IIV.stdev^2)
print(paste("SE on Var scale:", SE.var))
print(paste("SE on Std scale:", SE.std))
print(paste("Ratio CV var, CV std:", CV.var/CV.std))
invisible()
}




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of varun goel
Sent: 14 February 2008 23:07
To: [EMAIL PROTECTED]; NONMEM users forum
Subject: Re: [NMusers] Combined residual model and IWRES.

Dear Paul, 

You can use the delta method to compute the variance and expected value of a 
transformation, which is square in your case.

given y=theta^2


E(y)=theta^2
Var(y)=Var(theta)+(2*theta)^2 ; the later portion is square of the first 
derivative of  y with respect of theta. 

In your example theta is the standard deviation whereas error estimate is 
variance. I did not follow your values very well, so I ran a model with same 
reparameterization and got following results.

theta=2.65, rse=27.2%
err=7.04; rse=54.4%

theta.1<-2.65
rse<-27.2 
var.theta.1<-(rse*theta.1/100)^2  ## = 0.51955 

err.1<-7.04
rse.err.1<-54.4#%
var.err.1<-(rse.err.1*err.1/100)^2 ##  = 14.66

##now from delta method
 
E(err)=2.65^2 ## 7.025 close to 7.04
var(err)=(2*2.65)^2*0.51955 ##   14.59 close to 14.66

Hope it helps

Varun Goel
PhD Candidate, Pharmacometrics
Experimental and Clinical Pharmacology
University of Minnesota