The following data were created from the equation y 54x1 3
The following data were created from the equation y = 5+4x1 - 3x2: Use multiple linear regression to fit this data.
Solution
X=[1 0 0;1 2 1;1 2.5 2;1 1 3; 1 4 6;1 7 2];
Y=[5; 10; 9; 0; 3; 27];
Y
A=XT*X;
A K=(XT*X)ˆ-1;
K B=K*XT*Y;
B M=X*B;
M E=Y-M;
E MaxErr=max(abs(Y-M))
