POLYMATH Report          REG 
 Nonlinear Regression (L-M) 2016-May-31 
Model: logP = A-B/(C+TC)

Variable Initial guess Value 95% confidence
A 8.752 5.76735 0.152084
B 2035 677.094 48.1591
C 273 153.885 5.68709

R^2   R^2adj   Rmsd   Variance  
0.9996879    0.9995987    0.0047228    0.0003186   

Source data points and calculated data points
  TC logP logP calc Delta logP
1 -36.7 0 -0.010627 0.010627
2 -19.6 0.69897 0.725144 -0.026174
3 -11.5 1 1.01198 -0.011984
4 -2.6 1.30103 1.29174 0.009291
5 7.6 1.60206 1.57443 0.027626
6 15.4 1.77815 1.76763 0.010524
7 26.1 2 2.00541 -0.005407
8 42.2 2.30103 2.31429 -0.013259
9 60.6 2.60206 2.61052 -0.008456
10 80.1 2.88081 2.8736 0.007212

Problem source text
# S. 29* - Nonlinear Regression
# Pressure Data
# Verified Solution: A =5.76735, B = 677.094, C= 153.885
# 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)
nlinfit logP=A-B/(C+TC)
m(A)= 8.752
m(B)= 2035
m(C)=273

Matlab formatted problem
Create m file called PolyNlR.m and paste the following text into it.
% S. 29* - Nonlinear Regression
% Pressure Data
% Verified Solution: A =5.76735, B = 677.094, C= 153.885
% Ref.: Comput. Appl. Eng. Educ. 6: 173, 1998
function PolyNLR
   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);
   % Evaluate regression coefficients
   X = [TC];
   n = 10;
   Beta0 = [8.752 2035 273]; % initial guess vector
   [BetaOpt,resid,J,sigma,mse] = nlinfit(X, logP, @NLRfun, Beta0);
   ci = nlparci(BetaOpt,resid,'jacobian',J);
   logP_Calc = NLRfun(BetaOpt, X);
   fprintf('\nNonlinear Regression model parameters solution\n');
   fprintf('\nRegression model: logP=A-B/(C+TC)\n');
   disp([' A = ' num2str(BetaOpt(1),'%0.5g') ' Conf. interv. = ' num2str(ci(1,2)-BetaOpt(1),'%0.5g')]);
   disp([' B = ' num2str(BetaOpt(2),'%0.5g') ' Conf. interv. = ' num2str(ci(2,2)-BetaOpt(2),'%0.5g')]);
   disp([' C = ' num2str(BetaOpt(3),'%0.5g') ' Conf. interv. = ' num2str(ci(3,2)-BetaOpt(3),'%0.5g')]);
   disp(' Regression Statistics ');
   disp([' Variance = ' num2str(mse)]);
   % Regression plot
   plot (logP, logP_Calc, 'bo');
   xlabel('logP');
   ylabel('logP_Calc');
   hold on;
   plot (logP, logP, 'r-');
   hold off;
   % Residuals plot
   figure;
   plot (logP, logP-logP_Calc, 'ks');
   xlabel('logP');
   ylabel('logP-logPCalc');
end

function logP = NLRfun(beta, X)
   A = beta(1);
   B = beta(2);
   C = beta(3);
   TC = X(:,1);
   logP=A-B./(C+TC);
end

General Settings
Sample size 10
Model vars 3
Indep vars 1
Iterations 24
Max iterations 100