Straight, with weight

Storyboard

>Model

ID:(1197, 0)



Straight line

Equation

>Top, >Model


To fit data (x_i, y_i) to a line of the type

y = ax + b

the values a and b must be calculated such that the difference of the squares

$\sum_i w_i(y_i-ax_i-b)^2 = min$

be a minimum, where w_i is the weighting of the i coordinates.

ID:(9438, 0)



Slope

Equation

>Top, >Model


If it is derived

$\sum_i w_i(y_i-ax_i-b)^2 = min$



with respect to a and the result is equal to zero the equation is obtained:

S_{xy}+aS_{xx}+bS_x=0

where

S_x=\sum_iw_ix_i, S_{xx}=\sum_iw_ix_i^2, S_{xy}=\sum_iw_ix_iy_i and S_N=\sum_iw_i

If the operation is repeated for b the equation is obtained:

bS_N-S_y+aS_x=0

with S_y=\sum_iw_iy_i.

The solution of the equations leads to the slope being

$ a =\displaystyle\frac{ S_N S_{xy} - S_x S_y }{ S_N S_{x2} - S_x ^2}$

ID:(9439, 0)



Constant

Equation

>Top, >Model


If it is derived

$\sum_i w_i(y_i-ax_i-b)^2 = min$



with respect to a and the result is equal to zero the equation is obtained:

S_{xy}+aS_{x2}+bS_x=0

where

S_{x,n,y,m}=\sum_iw_ix_i^ny_i^m

that in the case that n or m are zero the factor x or y is not written and in the case of the unit the number is not included.

If the operation is repeated for b the equation is obtained:

bS_N-S_y+aS_x=0

The solution of the equations leads to the constant b being

$ b =\displaystyle\frac{ S_{x2} S_y - S_x S_{xy} }{ S_N S_{x2} - S_x ^2}$

ID:(9440, 0)



Deviation

Equation

>Top, >Model


The regression is calculated based on which

$\sum_i w_i(y_i-ax_i-b)^2 = min$



be a minimum. If the square is developed and the root of this value is divided by the mean value, a measure of the mean deviation of the regression is obtained:

$\epsilon=\displaystyle\frac{S_{y2}+a^2S_{x2}+b^2S_N+2abS_x-2aS_{xy}-2bS_y}{S_x}$

ID:(9442, 0)