family functions.
This class of objects is returned by one of the
family functions; see the
family help file for the available choices.
A family is a list of functions and expressions that define the IRLS iterations for fitting
glm and
gam models.
The
family objects allow a great deal of flexibility in fitting generalized linear and generalized additive models.
In particular, they allow construction of robust fitting algorithms and composite link functions.
The following components and corresponding functionality are required for a valid
family object.
mu that transforms from the scale of the mean to the scale of the linear or additive predictor
eta.
eta that defines the inverse of the link.
mu that defines the derivative of the link.
mu in the body of
glm and
gam.
Other values can also be initialized, including the prior weights
w and the maximum number of iterations
maxit.
Modifying the
w and
maxit expressions should be done with care, and is only recommended for experienced users.
Other variables local to
glm and
gam can be initialized as well; see
binomial()$initialize for an example.
The
initialize expression can be used to transform a response variable having specialized structure into the required vector response
y.
Once again, the
binomial family serves as an example.
mu that defines the variance function.
mu, y, w, and
residuals=F.
The function returns the deviance, a quantity similar to the residual sum of squares for a Gaussian least squares model.
If
residuals=T, the
deviance function returns a vector of deviance residuals whose weighted sum of squares is the deviance.
binomial family, this is
w*mu*(1 - mu), and for the
gaussian family it is
w, where
w contains the prior weights.