Dear NMusers,
I would like to reproduce POSTHOC estimation with manually defined likelihood
(LL) function.
This is the control stream of a standard POSTHOC for which I want to reproduce:
$PK
CL = THETA(1) * CLCR/100 * EXP(ETA(1))
V = THETA(2) * WGT * EXP(ETA(2))
S1 = V
$ERROR
IPRED = F
Y = IPRED + IPRED*EPS(1) + EPS(2)
$THETA
4.58 ; TVCL (L/h)
1.53 ; TVV (L/kg)
$OMEGA
0.151321 ; omega^2 CL
0.139876 ; omega^2 V
$SIGMA
0.039601 ; Proportional
5.76 ; Additive
$EST METHOD=COND LAPLACE MAXEVAL=0 NOABORT SIG=3 PRINT=1
And below is the control stream I used aiming to reproduce above POSTHOC
estimation:
$PK
CL = THETA(1) * CLCR/100 * EXP(ETA(1))
V = THETA(2) * WGT * EXP(ETA(2))
S1 = V
$ERROR
IPRED = F ; Predicted DV
ADDI = 5.76 ; Variance of additive error
PROR = 0.039601 ; Variance of proportional error
VAR = ADDI + PROR*IPRED**2 ; Variance of combined error
Y = LOG(W) + (DV-IPRED)**2/VAR ; -2 log Likelihood,
$THETA
4.58 ; TVCL (L/h)
1.53 ; TVV (L/kg)
$OMEGA
0.151321 ; omega^2 CL
0.139876 ; omega^2 V
$EST METHOD=COND LAPLACE -2LL MAXEVAL=0 NOABORT SIG=3 PRINT=1
The LL function was based on the minus twice log posterior distribution:
-2LPosterior = log(Var) + SUM{(DV-IPRED)^2/Var} + ETA^2/OMEGA^2
I did not add eta/omega part (prior distribution) to the LL function in the
code because NONMEM seems to apply them automatically in POSTHOC. The eta
estimates using defined LL function were fairly close but not exactly same as
what standard POSTHOC generated and I don't know why. Does anyone have ideas
what might be going wrong in the code? Any input is appreciated!
Yours sincerely,
Tingjie Guo
User defined likelihood function in POSTHOC estimation
4 messages
3 people
Latest: Nov 06, 2019
Dear Tingjie,
I don't know the answer but this might be helpful: see the link below on
slide 3 and annotation on the right side.
http://holford.fmhs.auckland.ac.nz/docs/modelling-likelihoods-using-nonmem-vi.pdf
"*Actually its not quite - 2LL but proportional to it. It is missing a
constant (-NOBS/2*Ln(2*Pi)) but this is not needed in order to minimize -
2LL and obtain maximum likelihood estimates." *-- I don't know whether this
constant made a difference to your ETA estimates.
Kind regards,
Shan
Quoted reply history
On Tue, Nov 5, 2019 at 2:02 PM Tingjie Guo <[email protected]> wrote:
> Dear NMusers,
>
> I would like to reproduce POSTHOC estimation with manually defined
> likelihood (LL) function.
>
> This is the control stream of a standard POSTHOC for which I want to
> reproduce:
> $PK
> CL = THETA(1) * CLCR/100 * EXP(ETA(1))
> V = THETA(2) * WGT * EXP(ETA(2))
> S1 = V
>
> $ERROR
> IPRED = F
> Y = IPRED + IPRED*EPS(1) + EPS(2)
>
> $THETA
> 4.58 ; TVCL (L/h)
> 1.53 ; TVV (L/kg)
>
> $OMEGA
> 0.151321 ; omega^2 CL
> 0.139876 ; omega^2 V
>
> $SIGMA
> 0.039601 ; Proportional
> 5.76 ; Additive
>
> $EST METHOD=COND LAPLACE MAXEVAL=0 NOABORT SIG=3 PRINT=1
>
> And below is the control stream I used aiming to reproduce above POSTHOC
> estimation:
>
> $PK
> CL = THETA(1) * CLCR/100 * EXP(ETA(1))
> V = THETA(2) * WGT * EXP(ETA(2))
> S1 = V
>
> $ERROR
> IPRED = F ; Predicted DV
> ADDI = 5.76 ; Variance of additive error
> PROR = 0.039601 ; Variance of proportional error
> VAR = ADDI + PROR*IPRED**2 ; Variance of combined error
>
> Y = LOG(W) + (DV-IPRED)**2/VAR ; -2 log Likelihood,
>
> $THETA
> 4.58 ; TVCL (L/h)
> 1.53 ; TVV (L/kg)
>
> $OMEGA
> 0.151321 ; omega^2 CL
> 0.139876 ; omega^2 V
>
> $EST METHOD=COND LAPLACE -2LL MAXEVAL=0 NOABORT SIG=3 PRINT=1
>
> The LL function was based on the minus twice log posterior distribution:
> -2LPosterior = log(Var) + SUM{(DV-IPRED)^2/Var} + ETA^2/OMEGA^2
>
> I did not add eta/omega part (prior distribution) to the LL function in
> the code because NONMEM seems to apply them automatically in POSTHOC. The
> eta estimates using defined LL function were fairly close but not exactly
> same as what standard POSTHOC generated and I don't know why. Does anyone
> have ideas what might be going wrong in the code? Any input is appreciated!
>
> Yours sincerely,
> Tingjie Guo
>
>
Hi Tingjie,
You used METHOD=COND LAPLACE in the default posthoc estimate. Whether
INTERACTION is implied depends on your version of NONMEM. Could you check?
I do not entirely understand the following section:
$ERROR
IPRED = F ; Predicted DV
ADDI = 5.76 ; Variance of additive error
PROR = 0.039601 ; Variance of proportional error
VAR = ADDI + PROR*IPRED**2 ; Variance of combined error
Y = LOG(W) + (DV-IPRED)**2/VAR ; -2 log Likelihood,
Are you sure it should not be:
Y = LOG(VAR) + (DV-IPRED)**2 / VAR
Apart from that, it seems you should indeed end up with the same MLE
estimates.
Best regards,
Ruben
Quoted reply history
On Tue, Nov 5, 2019 at 2:53 PM Tingjie Guo <[email protected]> wrote:
> Dear NMusers,
>
> I would like to reproduce POSTHOC estimation with manually defined
> likelihood (LL) function.
>
> This is the control stream of a standard POSTHOC for which I want to
> reproduce:
> $PK
> CL = THETA(1) * CLCR/100 * EXP(ETA(1))
> V = THETA(2) * WGT * EXP(ETA(2))
> S1 = V
>
> $ERROR
> IPRED = F
> Y = IPRED + IPRED*EPS(1) + EPS(2)
>
> $THETA
> 4.58 ; TVCL (L/h)
> 1.53 ; TVV (L/kg)
>
> $OMEGA
> 0.151321 ; omega^2 CL
> 0.139876 ; omega^2 V
>
> $SIGMA
> 0.039601 ; Proportional
> 5.76 ; Additive
>
> $EST METHOD=COND LAPLACE MAXEVAL=0 NOABORT SIG=3 PRINT=1
>
> And below is the control stream I used aiming to reproduce above POSTHOC
> estimation:
>
> $PK
> CL = THETA(1) * CLCR/100 * EXP(ETA(1))
> V = THETA(2) * WGT * EXP(ETA(2))
> S1 = V
>
> $ERROR
> IPRED = F ; Predicted DV
> ADDI = 5.76 ; Variance of additive error
> PROR = 0.039601 ; Variance of proportional error
> VAR = ADDI + PROR*IPRED**2 ; Variance of combined error
>
> Y = LOG(W) + (DV-IPRED)**2/VAR ; -2 log Likelihood,
>
> $THETA
> 4.58 ; TVCL (L/h)
> 1.53 ; TVV (L/kg)
>
> $OMEGA
> 0.151321 ; omega^2 CL
> 0.139876 ; omega^2 V
>
> $EST METHOD=COND LAPLACE -2LL MAXEVAL=0 NOABORT SIG=3 PRINT=1
>
> The LL function was based on the minus twice log posterior distribution:
> -2LPosterior = log(Var) + SUM{(DV-IPRED)^2/Var} + ETA^2/OMEGA^2
>
> I did not add eta/omega part (prior distribution) to the LL function in
> the code because NONMEM seems to apply them automatically in POSTHOC. The
> eta estimates using defined LL function were fairly close but not exactly
> same as what standard POSTHOC generated and I don't know why. Does anyone
> have ideas what might be going wrong in the code? Any input is appreciated!
>
> Yours sincerely,
> Tingjie Guo
>
>
Hi Shan,
Constant should have no influence on estimation, from my understanding. I've
already omitted all constants terms. Thanks anyway for your information!
Warm regards,
Tingjie
Quoted reply history
On Wed, Nov 6, 2019, at 13:22, Shan Pan wrote:
> Dear Tingjie,
>
> I don't know the answer but this might be helpful: see the link below on
> slide 3 and annotation on the right side.
>
> http://holford.fmhs.auckland.ac.nz/docs/modelling-likelihoods-using-nonmem-vi.pdf
>
> "*Actually its not quite - 2LL but proportional to it. It is missing a
> constant (-NOBS/2*Ln(2*Pi)) but this is not needed in order to minimize - 2LL
> and obtain maximum likelihood estimates." *-- I don't know whether this
> constant made a difference to your ETA estimates.
> **
> Kind regards,
> Shan
>
> On Tue, Nov 5, 2019 at 2:02 PM Tingjie Guo <[email protected]> wrote:
>> Dear NMusers,
>>
>> I would like to reproduce POSTHOC estimation with manually defined
>> likelihood (LL) function.
>>
>> This is the control stream of a standard POSTHOC for which I want to
>> reproduce:
>> $PK
>> CL = THETA(1) * CLCR/100 * EXP(ETA(1))
>> V = THETA(2) * WGT * EXP(ETA(2))
>> S1 = V
>>
>> $ERROR
>> IPRED = F
>> Y = IPRED + IPRED*EPS(1) + EPS(2)
>>
>> $THETA
>> 4.58 ; TVCL (L/h)
>> 1.53 ; TVV (L/kg)
>>
>> $OMEGA
>> 0.151321 ; omega^2 CL
>> 0.139876 ; omega^2 V
>>
>> $SIGMA
>> 0.039601 ; Proportional
>> 5.76 ; Additive
>>
>> $EST METHOD=COND LAPLACE MAXEVAL=0 NOABORT SIG=3 PRINT=1
>>
>> And below is the control stream I used aiming to reproduce above POSTHOC
>> estimation:
>>
>> $PK
>> CL = THETA(1) * CLCR/100 * EXP(ETA(1))
>> V = THETA(2) * WGT * EXP(ETA(2))
>> S1 = V
>>
>> $ERROR
>> IPRED = F ; Predicted DV
>> ADDI = 5.76 ; Variance of additive error
>> PROR = 0.039601 ; Variance of proportional error
>> VAR = ADDI + PROR*IPRED**2 ; Variance of combined error
>>
>> Y = LOG(W) + (DV-IPRED)**2/VAR ; -2 log Likelihood,
>>
>> $THETA
>> 4.58 ; TVCL (L/h)
>> 1.53 ; TVV (L/kg)
>>
>> $OMEGA
>> 0.151321 ; omega^2 CL
>> 0.139876 ; omega^2 V
>>
>> $EST METHOD=COND LAPLACE -2LL MAXEVAL=0 NOABORT SIG=3 PRINT=1
>>
>> The LL function was based on the minus twice log posterior distribution:
>> -2LPosterior = log(Var) + SUM{(DV-IPRED)^2/Var} + ETA^2/OMEGA^2
>>
>> I did not add eta/omega part (prior distribution) to the LL function in the
>> code because NONMEM seems to apply them automatically in POSTHOC. The eta
>> estimates using defined LL function were fairly close but not exactly same
>> as what standard POSTHOC generated and I don't know why. Does anyone have
>> ideas what might be going wrong in the code? Any input is appreciated!
>>
>> Yours sincerely,
>> Tingjie Guo
>>