[R] proj() function for lm objects
John Fox
jfox at mcmaster.ca
Mon Jan 24 18:33:08 CET 2005
Dear Piet,
You'll find more of an explanation in Sec. 5.3.3 of Chambers and Hastie,
eds., Statistical Models in S.
Briefly, proj() computes the orthogonal projections of the response (y)
sequentially onto the subspaces spanned by columns of the model matrix (X)
corresponding to terms in the model. Consequently, in a model in which the
first term is the constant, the first such projection is just the mean of
the response. Suppose the second term has just one degree of freedom; then
the second projection is of y minus its mean onto the second column of X
minus its mean. Each such projection is essentially residualized (both y and
X) for the preceding ones, and therefore the coefficients are for each term
in a sequential set of regressions, not the coefficients of the model as
whole (or of any particular such regression). The last projection is onto
the orthogonal complement of X and thus gives residuals for the model as a
whole. The sum of these projections is y.
I hope this helps,
John
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
--------------------------------
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Piet
> van Remortel
> Sent: Monday, January 24, 2005 10:16 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] proj() function for lm objects
>
> Dear all,
>
> I'm trying to find a clear explanation of what the 'proj(lm)'
> function
> produces after having fit a linear model using 'lm'. I find
> the help
> page on the proj() function highly unclear (surely part to my
> limited knowledge of statistics). Can anybody provide a
> pointer to a clearer explanation, preferable containing some
> examples of the calculations involved ? More particularly, I
> am interested in the relation between the coefficients
> produced by the 'coef()' function on an 'lm' object, and the
> corresponding projections.
>
> regards,
>
> Piet
>
> --
> Piet van Remortel
> Intelligent Systems Lab
> University of Antwerp
> Belgium
> http://www.islab.ua.ac.be
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list