Skip to contents

Computes the observation-weighted score vector (gradient of the weighted 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), with each observation's contribution multiplied by weights_r[i], via a numerical (central finite-difference, step \(h = 10^{-6}\)) approximation — not an analytic derivative. Exported standalone — independent of any optimizer run — for direct numerical diagnostics at a specific parameter value.

Usage

get_log_binomial_regression_weighted_score_cpp(X, y_r, weights_r, beta)

Arguments

X

A numeric matrix of predictors.

y_r

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

weights_r

A nonnegative numeric vector of observation weights.

beta

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

Value

The finite-difference-approximated weighted score vector at beta.

See also

get_log_binomial_regression_weighted_hessian_cpp for the corresponding weighted Hessian at the same point; get_log_binomial_regression_score_cpp for the unweighted version; fast_log_binomial_regression_cpp for the full model documentation.