Why Does Covariance Matrix Change with Different Functions?

Click For Summary
SUMMARY

The discussion centers on the behavior of covariance matrices calculated using the Python package iminuit. When fitting the function x^2 + y^2, the covariance matrix obtained is ((1.0, 0.0), (0.0, 1.0)), indicating independent parameters at the minimum point (0,0). In contrast, the function (x-y)^2 yields a covariance matrix of approximately ((250.25, 249.75), (249.75, 250.25)), reflecting a dependency between the parameters due to the lack of a unique minimum. The key takeaway is that covariance values can exceed 1, while correlation coefficients are constrained between -1 and 1.

PREREQUISITES
  • Understanding of covariance and correlation concepts
  • Familiarity with Python programming
  • Experience using the iminuit package for parameter fitting
  • Basic knowledge of optimization functions in mathematics
NEXT STEPS
  • Explore the iminuit documentation for advanced fitting techniques
  • Learn about the mathematical properties of covariance matrices
  • Study the differences between covariance and correlation
  • Investigate optimization methods for functions with multiple minima
USEFUL FOR

This discussion is beneficial for data scientists, statisticians, and researchers involved in parameter fitting and covariance analysis, particularly those using Python and the iminuit package.

Silviu
Messages
612
Reaction score
11
Hello! I have to calculate the covariance between 2 parameters from a fit function. I found this package in Python called iminuit that did a good fit and also calculate the covariance matrix of the parameters. I tested the package on a simple function and I am not sure I understand the result. When the function I put is x^2+y^2, which has the minimum for x=y=0, I obtain ((1.0, 0.0), (0.0, 1.0)), as a covariance matrix. When I use (x-y)^2 I obtain ((250.24975024975475, 249.75024975025426), (249.75024975025426, 250.24975024975475)), as a covariance matrix. I don't understand why do I get value of covariance greater than 1 and why in the first case I get 0 on the sides and 1 on the main diagonal? It is the first time I encounter covariance so I am not sure I got it right. Thank you!
 
Physics news on Phys.org
The definition of covariance is
862d47a1798266ac335e484532f30dee.gif


If two variable are independent we would expect in the limit of large n that the covariance would be 0. If they are dependent the covariance is not limited to 1.

Perhaps you are thinking of the correlation matrix call it Σ where the diagonal elements ∑II are always 1 and the off diagonal elements are -1 ≤ Σij ≤ 1

Your second function does not have an unique minimum but an infinitely long trough for values x=y.
 
covariance is not limited to 1. Correlation, the ratio of the covariance to the square root of the product of the variances, is limited (in magnitude) to 1.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K