1

I have tried to use the method of deepest descent to find the $4$ parameter variables $v_1, \ldots, v_4$ of a chosen function $y(x,v_1,v_2,v_3,v_4)$ that most closely matches the $y$-values in the table below.

The best fit values of the variables, I could find, are shown to the right of the table.

They give a least squares error of $1.2264$ and the plot below the table shows an almost perfect fit.

Below this plot, I have given all the details of my method but I know there are many more sophisticated methods, which I, however don’t fully understand.

I would therefore appreciate if someone could find a better set of parameters using the same function and some first order method.

Also please explain the algorithm using “old time” math notation, so I am not interested in MatLab or Maple-like answers, since their methods are probably not fully explained

I should add, that my method seems to get stuck at many local minima so, while observing the resulting plot, I frequently had to adjust the variables to get more close to the most probable global minimum.

Here is the table and my “best fit” variables:

enter image description here

and here is the “best fit” plot obtained:

enter image description here

Here are all the details:

enter image description here

Théophile
  • 24,627
Jens
  • 245
  • 2
    Is there a reason (from the situation you're modeling) to look for a function of the form (quadratic)*(sine)? – Ethan Bolker Jun 13 '17 at 14:36
  • I tried some other approximating functions like a trigonometric series and polynomial series, but the one chosen seems to give the best fit because even y=v1sin(v2x) comes rather close.. – Jens Jun 13 '17 at 15:02
  • Would not a simple parabola $ y= a x (b-x) $ not give the same accuracy? – Narasimham Jun 14 '17 at 08:07
  • Narasimham: Not quite. I tried with (a-bx)x and with a=116.4040 and b=39.1052 my best sum of sq errors was 3,1242. With a third order polynomial my best was 0.8998, which of course is better than my original result - as JJacquelin has pointed out. I guess using as few parameters as possible is advisable for problems like this. – Jens Jun 14 '17 at 23:28
  • JJacquelin: As an example of the sensitivity even when using parameters very close to yours, namely v1 =109,2320, v2 =-10,1920, v3 =-32,9634, v4 = 11,2772 I get a sum of sq errors = 0.0538 and my method gets stuck at this "local mimimum" which is rather "far" from your optimum of 0.019044.. – Jens Jun 14 '17 at 23:53

2 Answers2

3

It is surprising that you chose such a complicated function and method since a simple polynomial function leads to much better fit.

See below the comparison, both with four adjustable parameters :

enter image description here

Even with a simple three parameters polynomial the fitting is better than with the mixed polynomial and sin function.

Note: Your method of non-linear fitting isn't very good : Again with the function $y=(v_1+v_2x+v_3x^2)\sin(v_4x)$ and with $v_1=119.416327$ ; $v_2=-25.023188$ ; $v_3=1.82441$ ; $v_4=0.939$ the sum of square errors is $0.3829$ , lower than what you found (but still higher than with the simple polynomial).

JJacquelin
  • 66,221
  • 3
  • 37
  • 87
0

I post this as an answer because it is to long to fit in a comment! JJacuelin: Congratulations for your best fit parameters giving 0.3829 for the sum of the squared errors. Actually inputting your parameters for v1,..,v4 to my model gives me a teeny bit better 0,3828. You are right, of course, that my model could be a lot better as you might remember I said I had to do a lot of manuel fiddling to get close to the global minimum and avoid getting stuck in what seemed to be many local minima. So exactly what method did you use? Or was it some standard math tool. I might add, that I did the calculations using VBA in Excel (double precision) where I also tried the Solver add-in. However, no matter which start parameters I used, Solver never came even close to a good curve fit. As to your polynomial of order 4 my model gives 0.019015 with your parameters, so my method gives accurate enough results but my problem of finding close enough start parameters remains and really bugs me. So again, exactly how do you overcome this? Anyway, thanks for your answer and your effort.

Jens
  • 245