[R] Why H1=1? (H's the hat matrix)

John Fox jfox at mcmaster.ca
Sun Oct 11 20:23:50 CEST 2009

Dear Peng,

This seems a curious question to pose on r-help: The vector 1 is the first
column of X, and hence lies in the subspace spanned by the columns of X. H
projects any vector orthogonally onto the subspace spanned by X. Thus, if a
vector, such as 1, lies in this subspace, it's projected onto itself.


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> Behalf Of Peng Yu
> Sent: October-11-09 2:03 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Why H1=1? (H's the hat matrix)
> Suppose I have the following hat matrix:
> H=X(X'X)^{-1}X'
> X is a n by p matrix, where n >= p and X_{i,1} = 1
> I'm wondering why H1 = 1. (Here, 1 is column vector, whose each
> element is the number 1)
> Thank you!
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list