
Calculate log-likelihood for Poisson-distributed count data
Source:R/calc_log_likelihood_distributions.R
calc_log_likelihood_poisson.RdComputes the total log-likelihood for integer count data under the Poisson distribution.
Each observation can be weighted via weights, defaulting to equal weights.
Usage
calc_log_likelihood_poisson(
observed,
estimated,
weights = NULL,
zero_buffer = TRUE,
eps_rel = 0.02,
verbose = TRUE
)Arguments
- observed
Integer vector of observed non-negative counts (e.g., cases, deaths).
- estimated
Numeric vector of expected values from the model (same length as
observed).- weights
Optional numeric vector of non-negative weights, same length as
observed. Default isNULL, which sets all weights to 1.- zero_buffer
Logical; if
TRUE(default), rounds observed values to integers and adds small buffer to avoid zero estimates. IfFALSE, enforces strict integer requirements.- eps_rel
Positive scalar; the predicted mean of every cell is floored at
max(1e-4, eps_rel * mean(observed))before the density is evaluated. Default0.02. Seecalc_log_likelihood_negbin.- verbose
Logical; if
TRUE, prints diagnostics and total log-likelihood.