Skip to main content

joint_poisson_fit

Function joint_poisson_fit 

Source
pub fn joint_poisson_fit(
    objective: &JointPoissonObjective<'_>,
    params: &mut ParameterSet,
    config: &JointPoissonFitConfig,
) -> Result<JointPoissonResult, FittingError>
Expand description

Two-stage joint-Poisson fit: damped Fisher stage followed by Nelder-Mead polish.

Counts-path contract this function satisfies:

  • Minimizes the conditional binomial deviance D(θ) (JointPoissonObjective::deviance), not fixed-flux Poisson NLL.
  • Reports D / (n − k) as the primary GOF.
  • Honours an explicit c = Q_s/Q_ob stored in the objective.
  • Runs Nelder-Mead polish after the gradient stage to escape the initial-point stall seen on backgrounded fits.
  • Exposes gn_converged and polish_converged separately so callers do not rely on a single “success” flag — acceptance is meant to come from the deviance value.

The damped-Fisher stage uses LM-style acceptance: a step is accepted if it satisfies an Armijo condition on D; on rejection, λ is increased and the step is recomputed. Bounds are enforced via projection (clamp).