Use a QR Matrix Decomposition

DESCRIPTION:
Returns functions of a QR decomposition with a vector or matrix representing the response.

USAGE:
qr.coef(qr, y)
qr.fitted(qr, y)
qr.resid(qr, y)
qr.qty(qr, y)
qr.qy(qr, y)

REQUIRED ARGUMENTS:
qr:
object representing a QR decomposition. This will typically have come from a previous call to qr or lsfit.
y:
vector or matrix of numeric (or complex) data (the "dependent" or "response" data). The length of the vector or the number of rows of the matrix must correspond to the number of rows in the x matrix from which the decomposition was computed.

VALUE:
qr.coef, qr.fitted and qr.resid return the coefficients, the fitted values and the residuals that would be obtained by a least squares fit of y to the x matrix from which qr was obtained.

qr.qy and qr.qty return the results of the matrix multiplications: Q %*% y t(Q) %*% y Conj(t(Q)) %*% y (in the complex case) where Q is the order-nrow(x) orthogonal (or unitary) transformation represented by qr.


NOTE:
The results of qr.coef, etc., will reflect an intercept term, if included, for example, in a call to lsfit.

The QR decomposition used does not return an explicit orthogonal (or unitary) matrix. For reasons of accuracy and efficiency, an indirect representation of the decomposition is used.


REFERENCES:
Dongarra, J. J., Bunch, J. R., Moler, C. B. and Stewart, G. W. (1979). LINPACK Users' Guide. SIAM, Philadelphia.

Thisted, R. A. (1988). Elements of Statistical Computing. Chapman and Hall, New York.


SEE ALSO:
qr , lsfit .

EXAMPLES:
reg0 <- lsfit(x,y)
coef1 <- qr.coef(reg0$qr, y1) # different y, same x