Skip to contents

Computes a numerical (central finite-difference, step \(h = 10^{-6}\)) approximation of the score vector (gradient of the log-likelihood) of the constrained identity-link binomial regression model documented in full at fast_identity_binomial_regression_cpp, at arbitrary caller-supplied beta (not necessarily the MLE) — not an analytic derivative. Exported standalone — independent of any optimizer run — for direct numerical diagnostics (e.g. verifying convergence, or cross-checking an analytic gradient elsewhere) at a specific parameter value.

Usage

get_identity_binomial_regression_score_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 score.

Value

The finite-difference-approximated score vector at beta.

See also

get_identity_binomial_regression_hessian_cpp for the corresponding (also finite-difference) Hessian at the same point; fast_identity_binomial_regression_cpp for the full model documentation.