Exact fixed-parameter NB1, common-scale Gamma and censored Gamma models for [L0glm.fit()], [L0glm.tune()], [sis_glm()] and [glm_cluster()]. These adapters supply the likelihood score and positive quadratic curvature to the shared IRLS loop, with its usual selection, line search and relaxed refitting. These adapters are intended for L0glm's score-based IRLS. External fitting engines need to implement their likelihood scores to fit the same models.
Usage
nb1(dispersion = 1, link = "log")
Gamma_scale(scale = 1, link = "log", censor = 0)
Gamma_censored(dispersion = 1, link = "log", censor = 0.5)Arguments
- dispersion
Known variance-to-mean ratio for `nb1()` (at least one), or known Gamma dispersion for `Gamma_censored()` (strictly positive).
- link
Link name. Defaults to `"log"`; `"identity"` is useful for additive nonnegative signals.
- scale
Known positive common Gamma scale.
- censor
Detection limit for Gamma observations. A recorded zero means the latent intensity is below this limit. Positive observations must be at least the limit. Use zero for uncensored, strictly positive Gamma data.
Value
A family object containing its fixed noise parameter, likelihood score and native likelihood/deviance functions.
Details
For NB1, with \(\phi>1\), $$Y\sim\operatorname{NB}\{a=\mu/(\phi-1),\ p=1/\phi\}, E(Y)=\mu,\quad\operatorname{Var}(Y)=\phi\mu.$$ `dispersion=1` uses the Poisson limit. Its negative log-likelihood score is \(\{\psi(a)-\psi(a+y)+\log\phi\}/(\phi-1)\) and its curvature is \(\{\psi_1(a)-\psi_1(a+y)\}/(\phi-1)^2\).
`Gamma_scale()` uses \(Y\sim\operatorname{Gamma}(\mu/b,b)\) with fixed scale \(b\), giving \(\operatorname{Var}(Y)=b\mu\). For a positive observation its score is \(\{\psi(\mu/b)+\log b-\log y\}/b\) and curvature is \(\psi_1(\mu/b)/b^2\). Independent NB1 channels sharing \(\phi\), and Gamma channels sharing \(b\), are closed under sums. This property applies to latent Gamma variables; sums of censored recorded intensities provide an approximation.
`Gamma_censored()` uses the standard Gamma mean/dispersion model, with shape \(1/\phi\), scale \(\phi\mu\) and variance \(\phi\mu^2\). In either Gamma model a zero contributes \(\log P(Y<d;\mu)\) and a positive observation contributes its log density. The native kernel evaluates the incomplete Gamma function and its derivatives. With censoring enabled, a zero mean represents the degenerate zero limit.
Each family object contains its fixed noise parameter. Its GLM dispersion slot is one because the score and likelihood include that parameter; pass it to the constructor. A pooled noise parameter can be supplied for multichannel observations. Coefficients model the latent mean. Deviance is twice the likelihood gain over the best separate mean for each observation. `deviance_true` is unavailable for these models because a noiseless mean is not an observed count or censored response.
Clustering uses exact likelihood-ratio distances and a Ward hierarchy, with fixed, dynamic or information-criterion cuts. A Bregman hierarchy is available for the regular GLM families documented in [glm_cluster()].
