Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

normalize

Normalize process likelihood using the Laplace approximation.


Description

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.

Usage

normalize(obj, flag, value = 0)

Arguments

obj

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

flag

Flag to disable the data term from the model.

value

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

Value

Modified model object that can be passed to an optimizer.


TMB

Template Model Builder: A General Random Effect Tool Inspired by 'ADMB'

v1.7.20
GPL-2
Authors
Kasper Kristensen [aut, cre, cph], Brad Bell [cph], Hans Skaug [ctb], Arni Magnusson [ctb], Casper Berg [ctb], Anders Nielsen [ctb], Martin Maechler [ctb], Theo Michelot [ctb], Mollie Brooks [ctb], Alex Forrence [ctb], Christoffer Moesgaard Albertsen [ctb], Cole Monnahan [ctb]
Initial release
2021-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.