You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tulpa_re_aghq() returns the mode/theta cross-Hessian block (#398).
Adds blup_cross (Bf) to the return value: the per-group -d^2 ell_g / d theta db block at the mode, needed to draw a group's BLUP jointly with
theta instead of independently (Cinv %*% t(Bf) is the first-order db_hat/dtheta correction) -- the same joint-draw contract .tobs_community_em()-based tulpaObs families already expose via their own Cinv/Bf. Computed via a cheap central finite difference of theta_score over b (O(d) oracle calls, independent of n_theta).
Declines to NA (never a silent 0) when the oracle's theta_score has no
analytic implementation, as on the R-closure bridge (make_site/ make_group) -- REGroupOracle gains has_theta_score() to signal this.
Verified against the closed-form binomial-GLMM cross term and an
independent finite-difference re-solve of the group's mode under a
perturbed theta. Unblocks gcol33/tulpaObs#220 (ms_abun()'s posterior-SBC
registration).
tulpa_re_aghq() also returns the FULL per-group joint covariance
across RE terms (blup_cov_g, blup_cross_g). blup_var only ever
exposed the per-term diagonal of a group's posterior covariance; when a
group carries more than one RE term sharing the same grouping factor (e.g.
an abundance-arm term and a detection-arm term on the same species), the
group's mode is found jointly across every term's coefficients, so real
posterior covariance can exist BETWEEN terms -- cpp_aghq_blups() already
inverts the full joint Hessian to get it, it just discarded everything off
the diagonal before this. Drawing a group's terms independently would
repeat gcol33/tulpaObs#226 one level deeper (inside a group instead of
between theta and a group). Validated against a closed-form joint-Hessian
construction on a toy model with deliberately collinear RE terms; the new
diagonal is byte-identical to the pre-existing blup_var.