Skip to contents

Computes a numerical (central finite-difference 4-point stencil, step \(h = 10^{-4}\)) approximation of the Hessian matrix of the log-likelihood of the constrained log-link binomial regression model documented in full at fast_log_binomial_regression_cpp, at arbitrary caller-supplied beta (not necessarily the MLE) — not an analytic second derivative. Exported standalone — independent of any optimizer run — for direct numerical diagnostics at a specific parameter value.

Usage

get_log_binomial_regression_hessian_cpp(X, y_r, beta)

Arguments

X

A numeric matrix of predictors.

y_r

A binary (0/1) numeric vector of responses.

beta

A numeric vector of coefficients \(\beta\) at which to evaluate the Hessian.

Value

The finite-difference-approximated Hessian matrix of the log-likelihood at beta.

See also

get_log_binomial_regression_score_cpp for the corresponding (also finite-difference) gradient at the same point; fast_log_binomial_regression_cpp for the full model documentation, including the probability-boundary constraint this Hessian is evaluated without enforcing.