0
$\begingroup$

I needed some help trying to understand why the sum of the observed values $Y_i$ equals the sum of the estimated values $\hat{Y}_i$.

$\endgroup$
  • $\begingroup$ In linear least squares regression the sum of estimated does not equal the sum of observed values when there is no intercept term. E.g. for $y_i = a x_i + \epsilon_i $ with $y_i = \lbrace -1,1 \rbrace$ and $x_i = \lbrace 0, 1 \rbrace $ the estimate will be $\hat {a} =1$ with $\sum y_i = 0 \neq 1 =\sum \hat {y}_i $ $\endgroup$ – Sextus Empiricus Oct 9 '19 at 17:37
2
$\begingroup$

$Y_i = \hat{Y}_i + \hat{\epsilon_i}$ by definition.

Also, we know that $\frac{1}{n}\sum_{i=1}^{n}{\hat{\epsilon}_i}=0$ because the intercept of the model absorbs the mean of the residuals.

So, $\frac{1}{n}\sum_{i=1}^{n}{Y_i} = \frac{1}{n}\sum_{i=1}^{n}{\hat{Y}_i} + \frac{1}{n}\sum_{i=1}^{n}{\hat{\epsilon_i}} = \frac{1}{n}\sum_{i=1}^{n}{\hat{Y}_i} + 0 = \frac{1}{n}\sum_{i=1}^{n}{\hat{Y}_i}$

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

Let $P$ be the projection matrix on $X$, where one of the columns of $X$ is $\mathbf{1}$, where $\mathbf{1}$ is vector of ones, then \begin{align} \mathbf{1}'\hat{y}&=\mathbf{1}'Py\\ &=\left(P'\mathbf{1}\right)'y\\ &=\mathbf{1}'y. \end{align}

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

Let us consider the special case of a simple linear regression.

Minimizing the sum of squared residuals $S=\sum_{r=1}^{n}(y_{r}-a-b x_{r})^{2}$ w.r.t. $a$ and $b$ gives the "normal equations" (first order conditions) $$ \sum_{r=1}^{n}y_{r}=na+b\sum_{r=1}^{n}x_{r}\quad\text{and}\quad\sum_{r=1}^{n}y_{r}x_{r}=a\sum_{r=1}^{n}x_{r}+b\sum_{r=1}^{n}x_{r}^{2}. $$ The fitted values are $\hat{y}_{r}=a+bx_{r}$, with residuals $$\hat{u}_{r}=y_{r}-(a+bx_{r})$$ Consider $$\sum_{r=1}^{n}\hat{u}_{r}=\sum_{r=1}^{n}y_{r}-\sum_{r=1}^{n}\hat{y}_{r}=\sum_{r=1}^{n}y_{r}-\sum_{r=1}^{n}(a+bx_{r})=\sum_{r=1}^{n}y_{r}-na-b\sum_{r=1}^{n}x_{r}.$$ Now, substitute $\sum_{r=1}^{n}y_{r}$ for the first normal equation.

| cite | improve this answer | |
$\endgroup$

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