proj
Projection Matrix

Description

Returns a matrix or series of matrices that represent the projection.
This function is an S Version 3 generic (see Methods); method functions can be written to handle specific S Version 3 classes of data. Classes which already have methods for this function include: aovlist, lm.

Usage

proj(object, ...)
## Default S3 method:
proj(object, onedf = TRUE, ...)
## S3 method for class 'aov':
proj(object, onedf = FALSE, unweighted.scale = FALSE, ...)
## S3 method for class 'aovlist':
proj(object, onedf = FALSE, unweighted.scale = FALSE, ...)
## S3 method for class 'lm':
proj(object, onedf = FALSE, unweighted.scale = FALSE, ...)

Arguments

object any object of class lm or any object that inherits from class lm. For proj.aovlist, the object are objects inheriting from class aovlist. It will run faster if the object contains either a qr component or a proj component.
onedf logical flag. When TRUE , the function returns a matrix of single-degree-of-freedom projections of the response variable onto the columns of the predictor matrix. The default method does not use this argument. When FALSE, the function collapses the single degree of freedom projections into multi-degree-of-freedom projections. Each column of the collapsed result represents one term of the analysis of variance table. The sum of squares of each column is the sum of squares for the corresponding term in the model formula, with degrees of freedom given by the df attribute of the result. The formula itself is returned in the formula attribute.
unweighted.scale Whether results are returned on the unweighted scale (useful for comparing results with the original response) or the weighted scale (which is the scale used for the data analysis). This only affects models with weights.

... any other arguments will be ignored.

Details

For proj.default, the object should contain a qr component and a effects component. For proj.aov, it is not implemented for multiple responses, so object inherits from maov is not supported. For proj.lm, it is not implemented for mlm filts, so object inherits from mlm is not supported.
Value
matrix of orthogonal columns, one column for each column in an orthogonalized model matrix. In the default method, each column in the result is the projection of the response variable onto a column in the Q matrix from the QR decomposition of the model matrix. The sum across the columns gives the column of predicted values. The sum of the squared values in each column is the single-degree-of-freedom sum of squares for the corresponding column of the model matrix.
If onedf is TRUE, the result matrix with a row for each coefficient, otherwise, it with a row for each term.
The method for lm objects appends a column of residuals.
See Also
aov, lm.
Examples
lm.object <- lm(speed ~ dist, cars)
tmp <- proj(lm.object)
Package stats version 6.1.1-7
Package Index