# Find the expected value for the sum of squares of regression

For a multilinear regression model, I'm trying to find the expected value of the sum of squares of regression (SSR). I have so far,

$$E(SSR) = E(\hat y'\hat y) = E((X\hat\beta)'(X\hat\beta)) = E((X(X'X)^{-1} X'y)'((X(X'X)^{-1} X'y)) = E((Hy)'(Hy)) =$$

And that's the extent of my matrix algebra skills :(

Rewrite your final expression as $$E(y'H'Hy)$$ Next, note that $$H$$ is symmetric and idempotent, $$H=H'$$ and $$HH=H$$, so that we get $$E(y'Hy)$$ This is a scalar, so equal to its trace, which we may permute cyclically: $$tr[E(Hyy')]$$ To continue, we need assumptions. For simplicity, I take $$X$$ to be fixed (else, we would reason conditional on $$X$$, so that we can take out $$H$$ from the expectation:
$$E(SSR)= tr[HE(yy')]$$ Also, under classical assumptions in the linear model, we would have $$Var(y)=E(yy')=\sigma^2I,$$ so that $$E(SSR)= \sigma^2tr[H]$$ Now, $$tr(H)=tr(X(X'X)^{-1}X')=tr((X'X)^{-1}X'X)=tr(I)=n-k$$
$$E(SS_R) = E(y'[X(X'X)^{-1}X'-1(1'1)^{-1}1']y) = trace([X(X'X)^{-1}X'-1(1'1)^{-1}1']\sigma^2I = E(y)'[X(X'X)^{-1}X'-1(1'1)^{-1}1']E(y) = k\sigma^2 + \beta_R'X_C'X_C\beta_R$$
where $$1$$ is a $$(n x 1)$$ vector all of whose elements are 1's, $$X_C$$ is a matrix of centered regressors values and $$\beta_R$$ is a matrix of the non-intercept regressors.