How to obtain a P-Value from a Python Scipy Optimize Least Squares regression?

95 Views Asked by At

I have performed a function minimization using Python scipy.optimize.least_squares.

The function minimized is a chi-squared function.

solution = scipy.optimize.least_squares(optimize_function, x0, method='lm', \
        ftol=1.0e-8, xtol=1.0e-8, \
        max_nfev=1000000, args=(bin_midpoints, hist_data))

The residuals can be obtianed via solution.fun. Calculating the chi-squared value using the residuals leads to the same result as

2.0 * solution.cost

As a next step, I am trying to calculate a P-Value from this chi-square value.

In similar libraries which I have used previously, the "p-value" is typically provided somewhere in the output.

Looking at the docs, I don't see anything obvious which might be a P-Value in the value returned by least_squares.

Do I have to calculate it manually, perhaps using some other Python library?

0

There are 0 best solutions below