I am using scipy.minimize
for non-linear regression to estimate the vector x
by minimising the function
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