# OLS estimator panel data

I need to show that the residuals from the regression of $x_{it} - \bar x_i$ on a constant and $\bar x_i$ is just $x_{it} - \bar x_i$ itself.

By stnadard OLS regression results, in the simple regression

$$y_t = \alpha + \beta z_t + v_t, \;\;\;t=1,...,T$$

we have that

$$\hat \beta = \frac {\sum_{i=1}^T (z_t - \bar z)(y_t-\bar y)}{\sum_{i=1}^T (z_t - \bar z)^2}$$

and

$$\hat \alpha = \bar y - \hat \beta \bar z$$

So the residuals are

$$\hat v_t = y_t -(\hat \alpha +\hat \beta z_t)$$

Then, substitute for your particular $y_t$ and $z_t$ in all the above.

However, since my $z_t$ is $\bar x_i$ ($x_{it}$ averaged over time), what is the value of the average of $\bar x_i$ i.e $\bar z$. Do I average over time again? (in which case the average would be itself). Or do i average over individuals i? (so that the average of $\bar x_i$ is $\bar x$?) I need this for the numerator of $\hat \beta$