Linear Least Squares Model Object

DESCRIPTION:
These are objects of classes "lm" "mlm" They represent the fit of a linear model. The "mlm" class is for multiple response models.

GENERATION:
This class of objects is returned from the lm function to represent a fitted linear model.

METHODS:
The "lm" class of objects has methods for the following generic functions: add1, alias, anova, coef, deviance, drop1, effects, family, formula, kappa, labels, plot, predict, print, proj, residuals, summary.

The generic functions that have methods for "mlm" are: alias, coef, predict, print, summary.


INHERITANCE:
The class "mlm" inherits from "lm".

Some of the fitted model objects inherit from "lm" and/or "mlm". These include: "aov", "glm", "gam" (which inherits from "glm").


STRUCTURE:
The following components must be included in a legitimate lm object.
coefficients:
the coefficients of the least-squares fit of the response to the columns of the model matrix. The names of the coefficients are the names of the single-degree-of-freedom effects (the columns of the model matrix). If the model was overdetermined and singular.ok was true, there will be missing values in the coefficients corresponding to inestimable coefficients.
residuals:
the residuals from the fit. If weights were used, then the residuals are the raw residuals - the weights are not taken into account. If you need residuals that all have the same variance, then use the residuals function with type="pearson".
fitted.values:
the fitted values from the fit. If weights were used, the fitted values are not adjusted for the weights.
effects:
orthogonal, single-degree-of-freedom effects. Using the "qr" method, there will be as many of these as observations. The first rank of them correspond to degrees of freedom in the model and are named accordingly.
R:
the triangular factor of the decomposition. For method=qr, this is determined by the orthogonal decomposition of the model matrix. For other methods, it may be computed by other calculations, but note that summary methods for lm objects assume the existence of this component. If it is not computed, the methods will fail.
rank:
the computed rank (number of linearly independent columns in the model matrix). If the rank is less than the dimension of R, columns of R will have been pivoted, and missing values inserted in the coefficients. The upper-left rank rows and columns of R are the nonsingular part of the fit, and the remaining columns of the first rank rows give the aliasing information (see alias).
assign:
the list of assignments of coefficients (and effects) to the terms in the model. The names of this list are the names of the terms. The ith element of the list is the vector saying which coefficients correspond to the ith term. It may be of length 0 if there were no estimable effects for the term. See also R.assign below.
terms:
an object of mode expression and class term summarizing the formula. Used by various methods, but typically not of direct relevance to users.
call:
an image of the call that produced the object, but with the arguments all named and with the actual formula included as the formula argument.
contrasts:
a list containing sufficient information to construct the contrasts used to fit any factors occurring in the model. The list contains entries that are either matrices or character vectors. When a factor is coded by contrasts, the corresponding contrast matrix is stored in this list. Factors that appear only as dummy variables and variables in the model that are matrices correspond to character vectors in the list. The character vector has the level names for a factor or the column labels for a matrix.
df.residual:
the number of degrees of freedom for residuals.
R.assign:
in the case that the model was over-specified, an assignment vector defined in terms of the full-rank model only. (This component is not produced for full-rank models.) In the over-specified case, the first r columns of the R matrix define the full-rank part of the model. The R.assign vector acts like assign, but defines the terms relative to the columns of R, unlike assign which defines them in terms of columns of the original model matrix.
assign.residuals:
the vector saying which of the effects are assigned to residuals.
qr:
optionally, the qr decomposition object. See qr for its structure. This depends on using method "qr", and the qr argument.
model:
optionally the model frame, if model=T.
x:
optionally the model matrix, if x=T.
y:
optionally the response, if y=T.

For a multivariate response, the object returned has class "mlm", and the coefficients, effects, fitted values, and residuals are all matrices whose columns correspond to the response variables.


DETAILS:
The residuals, fitted values, coefficients, and effects should be extracted by the generic functions of the same name, rather than by the $ operator. For pure lm objects this is less critical than for some of the inheritor classes.

SEE ALSO:
lm , coefficients .