# Linear regression for normal distributions

Basically, I have that $\ Y_i = \alpha +\beta(x_i-x_{bar}) + \epsilon_i$ where $\epsilon_i$ are i.i.d normally distributed with mean 0 variance $\sigma^2$ $\ Y_i ~~has ~a~normal~distribution~as ~follows~; N(\alpha + \beta(x_i-x_{bar}),\sigma^2 )$ Where the $\ x_i$ are just given numbers $\ \alpha^{hat}$ has distribution $\ N(\alpha,\sigma^2/n)$ AND $\beta^{hat}$ has a distribution $\ N(\beta,\sigma^2/\Sigma x_i^2)$

Let Z=AY where A an orthogonal matrix.

Show what $\Sigma (Y_i -\alpha_{hat} -\beta_{hat}(x_i))^2 ~~~{i=1...n} ~~~~= ~~\Sigma Z_i^2 ~~~~{i=3...n}$ and show then that $\Sigma Z_i^2 ~~~~{i=3...n}$ has a chi sqared distribution with n-2 degrees of freedom.

The thing is, I can do this up until the last part, what I dont understand is the degrees of freedom, I can see by showing this equation that $\Sigma Z_i^2 ~~~~{i=3...n}$ is a sum of squared standard normals, namely each of the terms $\ (Y_i -\alpha_{hat} -\beta_{hat}(x_i))^2$ are standard normals, but if the left = the right,. then isnt it the sum of n squared standard normals not n-2?!?!

Really confused by this.

Thanks

That would be the case if you had n independent normals with mean 0 and variance 1 squared. But these normals are not independent because of the common αhat and βhat being in the part subtracted for each Yi. The general rule is that the degrees of freedom - number of observations-number of parameters estimated in your case n observations minus 2 parameters estimated. That is where the n-2 comes from. In the case of a sample mean from n independent normals it is (Xi-Xbar)$^2$ that are summed S$^2$ = ∑(Xi-Xbar)$^2$/(n-1) satisfies (n-1)S$^2$/σ$^2$ is chi-square with n-1 degrees of freedom. Here there is just one parameter estimated, the mean.