lmfit

Can lmfit output the correlation matrix as an array?


Can lmfit output a complete correlation matrix as a numpy array?

I know result.covar will output the covariance matrix as an array, and correlation coefficients between all the parameters can be shown with result.fit_report(show_correl=True, min_correl=0).

But I cannot find a way to get an easily formatted array of the correlation matrix.


Solution

  • Well, result.covar is a numpy array, you could format that as you like.

    If you have a recent version of lmfit, you can try:

    result.fit_report(correl_mode='table')
    

    to print out a correlation table. Several of the documented examples use this.