POLYMATH Report          REG 
 Multiple linear regression 2016-May-31 
Model: HardHeat = a1*Wpc1 + a2*Wpc2 + a3*Wpc3 + a4*Wpc4

Variable Value 95% confidence
a1 2.18918 0.418269
a2 1.15414 0.108233
a3 0.753295 0.360111
a4 0.488545 0.093483

R^2   R^2adj   Rmsd   Variance  
0.9806563    0.9742084    0.5568439    5.822523   

Source data points and calculated data points
  Wpc1 Wpc2 Wpc3 Wpc4 HardHeat HardHeat calc Delta HardHeat
1 7 26 6 60 78.7 79.1642 -0.464242
2 1 29 15 52 74.3 72.3629 1.93712
3 11 56 8 20 104.3 104.51 -0.209802
4 11 31 8 47 87.6 88.8471 -1.24713
5 7 52 6 33 95.9 95.9811 -0.08105
6 11 55 9 22 109.2 105.086 4.11395
7 3 71 17 6 102.7 104.248 -1.54845
8 1 31 22 44 72.5 76.0359 -3.53586
9 2 54 18 22 93.1 91.009 2.09102
10 21 47 4 26 115.9 115.932 -0.032439
11 1 40 23 34 83.8 82.2909 1.50908
12 11 66 9 12 113.3 112.896 0.403907
13 10 68 8 12 109.4 112.262 -2.86189

Problem source text
# S. 31(b) - Multi-Linear Regression via origin
# Heat of Hardening
# Verified Solution: a1 = 2.18918, a2 = 1.15414, a3 = 0.753295 , a4 =0.488545
# Ref.: Comput. Appl. Eng. Educ. 17: 285, 1998
Wpc1 = [7, 1, 11, 11, 7, 11, 3, 1, 2, 21, 1, 11, 10]
Wpc2 = [26, 29, 56, 31, 52, 55, 71, 31, 54, 47, 40, 66, 68]
Wpc3 = [6, 15, 8, 8, 6, 9, 17, 22, 18, 4, 23, 9, 8]
Wpc4 = [60, 52, 20, 47, 33, 22, 6, 44, 22, 26, 34, 12, 12]
HardHeat = [78.7, 74.3, 104.3, 87.6, 95.9, 109.2, 102.7, 72.5, 93.1, 115.9, 83.8, 113.3, 109.4]
mlinfit Wpc1 Wpc2 Wpc3 Wpc4 HardHeat origin

Matlab formatted problem
Create m file called PolyReg.m and paste the following text into it.
% S. 31(b) - Multi-Linear Regression via origin
% Heat of Hardening
% Verified Solution: a1 = 2.18918, a2 = 1.15414, a3 = 0.753295 , a4 =0.488545
% Ref.: Comput. Appl. Eng. Educ. 17: 285, 1998
function PolyReg
   clc;
   % Known vectors
   Wpc1 = [7; 1; 11; 11; 7; 11; 3; 1; 2; 21; 1; 11; 10];
   Wpc2 = [26; 29; 56; 31; 52; 55; 71; 31; 54; 47; 40; 66; 68];
   Wpc3 = [6; 15; 8; 8; 6; 9; 17; 22; 18; 4; 23; 9; 8];
   Wpc4 = [60; 52; 20; 47; 33; 22; 6; 44; 22; 26; 34; 12; 12];
   HardHeat = [78.7; 74.3; 104.3; 87.6; 95.9; 109.2; 102.7; 72.5; 93.1; 115.9; 83.8; 113.3; 109.4];
   % Derived vectors
   % Evaluate regression coefficients
   X = [Wpc1 Wpc2 Wpc3 Wpc4];
   [beta,bint,~,~,stats] = regress(HardHeat,X);
   fprintf('Regression model: HardHeat = a1*Wpc1 + a2*Wpc2 + a3*Wpc3 + a4*Wpc4\n');
   disp([' a1 ' num2str(beta(1,1),'%0.5g') ' Conf. interv.= ' num2str(bint(1,2)-beta(1,1),'%0.5g')]);
   disp([' a2 ' num2str(beta(2,1),'%0.5g') ' Conf. interv.= ' num2str(bint(2,2)-beta(2,1),'%0.5g')]);
   disp([' a3 ' num2str(beta(3,1),'%0.5g') ' Conf. interv.= ' num2str(bint(3,2)-beta(3,1),'%0.5g')]);
   disp([' a4 ' num2str(beta(4,1),'%0.5g') ' Conf. interv.= ' num2str(bint(4,2)-beta(4,1),'%0.5g')]);
   disp(' Regression Statistics ');
   disp([' Correlation Coefficient R^2 = ' num2str(stats(1))]);
   disp([' Variance = ' num2str(stats(4))]);
   HardHeat_calc = [Wpc1 Wpc2 Wpc3 Wpc4]*beta;
   % Regression plot
   plot (HardHeat, HardHeat_calc, 'bo');
   xlabel('HardHeat');
   ylabel('HardHeatCalc');
   hold on;
   plot (HardHeat, HardHeat, 'r-');
   hold off;
   % Residuals plot
   figure;
   plot (HardHeat, HardHeat-HardHeat_calc, 'ks');
   xlabel('HardHeat');
   ylabel('HardHeat-HardHeatCalc');
end

General Settings
Number of independent variables = 4
Regression not including a free parameter
Number of observations = 13