View source: R/negbin_helpers.R
| negbin_qp_score_function | R Documentation |
Computes the score (gradient of NB log-likelihood) in the format
expected by lgspline's qp_score_function interface.
negbin_qp_score_function(
X,
y,
mu,
order_list,
dispersion,
VhalfInv,
observation_weights
)
X |
Block-diagonal design matrix (N x P). |
y |
Response vector (N x 1). |
mu |
Predicted values (N x 1), same order as X and y. |
order_list |
List of observation indices per partition. |
dispersion |
Shape parameter |
VhalfInv |
Inverse square root of correlation matrix; when non-NULL
the score is computed on the whitened scale as
|
observation_weights |
Observation weights. |
Without correlation (VhalfInv = NULL), the score is
\mathbf{X}^{\top}\mathbf{w} \odot (y - \mu)\theta/(\theta + \mu).
With correlation, the GEE score is
\tilde{\mathbf{X}}^{\top}\mathrm{diag}(\mathbf{W})
\mathbf{V}^{-1}(\mathbf{y} - \boldsymbol{\mu})
where \mathbf{W} contains the NB working weights. The
whitening is absorbed by pre-multiplying both \mathbf{X} and
the residual by \mathbf{V}^{-1/2}.
Numeric column vector of length P.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.