inst/templates/gamma_ADFun.R

#' Create a \code{TMB::ADFun} object for the gamma likelihood.
#'
#' @param x Vector of observations.
#' @return A list as returned by \code{TMB::MakeADFun} representing the negative loglikelihood of a gamma distribution.
#' @export
gamma_ADFun <- function(x) {
  TMB::MakeADFun(data = list(model = "GammaNLL", x = x),
                 parameters = list(alpha = 1, beta = 1),
                 DLL = "{{pkg}}_TMBExports", silent = TRUE)
}
mlysy/TMBtools documentation built on April 1, 2022, 6:18 p.m.