pastas.solver.LeastSquares.get_covariances#

static LeastSquares.get_covariances(jacobian, cost, method='trf', absolute_sigma=False)[source]#

Method to get the covariance matrix from the jacobian.

Parameters
  • jacobian (ArrayLike) – The jacobian matrix with dimensions nobs, npar.

  • cost (float) – The cost value of the scipy.optimize.OptimizeResult which is half the sum of squares. That’s why the cost is multiplied by a factor of two internally to get the sum of squares.

  • method (Literal["trf", "dogbox", "lm"], optional) – Algorithm with which the minimization is performed. Default is “trf”.

  • absolute_sigma (bool, optional) – If True, sigma is used in an absolute sense and the estimated parameter covariance pcov reflects these absolute values. If False (default), only the relative magnitudes of the sigma values matter. The returned parameter covariance matrix pcov is based on scaling sigma by a constant factor. This constant is set by demanding that the reduced chisq for the optimal parameters popt when using the scaled sigma equals unity. In other words, sigma is scaled to match the sample variance of the residuals after the fit. Default is False. Mathematically, pcov(absolute_sigma=False) = pcov(absolute_sigma=True) * chisq(popt)/(M-N)

Returns

pcov – numpy array with the covariance matrix.

Return type

array_like

Notes

This method is copied from Scipy: scipy/scipy Please refer to the SciPy optimization module:: https://docs.scipy.org/doc/scipy/reference/optimize.html