# Regression: Is $\overline{y}=\frac{1}{n}\sum^n_{i=1} y_i$ or $\hat{\beta_0}+\hat{\beta_1}\bar{x}$

As the question suggests, I'm used to $\overline{y}$ being $\frac{1}{n}\sum^n _{i=1} y_i$ but in the following proof, this seems to be not the case.

$$SS_{reg}=\sum^n_{i=1}(\hat{y}_i-\overline{y})^2=\sum^n_{i=1}[(\hat{\beta}_0+\hat{\beta}_1x_i)-(\hat{\beta}_0+\hat{\beta}_1\bar{x})]^2$$ $$=\sum^n_{i=1}\hat{\beta}_1^2(x_i-\bar{x})^2 = \hat{\beta}_1^2\sum^n_{i=1}(x_i-\bar{x})^2 =\hat{\beta}_1^2S_{xx}$$

and this result works out just fine. Is there some proof that $\overline{y}=\frac{1}{n}\sum^n_{i=1} y_i=\hat{\beta_0}+\hat{\beta_1}\bar{x}$ ?

In this case, I'm assuming that $\overline{x}=\frac{1}{n}\sum^n_{i=1}x_i$

• Shouldnt $\bar y = \sum y_i /n$? – Just_to_Answer May 17 '17 at 22:01
• Also, it is a property of the least-squares regression line that it goes through the point $(\bar x, \bar y)$. – Just_to_Answer May 17 '17 at 22:03
• It is well known that $\overline{x}= \color{blue}{\frac1n}\cdot \sum\limits^n_{i=1}x_i$ – callculus May 17 '17 at 22:03
• @Malcolm: Sure, one can derive the formulae for $\hat \beta_0$ and $\hat \beta_1$ directly from the minimization of the least-squares (either using calculus or linear-algebra) and get $\hat \beta_0 = \bar y - \hat \beta_1 \bar x$. – Just_to_Answer May 17 '17 at 22:10
• If you look at the derivation of the estimates, the first derivative will give you that the deviation of $y_i$ from the estimated y has average zero. Now use that to take averages on both sides of the equation. – Juanito May 17 '17 at 22:14

For $y_i = \beta_0 + \beta_1x_i +\epsilon_i$, you have that the OLS estimators are $$\hat{\beta_1}= \frac{\sum(y_i - \bar{y})(x_i - \bar{x})}{\sum(x_i - \bar{x})^2}\, ,\qquad \hat{\beta}_0 = \bar{y}- \hat{\beta}_1\bar{x}\, ,$$ hence, if you plugging-in $x_0 = \bar{x}$ in the estimated equation, you'll have that $$\hat{y}(x_0 = \bar{x})=\hat{\beta}_0 + \hat{\beta}_1\bar{x}=\bar{y}- \hat{\beta}_1\bar{x}+ \hat{\beta}_1\bar{x} = \bar{y}.$$