Extract Coefficients, etc. from a Model

DESCRIPTION:
These functions extract the coefficients, residuals, and fitted values from a fitted model.

USAGE:
coefficients(object)
residuals(object)
fitted.values(object)

REQUIRED ARGUMENTS:
object:
any object representing a fitted model, or, by default any object with a component named by the name of the extractor function.

VALUE:
the coefficients, residuals, or fitted values defined by the model in object. While for some models this will be identical to the component of the object with the same name, you are encouraged to use the extractor functions, since these will call the appropriate method for this class of object. For example, residuals from generalized linear models come in four flavors, and the typically most useful one is not the component.

NOTE:
As a special inducement to use the extractor function rather than the component, three abbreviated versions of these functions exist; namely, coef(), resid(), and fitted().

SINGULAR MODELS:
When a model is over-specified, the standard fitting method permutes the columns of the model matrix and so the corresponding coefficients and effects. This is another case in which the components for these quantities behave a little differently from the values of the corresponding functions. If fit is a fitted, over-determined model, then coef(fit) gives back only the full-rank part of the coefficients, while fit$coef gives back coefficients for all the columns in the original model matrix. In the latter case, elements that are aliased with earlier degrees of freedom come out as NA. In breaking down the coefficients or effects by terms, the distinction also comes up. The component assign refers to the original model matrix, so it defines the degrees of freedom in fit$coef. Another component, R.assign is produced in the singular case to index terms in the R matrix, and also in coef(fit). See lm.object for more details.

SEE ALSO:
effects , lm.object , predict .

EXAMPLES:
kyph.glm1 <- glm(Kyphosis ~ Age + Start + Number,
                 family = binomial, data = kyphosis)
coef(kyph.glm1)

# produces the following output: (Intercept) Age Start Number -2.036932 0.01093048 -0.20651 0.410601

residuals(kyph.glm1)

# produces the following output: 1 2 3 4 5 -0.7707923 -0.5111615 1.189314 -1.106713 -0.2461915 . . .