shape
is the \(k\) parameter of McCullagh and Nelder (1989, p.373) and the theta
parameter of Venables and Ripley (2002, section 7.4). The latent Gamma variable has mean 1 and variance 1/shape, and the negbin with mean \(mu\) has variance \(mu+mu^2\)/shape. The negbin
family is sometimes called the NegBin1 model (as the first, historically) in the literature on negative binomial models, and sometimes the NegBin2 model (because its variance is a quadratic function of its mean).
spaMM
does not handle models with the ``other'' negative-binomial response family where the variance is a linear function of the mean, because this is not an exponential-family model. However, it can approximate it, through a Laplace approximation and a bit of additional programming, as a Poisson-Gamma mixture model with an heteroscedastic Gamma random-effect, specified e.g. as (weights-1|.)
where the weights need to be updated iteratively as function of predicted response. File test-negbin1.R
in the /test
directory provides one example. Other mean-variance relationship can be handled in the same way.
The name NB_shape
should be used to set values of shape in control arguments of the fitting functions (e.g., fitme(.,init=list(NB_shape=1))
).