I don't understand the explanation in R's help file for effects():

For a linear model fitted by lm or aov, the effects are the uncorrelated single-degree-of-freedom values obtained by projecting the data onto the successive orthogonal subspaces generated by the QR decomposition during the fitting process.

Can anybody explain what this means?

Are the orthogonal subspaces alluded to the one dimensional subspaces spanned by the columns of the Q-part of the QR-decomposition (and hence orthogonal to each other)? Or are they supposed to be orthogonal to something else?


Given the response vector $y$, explanatory variable matrix $X$ and its QR decomposition $X=QR$, the effects returned by R is the vector $Q^Ty$.

Here is the numeric example which confirms the above:

> set.seed(1001)
> x<-rnorm(100)
> y<-1+2*x+rnorm(100)
> mod<-lm(y~x)
> xqr<-qr(cbind(1,x))
> sum(abs(qr.qty(xqr,y)-effects(mod)))
[1] 0
| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.