0

I am using scipy.minimize for non-linear regression to estimate the vector x by minimising the function

enter image description here

where a, b, c are constants and we have n pairs of (t, y) observations. Below are some test results:

x0 = [2000.0, 0.0, 0.1]
res = scipy.optimize.minimize(my_func, x0)
print(res.x, res.fun)
[ 2.00016543e+03 -5.95934615e+00  8.52615660e-02] 1.8537556040946759

x0 = [4000.0, 0.0, 0.1]
res = scipy.optimize.minimize(my_func, x0)
print(res.x, res.fun)
[ 4.00001292e+03 -3.96950262e+00  1.70509802e-01] 1.8537556026712332

As the above output shows, the residual error is the same in both cases. I think this means that the first and second variable are correlated. Is it possible to estimate the degree of correlation from the OptimizeResult object that scipy.minimize returns?

In principle, it should be possible to do this using the optimize.curve_fit function but this does not accept the args keyword (eg. see here), which I am using the pass in the values of a, b, c

PetGriffin
  • 495
  • 1
  • 4
  • 13
  • What does your function look like? All this seems to be saying is that the minima of the function occur at the same `y` value, similar to how all the minima of `sin(x)` occur at y = -1. As for the correlation, they're related because they're both minima of the same function. – jared Aug 24 '23 at 15:23
  • Hi @Jared. I have added the equation to be minimised. I take your point about the `sin(x)` example but I am not getting the same minima - I (think) I am getting values that are correlated – PetGriffin Aug 29 '23 at 08:49

0 Answers0