LL statement for user-defined log-likelihood models

PML provides an LL statement for user-defined log-likelihood models. It is useful in situations where there is no built-in statement to describe/model the given phenomena. In this sense, it is similar to the -2LL/LIKE option in NONMEM.

LL(observed_variable, expression
  [, simulate={simulation_code}][, action code])

This statement specifies there is an observed variable, and when it is observed, its log-likelihood is the given expression. Optional action code is executed before or after the observation. If the “simu­late” keyword is present, then during simulation or predictive check, the simulation code can assign a value to the observed variable.

The following is an example illustrating how simulate can work on the LL statement.

  covariate(DOSETOT,cycledays,uni01,timeforhistograms)
  deriv(E=Kin*DOSETOT/cycledays-Kout*E)
  sequence{E=E0}
  real(u, i, prob)
  LL(EObs
     ,-E+EObs*log(E)-lgamm(EObs+1)
     , simulate={
        u=unif()
        prob=0
        i=0
        prob=prob+exp(-E+i*log(E)-lgamm(i+1))
         while(u >= prob){
           prob=prob+exp(-E+i*log(E)-lgamm(i+1))
           i=i+1
           }
        EObs=i
     }
  )

In the example above, EObs is the observed variable and -E+EObs*log(E) -lgamm(EObs+1) is log-likelihood. The optional action follows the simulate keyword. It is sepa­rate from the last action code [, action code] (e.g. [,doafter={E=0}]).

For more examples, see “Count statement for Count models”, “Event statement for Time-to-event mod­els”, or “Multi statement for Categorical models”.


Last modified date:7/9/20
Certara USA, Inc.
Legal Notice | Contact Certara
© 2020 Certara USA, Inc. All rights reserved.