REGRESSION LINES > Scilab
Applied Mathematics
REGRESSION LINES > Scilab
Y=[19 22 24 27 29 33 37]
Sx=0;Sy=0;Sx2=0;Sy2=0;Sxy=0;byx=0;bxy=0;Mx=0;My=0;
for(i=1:7)
Sx=Sx+X(i);
Sy=Sy+Y(i);
Sx2=Sx2+X(i)*X(i);
Sy2=Sy2+Y(i)*Y(i);
Sxy=Sxy+X(i)*Y(i);
end
Sx
Sy
Sxy
Sx2
Sy2
Mx=Sx/7;
My=Sy/7;
byx=(Sxy-7*Mx*My)/(Sx2-7*Mx*Mx)
bxy=(Sxy-7*Mx*My)/(Sy2-7*My*My)
a=0;b=0;
b=byx;
a=My-byx*Mx;
c=[a b];
Y=poly(c,"X","coeff")
d=0;e=0;
e=bxy;
d=Mx-bxy*My;
h=[d e];
X=poly(h,"Y","coeff")
/* OUTPUT;
X =
10. 12. 13. 16. 17. 20. 25.
Y =
19. 22. 24. 27. 29. 33. 37.
Sx =
113.
Sy =
191.
Sxy =
3276.
Sx2 =
1983.
Sy2 =
5449.
byx =
1.2131295
bxy =
0.8116727
Y =
7.7023381 + 1.2131295X
X =
- 6.0042118 + 0.8116727Y
*/
Comments
Post a Comment