Internal fitting function for NB2 regression models. Used for fitting the
starting values of the one-step ML estimators in walsNB. Only
works with log-link so far, no other links tested.
fitNB2(X, Y, family, control = controlNB())A list with the following elements
fitted coefficients from NB2 regression
fitted dispersion parameter from NB2 regression
0 indicates successful completion. All error codes except
for 99 are generated by optim. Possible error
codes are
1indicates that the iteration limit maxit had been reached.
10degeneracy of the Nelder-Mead simplex.
51warning from "L-BFGS-B" method; see component message
for further details.
52error from "L-BFGS-B" method; see component message
for further details.
99(only possible if controlNB(initMASS = TRUE)) indicates
convergence issues in glm.nb.
log-likelihood of fitted NB2 regression model
If controlNB(initMASS = FALSE), character string
giving any additional information returned by the optimizer, else NULL.
If controlNB(initMASS = FALSE), contains a vector with the
starting values used for optim.
Design matrix.
Count response vector.
Object of class "familyNBWALS" generated by
negbinWALS.
List of parameters for controlling the optimization process.
Use controlNB to generate the list.
The available parameters for controlling the optimization are documented in
controlNB.