normalize: Normalize process likelihood using the Laplace approximation.

View source: R/normalize.R

normalizeR Documentation

Normalize process likelihood using the Laplace approximation.


If the random effect likelihood contribution of a model has been implemented without proper normalization (i.e. lacks the normalizing constant), then this function can perform the adjustment automatically. In order for this to work, the model must include a flag that disables the data term so that the un-normalized random effect (negative log) density is returned from the model template. Automatic process normalization may be useful if either the normalizing constant is difficult to implement, or if its calulation involves so many operations that it becomes infeasible to include in the AD machinery.


normalize(obj, flag, value = 0)



Model object from MakeADFun without proper normalization of the random effect likelihood.


Flag to disable the data term from the model.


Value of 'flag' that signifies to not include the data term.


Modified model object that can be passed to an optimizer.

TMB documentation built on Nov. 27, 2023, 5:12 p.m.

Related to normalize in TMB...