A Family of GLM Models
- DESCRIPTION:
-
A class of objects returned by one of the family functions.
- GENERATION:
-
This class of objects is returned by one of the
family
functions. See family for the choices. It is a list of functions and expressions that define the IRLS iterations for fitting glm and gam models. These family objects allow a great deal of flexibility in the use of glm() and gam().
In particular, they allow construction of robust fitting algorithms and composite link functions. There is a print() method for family objects, that produces a simple summary without any details; use unclass(family.object) to see the contents.
- STRUCTURE:
-
The following components, with a corresponding functionality,
are required for a family object.
- family:
-
a character vector giving the family name, and the names of the link and variance functions.
- link:
-
a function with argument mu that transforms from the scale of the mean to the scale of the linear or additive predictor eta.
- inverse:
-
a function with argument eta, the inverse of the link.
- deriv:
-
a function with argument mu, the derivative of the link function.
- initialize:
-
an expression to initialize the values of the fitted values mu in the body of glm() or gam(). Other values can also be initialized, such as the
prior weights
w, or the maximum number of iterations maxit, to name two. Modifying these expressions should be done with some care, and is only recommended for experienced users. Other variables local to glm() or gam() can be initialized as well; see binomial()$initialize for an example. The initialize expression can also be used to transform a response variable having specialized structure into the required vector response y. Once again the binomial serves as an example.
- variance:
-
a function with argument mu, the variance function.
- deviance:
-
the deviance function has four arguments:
deviance(mu, y, w, residuals = F)
and returns the deviance, a quantity similar to the residual sum of squares for a Gaussian least squares model. If residuals=T, deviance() returns a vector of
deviance residuals, whose weighted sum of squares is the deviance.
- weight:
-
an expression for updating the iterative weights. For the binomial family, this expression is w*mu*(1 - mu), for the gaussian it is w, where w are the prior weights.