# Thread: Multiple linear regression calculation

1. ## Multiple linear regression calculation

Hi All,

My first post so please be gentle .

I am trying to calculate a multiple linear regression, without using the Excel functions I normally rely on (LINEST).

I have the math equation to calculate slope and intercept, so I can forecast for Y using Y=a+bx, where a is the intercept and b is the slope.

I would like to produce the same forecast of Y, but using two variables for x. I'm not sure how to change the equation to include another x.

Then I think I could use the output to calculate Y using both sets of X values like below?

Y = a + b1*X1 + b2*X2

......Ok, shoot me down now

2. You've a lot of self-esteem trouble, there. That's the only point where I'll pick on you. Just go ahead and ask. Proceed without fear.

What do you know of "Normal Equations"?

$a\cdot n + b_{1}\sum x_{1} + b_{2}\sum x_{2} = \sum y$

$a\sum x_{1} + b_{1}\sum x_{1}\cdot x_{1} + b_{2}\sum x_{1}\cdot x_{2} = \sum x_{1} \cdot y$

$a\sum x_{2} + b_{1}\sum x_{2}\cdot x_{1} + b_{2}\sum x_{2}\cdot x_{2} = \sum x_{2}\cdot y$

'n' is the number of observations. This entirely defines what you need from a given set of points.

Note: Eliminate everything with $x_{2}$ and see the one variable version emerge before your eyes.

3. I haven't really trained in Math very much, but really need to. I did a statistics course, but it wasn't very taxing. So I can't read math equations too well, but understand solutions when written in sentances .

I think my first question is with a.

In the equation above, is my intercept calculated using X1? So..

a = avg(y) - ((n * sum(x1*y)) - (sum(x1)*sum(y)))/
((n * sum(x1)^2)-(sum(x1)^2) * avg(x)

4. No. 'a' is found along with 'b' and 'c' by solving the system of equations. You do need to have some background in that sort of thing. Or, youcan get your calculator to do it.

5. I'd like to learn the whole system of equations around solving this.

Is there a good online resource in order to teach myself?

6. The Normal Equations come from some Calculus, usually sub-titled Numerical Methods. The solution to a system of equations is the stuff of Algebra I or Algebra II. You should be able to find that anywhere.