R: Fit Generalized Linear Model by Fisher Scoring with Levenberg...

glmgam.fit {statmod} | R Documentation

## Fit Generalized Linear Model by Fisher Scoring with Levenberg Damping

### Description

Fit a generalized linear model with secure convergence. Provided for gamma glm with identity links or negative binomial glm with log-links.

### Usage

    glmgam.fit(X, y, coef.start=NULL, tol=1e-6, maxit=50, trace=FALSE)
    glmnb.fit(X, y, dispersion, weights=NULL, offset=0, coef.start=NULL, start.method="mean",
              tol=1e-6, maxit=50, trace=FALSE)

### Arguments

`X` | design matrix, assumed to be of full column rank. Missing values not allowed.
`y` | numeric vector of responses. Negative or missing values not allowed.
`dispersion` | numeric vector of over-dispersion parameters for negative binomial. If of length 1, then same over-dispersion is assumed for all observations.
`weights` | numeric vector of positive weights, defaults to all one.
`offset` | offset vector for linear model
`coef.start` | numeric vector of starting values for the regression coefficients
`start.method` | method used to find starting values, possible values are `"mean"` and `"log(y)"`
`tol` | small positive numeric value giving convergence tolerance
`maxit` | maximum number of iterations allowed
`trace` | logical value. If `TRUE` then output diagnostic information at each iteration.

### Details

These functions implement a modified Fisher scoring algorithm for generalized linear models, similar to the Levenberg-Marquardt algorithm for nonlinear least squares. The Levenberg-Marquardt modification checks for a reduction in the deviance at each step, and avoids the possibility of divergence. The result is a very secure algorithm that converges for almost all datasets.

`glmgam.fit` is in principle similar to `glm.fit(X,y,family=Gamma(link="identity"))` but with much more secure convergence. This function is used by `mixedModel2Fit`.

`glmnb.fit` is in principle similar to `glm.fit(X,y,family=negative.binomial(link="log",theta=1/dispersion))` but with more secure convergence.

### Value

List with the following components:

`coefficients` | numeric vector of regression coefficients
`fitted` | numeric vector of fitted values
`deviance` | residual deviance
`iter` | number of iterations used to convergence. If convergence was not achieved then `iter` is set to `maxit+1`.

### Author(s)

Gordon Smyth and Yunshun Chen

### Examples

    y <- rgamma(10,shape=5)
    X <- cbind(1,1:10)
    fit <- glmgam.fit(X,y,trace=TRUE)

[Package statmod version 1.4.30 Index]