Write down the normal eq for estmiating the constant A and B

• Dec 4th 2009, 09:36 PM
zorro
Write down the normal eq for estmiating the constant A and B
Question :

Write down the normal equations for estimating the constant A and B in the least-square fit of the model

$\displaystyle y = A + Bx,$

using n data points i.e. $\displaystyle (x,y),(x_2,y_2),.....,(x_n,y_n).$
• Dec 4th 2009, 09:38 PM
matheagle
take the sum of squares and differentiate wrt A and B.
• Dec 13th 2009, 03:45 PM
zorro
Is this correct?
Quote:

Originally Posted by matheagle
take the sum of squares and differentiate wrt A and B.

$\displaystyle y \ = \ A + Bx$

$\displaystyle q \ = \ \sum_{i} [y - (A+Bx)]^2$

Differentiating partuall wrt to A and B weget

$\displaystyle \frac{\partial q}{\partial A} \ = \ (-2)[y_i -(A + Bx_i)] \ = \ 0$

and
$\displaystyle \frac{\partial q}{\partial B} \ = \ (-2) x_i[y_i -(A + Bx_i)] \ = \ 0$

normal equation is

$\displaystyle \sum_{i} y_i \ = \ An + B \sum_{i} x_i$

$\displaystyle \sum_{i} x_i y_i \ = A \sum_{i} x_i + B \sum_{i} x_i ^2$

Is this correct??
• Dec 13th 2009, 05:21 PM
matheagle
Impressive, we got you to do some decent work.
The normal equations look good,
but you left out the sums in the partial derivatives
in the previous set of equations.
• Dec 13th 2009, 05:24 PM
matheagle

Quote:

Originally Posted by zorro

$\displaystyle y_i \ = \ A + Bx_i$

$\displaystyle q \ = \ \sum_{i} [y_i - (A+Bx_i)]^2$

Differentiating wrt to A and B we get

$\displaystyle \frac{\partial q}{\partial A} \ = \ (-2)\sum_i[y_i -(A + Bx_i)] \ = \ 0$

and
$\displaystyle \frac{\partial q}{\partial B} \ = \ (-2)\sum_i x_i[y_i -(A + Bx_i)] \ = \ 0$

the normal equations are

$\displaystyle \sum_{i} y_i \ = \ An + B \sum_{i} x_i$

$\displaystyle \sum_{i} x_i y_i \ = A \sum_{i} x_i + B \sum_{i} x_i ^2$