Skip to contents

Computes the (analytic) Hessian matrix of the log-likelihood of the mean/dispersion-parameterized negative binomial regression model documented in full at fast_neg_bin_cpp (see also fast_dnbinom_mu_vec_cpp for the underlying density), at arbitrary caller-supplied params (not necessarily the MLE). Exported standalone — independent of any optimizer run — for direct numerical diagnostics at a specific parameter value.

Usage

get_negbin_regression_hessian_cpp(X, y, params)

Arguments

X

A numeric matrix of predictors, as used to fit the model.

y

A numeric vector of nonnegative-integer count responses.

params

A numeric vector \([\beta, \log\theta]\): the mean-model coefficients followed by the log-dispersion parameter, at which to evaluate the Hessian.

Value

The \((p+1) \times (p+1)\) Hessian matrix of the log-likelihood at params.

See also

get_negbin_regression_score_cpp for the corresponding gradient at the same point; fast_neg_bin_cpp for the full model documentation.