Documentation

20.7 $PRED models and general likelihoods

$PRED directly computes predictions/likelihood without compartmental ADVAN structure. It supports flexible PK/PD and statistical models when event-state simulation is not required or is coded explicitly.

The model must set Y consistently. Gaussian records derive residual variance from EPS sensitivity. F_FLAG=1 treats Y as likelihood and F_FLAG=2 as a −2 log-likelihood contribution. Those general records require Laplace or SAEM.

Data-driven conditional logic, covariates and persistent variables follow supported NM-TRAN semantics. Validate branch coverage with representative records. For general likelihoods, calculate record-level contributions independently at fixed parameters.

Output PRED/IPRED/residual availability depends on observation type; likelihood records intentionally have blank ordinary residuals.

Validate the likelihood record by record

Construct tiny datasets whose likelihood can be calculated independently. Include ordinary observations, missing observations, censored or categorical outcomes where relevant, and numerical extremes. At a fixed parameter vector, compare each record’s contribution and the total objective with a hand calculation or trusted script. A matching total alone can conceal offsetting errors.

Be explicit about scale. A probability, density, log probability and negative twice log-likelihood are different quantities. Verify what F_FLAG requests and which sign and transformation nlmx applies. Clamp or reformulate extreme calculations only in a way that preserves the intended likelihood; silent underflow to zero or log(0) can dominate the objective.

For mixed outcome models, confirm which records contribute to which likelihood and how MDV, EVID and compartment fields interact. Diagnostic residuals developed for continuous normal errors may not be meaningful for every general likelihood. Plan outcome-appropriate predictive checks rather than relying on a standard GOF panel alone.

Common mistakes

Do not combine probability and prediction meanings of Y, use FOCE for F_FLAG likelihoods, or assume $PRED has implicit dose-state handling. Probability zero creates infinite objective and requires numerically stable expressions.

Checklist

  • Define Y meaning for each record.
  • Validate branches and scales.
  • Use Laplace/SAEM for F_FLAG.
  • Compare fixed record contributions.
  • Expect blank Gaussian residuals where inapplicable.

Further reading

See F_FLAG troubleshooting, Chapter 18 likelihood records, and Chapter 19 SAEM.