Weighted regression without priority zone, but with finding the minimum possible value for all the differences

33 vues (au cours des 30 derniers jours)
Boyan
Boyan le 16 Déc 2024 à 22:54
Modifié(e) : Torsten il y a environ 11 heures
Dear colleagues,
I need to perform a regression. The input data is shown in Figure 1 and is also attached as an MS Excel file.
Figure 1 (Figures are shown in the end of the letter.
The equation is z = a*x^m/(y+c)^n.
The parameters of the fit are shown in Figure 2 and are also attached.
Figure 2
The output data is shown in Figure 3.
Figure 3
The individual differences in percentage are shown in Figure 4.
Figure 4
I know that by using a weighted matrix, it is possible to decrease some differences (priority zones) at the expense of increasing others. However, in this case, my goal is to estimate the minimal possible error (one border value) for all of the values. For example, in the first fit, the maximum difference is 93%. It is easy to decrease it by applying individual weight coefficients, but of course, somewhere, the difference will increase. Therefore, the question is: what method can be used to find the minimal possible difference? If this for example is 18%, it means that everywhere the difference will be smaller, and it is likely that there is no 0 % anymore. Example by hand (not real) is given in Figure 5.
Figure 5
And if we try to decrease the difference at the point with an 18% difference, this will lead to an increase in the difference somewhere above 18%. Also, if in the first fit I have a 0% or 1% difference at a given point, in the second fit, the difference at this point is likely to be close (but smaller) to 18%. And one more thing if there is a way for doing the whole procedure, is it possible to use curve fitter app or need to use a code?

Réponses (2)

Torsten
Torsten le 16 Déc 2024 à 23:54
Déplacé(e) : Torsten le 16 Déc 2024 à 23:54
Use "fminimax". It minimizes the maximum error and is the nonlinear equivalent to minimizing the Inf-norm in linear regression problems.

Torsten
Torsten il y a environ 8 heures
Modifié(e) : Torsten il y a environ 8 heures
x = [1 2 3 4 5 10 20 50].';
y = [5 10 15 20 25 30 40 50 60 90];
z = [265.110074796797 195.008035083193 156.258229529605 129.742584500194 107.062285017337 91.0540850617739 68.5080545479447 50.5038878827341 35.8057303140135 23.9109370743307
321.446939682946 249.023136173216 204.538587797874 172.392832029864 146.102087493907 125.302681110766 98.3496300763363 79.6443293949692 60.4259292015808 28.967085981117
358.948929784307 282.185871826562 232.988776882345 197.578293515688 169.230643083598 145.977264293244 115.850743148756 96.2843426347109 74.9936831153838 40.5561051536658
387.580526618466 306.229191510467 253.083199667196 215.390669679886 185.62217968629 160.805889976744 128.174360996678 107.804496871799 85.3098905504615 48.5261569465696
411.022720927616 325.178097515035 268.617658401558 229.174534346536 198.325915732664 172.4000748844 137.680141245939 116.580164412001 93.3004757115783 54.5677932289588
491.330306710826 385.749717456981 316.583948069254 271.810779459274 237.728742469111 208.93517622606 166.914170433146 142.97295566989 118.058749869664 72.5800929043424
584.345341008974 448.998217493589 364.117335543095 314.175511964579 277.043092535072 246.270752777746 195.70913612502 168.102854357484 142.722367271741 89.5041059266947
730.266495461484 536.918175592217 426.295310861942 369.764885508864 328.878387857907 296.884055308305 233.111367401215 199.486893792689 175.18124008861 110.317421963392];
f = @(p) abs(p(1)*x.^p(2)./(y+p(3)).^p(4) - z);
F = @(p) reshape(f(p),[],1);
p0 = [1 1 1 1];
F(p0)
ans = 80×1
264.9434 321.1136 358.4489 386.9139 410.1894 489.6636 581.0120 721.9332 194.9171 248.8413
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
max(F(p0))
ans = 721.9332
format long
[p,fval] = fminimax(F,p0)
Local minimum possible. Constraints satisfied. fminimax stopped because the size of the current search direction is less than twice the value of the step size tolerance and constraints are satisfied to within the value of the constraint tolerance.
p = 1×4
1.0e+04 * 1.012399111966462 0.000025177933233 0.001641135844188 0.000118976592444
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
fval = 80×1
0.749551595760067 6.679548910905453 10.350141109652270 12.794953138220137 14.577849760131755 19.293422491732827 22.302958149803658 22.382430607261313 10.938069716167234 3.808316417156561
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
max(fval)
ans =
22.382430608024322

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by