Learn R Programming

fb4package (version 2.0.0)

neg_log_likelihood_lognormal: Calculate negative log-likelihood for log-normal weight observations

Description

Calculates the negative log-likelihood for observed final weights assuming they follow a log-normal distribution around the predicted weight. Consistent with the TMB backend implementation.

Usage

neg_log_likelihood_lognormal(params, observed_weights, simulation_function)

Value

Negative log-likelihood value (scalar)

Arguments

params

Vector of parameters to estimate: - params[1]: p_value (feeding level, 0.01-5.0) - params[2]: log(sigma) (log of standard deviation of log-weights)

observed_weights

Numeric vector of observed final weights (g)

simulation_function

Function that takes p_value and returns predicted weight