I'm working out some multivariable linear regression equations on paper for a class I'm taking, and I'm getting an erroneous factor of N in my solution according to the class. I'm sure it is my error but I can't figure out where.

Starting with these equations:

$ a = \frac{N\sum(xy)-\sum(x)\sum(y)}{N\sum(x^2)-(\sum(x))^2} $ $ b = \frac{\sum(y)\sum(x^2)-\sum(x)\sum(yx)}{N\sum(x^2)-(\sum(x)^2)}$

And using the identities:

$\bar{x} = \frac{1}{N}\sum(x) $

$\bar{xy} = \frac{1}{N}\sum(xy) $

I'm told that we can simplify the expressions by dividing both numberators and denominators by $N^2$.

They should yield these identities:

$ a = \frac{\bar{xy} - \bar{x}\bar{y}}{\bar{x^2}-\bar{x}^2}$ $ b = \frac{\bar{y}\bar{x^2}-{\bar{x}\bar{xy}}}{\bar{x^2}-\bar{x}^2}$

I'm attempting to simplify as suggested by dividing both the numerator and denominator by $N^2$

$ \frac{\frac{N\sum(xy)-\sum(x)*\sum(y)}{N^2}}{\frac{N\sum(x^2)-(\sum(x)^2)/}{N^2}} $

For $a$ I'm getting an extra factor of $N$ in both the numerator and denominator:

$ a = \frac{N\bar{xy}-\bar{x}\bar{y}}{N\bar{x^2}-\bar{x}^2}$

I haven't yet solved b, because I want to get this first. Can someone please confirm or point out the mistake? I've done it on paper twice and gotten the same answer, and can't tell when I go wrong.

Note: I hope my MathJax accurately portrayed all elements, as I haven't written many complex expressions in MathJax before.

EDIT: To show how I got to this solution, I had the following after dividing by $N^2$:

$ a = \frac{\bar{xy}-\bar{x}\bar{y}\frac{1}{N}}{\bar{x^2}-\bar{x}^2\frac{1}{N}} $

In order to get rid of the factor of $\frac{1}{N}$ on both numerator and denominator, I multiplied numerator and denominator by $N$, which yielded my solution above.

Here are screenshots from the class slides that show where we begin, and what we should yield (in case I misinterpreted something): Begin End

  • $\begingroup$ why you get this expression for a? if you divide $N\sum\limits_{i=1}^N x_iy_i$ by $N^2$ you get $\overline{xy}$, for instance. Similar for $N\sum\limits_{i=1}^N x_i^2$ $\endgroup$ – callculus Jul 5 '18 at 17:18
  • $\begingroup$ @callculus True, which is what I got, but then I end up with an extra factor of $\frac{1}{N}$ on the second term of both the numerator and denominator. In order to get rid of that common factor for the second term of the numerator and denominator, I multiplied both numerator and denominator by $N$, which left me with what I have above. Does that make sense? I'm sorry if it's unclear in my comment. I've edited the question to include that information as well. $\endgroup$ – Hanzy Jul 5 '18 at 17:27
  • $\begingroup$ I´ve posted an answer for $\sum\limits_{i=1}^Nx_i\sum\limits_{i=1}^Ny_i$. I hope it is comprehensible. $\endgroup$ – callculus Jul 5 '18 at 17:35

There is no extra factor. We have $\sum\limits_{i=1}^Nx_i\sum\limits_{i=1}^Ny_i$. Now we divide it by $N$.

$\underbrace{\frac1N\sum\limits_{i=1}^Nx_i}_{=\overline x}\sum\limits_{i=1}^Ny_i$

$\overline x\sum\limits_{i=1}^Ny_i$

Dividing the term by $N$ again

$\overline x\cdot \underbrace{ \frac1N\cdot \sum\limits_{i=1}^Ny_i}_{\overline y}=\overline x \ \overline y$

  • $\begingroup$ Thank you, that is where I made my mistake. I combined the summations which is a no-no. I appreciate the help, you got me back on track. $\endgroup$ – Hanzy Jul 5 '18 at 17:38
  • $\begingroup$ @Hanzy You´re welcome. Nice to here that´s all clear now. $\endgroup$ – callculus Jul 5 '18 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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