# Fit convergence to degenerated model - a reasonable expectation?

5 views (last 30 days)
Dev-iL on 3 Dec 2017
Answered: Alex Sha on 23 May 2019
Hello everybody, the question below is partly about the curve-fitting tool and partly about the underlying math.
I have some data points,
T = [348.2 367.4 388.75 419.15 438.15 470.15 487.15 494.15 533.15 588.15 603.15 624.55 642.15 661.05 681.15 700.15 708.85 721.15 741.75 748.35 761.35 772.15 780.75 790.15 802.15 818.15 833.15 845.15 853.15 863.15 873.15 883.15 893.15 902.15 911.15 920.15 929.15 938.25 947.15 956.15 965.15 973.15 982.15 990.15];
f = [0.1905 0.333 0.548 1.1626 1.7365 3.1503 4.2138 4.6658 8.4963 16.3791 19.4393 24.3558 29.5737 35.3792 42.7266 50.2862 54.3216 59.7418 70.008 73.3439 80.7682 86.9614 92.2943 98.4525 106.8639 118.2043 129.6035 138.2385 145.5816 154.5974 163.8659 173.1084 183.1867 191.9041 201.6717 210.7972 220.9118 231.1729 241.8989 252.9048 263.6184 274.1358 285.7413 296.3388]
and I'm trying to fit them with these two (4- or 5- parameter) models:
f1(T) = A/( exp(B1/T + B2/T^2 ) + C )
f2(T) = A/( exp(B1/T + B2/T^2 + B3/T^3) + C )
It's easy to see that f2 is a generalization of f1.
Observation: When I perform fitting using cftool (Robust: bisquare; Alg: Trust region; Diff/TolFun/TolX: 1E-10; Max eval/iter: 60000), I am getting the peculiar result that f1 is better (that is, having lower SSE & RMSE) than f2.
Explanation: The reason I find this peculiar is because the initial guess for f2 is the converged fit of f1 with the extra parameter B3 set to 0. Thus, when fitting f2, I expect the solver to "notice" that changing the value of B3 to anything other than zero hurts the quality of the result (if this is indeed the case), and simply remain at the initial guess. However, while the fit for f2 should be "at least as good" - it doesn't happen in practice (instead, it converges to other coefficient values, having a higher error). Moreover, if I set the lower and upper boundaries of B3 to 0, it still manages to "escape" the initial guess onto a less successful solution.
Questions:
1. Why does the above happen? Is this something related to the way the error is computed? Is this related to overfitting? Local minima?
2. How should I set up the problem such that the parameters of f2 converge to f1 if indeed any nonzero B3 makes it worse?
Thanks!

Alex Sha on 7 May 2019
Hi, I think you may make wrong calculation:
with function of "f1(T) = A/( exp(B1/T + B2/T^2 ) + C )", the result is:
Root of Mean Square Error (RMSE): 0.248155788155927
Sum of Squared Residual: 2.70957698859274
Correlation Coef. (R): 0.999996457656765
R-Square: 0.999992915326078
Parameter Best Estimate
---------- -------------
a 16792.5295999214
b1 4141.28742789656
b2 -41038.8514725114
c -6.21563923045511
while, with function of "f2(T) = A/( exp(B1/T + B2/T^2 + B3/T^3) + C )", the result is:
Root of Mean Square Error (RMSE): 0.245657084699531
Sum of Squared Residual: 2.65528574357518
Correlation Coef. (R): 0.999996519478013
R-Square: 0.99999303896814
Parameter Best Estimate
---------- -------------
a 8418.50828336496
b1 2905.68377087421
b2 709013.025922705
b3 -153078473.919681
c -4.73510445471908
Observiously, the result of f2 is better than f1

#### 1 Comment

Dev-iL on 7 May 2019
Hi Alex,
Which settings did you run it with, and on which MATLAB version?
I can tell you that each of these fits may converge to very different solutions. For example, below are two solutions that have smaller errors (SSE) than what you showed - and f1 is better than f2.
General model:
f(T) = A/( exp(B1/T + B2/T^2 ) + C )
Coefficients (with 95% confidence bounds):
A = 1.701e+04 (1.317e+04, 2.085e+04)
B1 = 4154 (3859, 4450)
B2 = -4.427e+04 (-1.429e+05, 5.442e+04)
C = -6.076 (-6.604, -5.548)
Goodness of fit:
SSE: 2.022
R-square: 1
RMSE: 0.2248
General model:
f(T) = A/( exp(B1/T + B2/T^2 + B3/T^3) + C )
Coefficients (with 95% confidence bounds):
A = 1.688e+04 (2622, 3.114e+04)
B1 = 4144 (2639, 5648)
B2 = -4.079e+04 (-9.539e+05, 8.723e+05)
B3 = 1.556e+04 (-1.881e+08, 1.881e+08)
C = -6.089 (-7.605, -4.574)
Goodness of fit:
SSE: 2.124
R-square: 1
RMSE: 0.2334

Alex Sha on 23 May 2019
Hi，Dev-iL，theoretically，the SSE of f2 should be less or equal to that of f1, since f1 is the special case of f2, when b3=0.
Also, it is strange what you got "fits may converge to very different solutions", since the results are stable and unique for both f1 and f2. For the case of f1, with your results of "A=1.701e+04, b1=4154, b2=-4.427e+04, C=-6.076", the SSE is 2.84699136973883.
For f2, we run agaig, the best result is (Stable and Unique):
Root of Mean Square Error (RMSE): 0.236331304041253
Sum of Squared Residual: 2.45750935187292
Correlation Coef. (R): 0.999996779502433
R-Square: 0.999993559015237
Determination Coef. (DC): 0.999993557341077
Chi-Square: 0.128214551901706
F-Statistic: 1513246.03206596
Parameter Best Estimate
---------- -------------
a 38.0631762817717
b1 -5180.63352850777
b2 4799854.01547768
b3 -846830038.919179
c -0.170189492401714