In an assignment I received, I was asked to show that
$$\beta^TX^T(H-\frac{1}{n}J)X\beta=\beta_R^TX_C^TX_C\beta_R$$
Where $H=X(X^TX)^{-1}X^T$, $J$ is an $n\times n$ matrix of ones, $X=[1, X_R]$ for a vector of ones, and $X_C$ is $X_R$ with centered columns, which I take to mean that $X_C=(I-\frac{1}{n}J)X_R$, and finally, $\beta=[\beta_0,\beta_R]$ for a vector $\beta_R$.

In my attempt to show this, I've gotten this, so far:
$$\beta^TX^T(H-\frac{1}{n}J)X\beta=\beta^TX^THX\beta-\frac{1}{n}\beta^TX^TJX\beta=\beta^TX^TX\beta-\frac{1}{n}\beta^TX^TJX\beta=\beta^TX^T(I-\frac{1}{n}J)X\beta$$

And furthermore, I have shown $X_C^TX_C=X_R^T(I-\frac{1}{n}J)^2X_R=X_R^T(I-\frac{1}{n}J)X_R$. But that would mean, for the equivalence that I set out to prove to hold, that $X\beta=X_R\beta_R$. How can this be true, given the definitions of $X_R$ and $\beta_R$ given at the start? Since this would imply that $\beta_0=0$, which isn't part of the assumptions.

- 677
- 3
- 10

## 2 Answers

$\beta^TX^T(I-J/n)X\beta=(\beta_01^T+\beta_R^TX_R^T)(I-J/n)(\beta_01+X_R\beta_R)=\\ \beta_R^TX_R^T(I-J/n)X_R\beta_R+\beta_R^TX^T(I-J/n)\beta_01+\beta_01^T(I-J/n)\beta_01+\beta_01^T(I-J/n)X_R\beta_R$.

What can we say about $(I-J/n)1$ (and, consequently, $1^T(I-J/n)$?

- 527
- 2
- 9

Denote the Centering Matrix by $\,N=\big(I-\tfrac{1}{n}J\big)\,$ which is an orthoprojector, i.e. $\,N^TN=N^2=N.$

For ease of typing, give each variable a distinct Latin name, rather than using subscripts and/or Greek letters. $$\eqalign{ R &= X_R,\quad &X &= \big[\,{\tt\large 1}\,|\,R\,\big],\quad &C &= X_C = NR,\quad &Z &= NX = \big[\,0\,|\,C\,\big] \\ r &= \beta_R,\quad &b &= \pmatrix{\beta_0\\r},\quad &H &= X(X^TX)^{-1}X^T \\ }$$ Note that the Hat matrix acts a left identity, i.e. $\;HX = X$.

Now expand the matrix on the LHS.
$$\eqalign{
X^T\left(H-\tfrac{J}{n}\right)X
&= X^TX -X^T\left(\tfrac{J}{n}\right)X \\
&= X^T\left(I-\tfrac{J}{n}\right)X \\
&= X^T(N^TN)X \\
&= Z^TZ \\
}$$
The scalar of interest is $\;b^TZ^TZb$

Expanding $(Zb)$ yields
$$\eqalign{
Zb \;=\; \pmatrix{0&C}\pmatrix{\beta_0\\r} \;=\; Cr \\
}$$
which is in the desired form.

- 27,604
- 2
- 22
- 62