POLYMATH Report          REG 
 Multiple linear regression 2016-May-31 
Model: logP = a0 + a1*neginvTK

Variable Value 95% confidence
a0 8.75201 0.542335
a1 2035.33 153.628

R^2   R^2adj   Rmsd   Variance  
0.9915016    0.9904393    0.024644    0.0075916   

Source data points and calculated data points
  neginvTK logP logP calc Delta logP
1 -0.004229 0 0.144139 -0.144139
2 -0.003944 0.69897 0.724674 -0.025704
3 -0.003822 1 0.973179 0.026821
4 -0.003696 1.30103 1.22907 0.071959
5 -0.003562 1.60206 1.50239 0.099671
6 -0.003466 1.77815 1.69836 0.079792
7 -0.003342 2 1.95057 0.04943
8 -0.003171 2.30103 2.29781 0.003217
9 -0.002996 2.60206 2.65364 -0.05158
10 -0.002831 2.88081 2.99028 -0.109467

Problem source text
# S. 28 - Linear Regression
# Pressure Data
# Verified Solution: a0 =8.75201, a1 = 2035.33
# Ref.: Comput. Appl. Eng. Educ. 6: 173, 1998
TC = [-36.7, -19.6, -11.5, -2.6, 7.6, 15.4, 26.1, 42.2, 60.6, 80.1]
P = [1, 5, 10, 20, 40, 60, 100, 200, 400, 760]
logP=log(P)
TK=TC+273.15
neginvTK = -1/TK
mlinfit neginvTK logP

Matlab formatted problem
Create m file called PolyReg.m and paste the following text into it.
% S. 28 - Linear Regression
% Pressure Data
% Verified Solution: a0 =8.75201, a1 = 2035.33
% Ref.: Comput. Appl. Eng. Educ. 6: 173, 1998
function PolyReg
   clc;
   % Known vectors
   TC = [-36.7; -19.6; -11.5; -2.6; 7.6; 15.4; 26.1; 42.2; 60.6; 80.1];
   P = [1; 5; 10; 20; 40; 60; 100; 200; 400; 760];
   % Derived vectors
   logP = log10(P);
   TK = TC + 273.15;
   neginvTK = -1 ./ TK;
   % Evaluate regression coefficients
   X = [neginvTK.^0 neginvTK];
   [beta,bint,~,~,stats] = regress(logP,X);
   fprintf('Regression model: logP = a0 + a1*neginvTK\n');
   disp([' a0 ' num2str(beta(1,1),'%0.5g') ' Conf. interv.= ' num2str(bint(1,2)-beta(1,1),'%0.5g')]);
   disp([' a1 ' num2str(beta(2,1),'%0.5g') ' Conf. interv.= ' num2str(bint(2,2)-beta(2,1),'%0.5g')]);
   disp(' Regression Statistics ');
   disp([' Correlation Coefficient R^2 = ' num2str(stats(1))]);
   disp([' Variance = ' num2str(stats(4))]);
   logP_calc = [neginvTK.^0 neginvTK]*beta;
   % Regression plot
   plot (logP, logP_calc, 'bo');
   xlabel('logP');
   ylabel('logPCalc');
   hold on;
   plot (logP, logP, 'r-');
   hold off;
   % Residuals plot
   figure;
   plot (logP, logP-logP_calc, 'ks');
   xlabel('logP');
   ylabel('logP-logPCalc');
end

General Settings
Number of independent variables = 1
Regression including a free parameter
Number of observations = 10