View source: R/negbin_helpers.R
| score_negbin | R Documentation |
Gradient of the NB2 log-likelihood with respect to
\boldsymbol{\beta} under the log link.
score_negbin(X, y, mu, theta, weights = 1)
X |
Design matrix (N x p). |
y |
Response vector. |
mu |
Mean vector |
theta |
Shape parameter. |
weights |
Observation weights (default 1). |
Under log link, d\mu_i/d\eta_i = \mu_i, so the score is
\mathbf{u} = \mathbf{X}^{\top}\mathbf{w}_{\mathrm{obs}}
\odot \frac{(y_i - \mu_i)\theta}{\theta + \mu_i}
where the per-observation contribution
(y_i - \mu_i)\theta/(\theta + \mu_i) is the derivative of the
log-likelihood with respect to \eta_i.
Numeric column vector of length p (gradient).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.