fitNB2 {WALS}R Documentation

Internal function: Fits a NB2 regression via maximum likelihood with log-link for mean and dispersion parameter.

Description

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.

Usage

fitNB2(X, Y, family, control = controlNB())

Arguments

X

Design matrix.

Y

Count response vector.

family

Object of class "familyNBWALS" generated by negbinWALS.

control

List of parameters for controlling the optimization process. Use controlNB to generate the list.

Details

The available parameters for controlling the optimization are documented in controlNB.

Value

A list with the following elements

coefficients

fitted coefficients from NB2 regression

theta

fitted dispersion parameter from NB2 regression

convergence

0 indicates successful completion. All error codes except for 99 are generated by optim. Possible error codes are

1

indicates that the iteration limit maxit had been reached.

10

degeneracy of the Nelder-Mead simplex.

51

warning from "L-BFGS-B" method; see component message for further details.

52

error from "L-BFGS-B" method; see component message for further details.

99

(only possible if controlNB(initMASS = TRUE)) indicates convergence issues in glm.nb.

ll

log-likelihood of fitted NB2 regression model

message

If controlNB(initMASS = FALSE), character string giving any additional information returned by the optimizer, else NULL.

start

If controlNB(initMASS = FALSE), contains a vector with the starting values used for optim.

See Also

controlNB, negbinWALS, glm.nb, optim.


[Package WALS version 0.2.5 Index]