# Deriving Regression Coefficients

1. Nov 17, 2008

### rwinston

Hi

Sorry this may be an obvious one...can anyone help me with getting from the first to the second equation below? I'm particularly stuck with manipulating the terms inside the summations formulas.

I can derive to here:

$$\sum_{i=1}^{N}x_iy_i - N\bar{x}\bar{y} - \left( \sum_{i=1}^{N}x_i^2 - N\bar{x}^2\right)b_2 = 0$$

But am a bit unsure of the exact manipulation to get to here:

$$b_2 = \frac{\sum_{i=1}^{N}(x_i-y_i)(y_i-\bar{y})}{\sum_{i=1}^{N}(x_i-\bar{x})^2}$$

2. Nov 17, 2008

### D H

Staff Emeritus
You already know the standard representation for the regression on the slope (its your second expresssion in the original post). So try to work backwards to show that this latter expression is identical to the expression you can derive. Reversing this will then generate the path from the expression you can derive to the standard representation.

3. Nov 17, 2008

### rwinston

Ah, yes...sorry, a bit obvious really when you think about it:

$$\sum_{i=1}^{N}x_i^2 -N\bar{x}^2$$
$$= \sum_{i=1}^{N}x_i^2 -\sum_{i=1}^N\bar{x}^2$$
$$\sum_{i=1}^{N}\left( x_i - \bar{x}\right)^2$$

And the other bit:

$$\sum_{i=1}^{N}x_iy_i - N\bar{x}\bar{y} = \sum_{i=1}^{N}(x_i-\bar{x})(y_i-\bar{y})$$

as

$$\sum_{i=1}^{N}(x_i-\bar{x})(y_i-\bar{y}) = \sum_{i=1}^{N}x_iy_i - N\bar{x}\bar{y}-N\bar{y}\bar{x}-N\bar{x}\bar{y}$$