Covariance in fitting function

In summary, the conversation discusses the calculation of covariance using a Python package called iminuit. The speaker is confused about the result they obtained for two different functions and is seeking clarification on the concept of covariance. They also mention the difference between covariance and correlation, stating that correlation is limited to 1 in magnitude.
  • #1
Silviu
624
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
  • #2
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.
 
  • #3
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.
 

1. What is covariance in fitting function?

Covariance in fitting function refers to the measure of the association between two variables in a regression model. It shows how changes in one variable are related to changes in another variable.

2. How is covariance calculated in fitting function?

Covariance is calculated by taking the sum of the product of the differences between each data point and the mean of the two variables. It is then divided by the total number of data points.

3. What does a positive covariance value indicate?

A positive covariance value indicates a positive relationship between the two variables. This means that as one variable increases, the other variable also tends to increase.

4. What does a negative covariance value indicate?

A negative covariance value indicates a negative relationship between the two variables. This means that as one variable increases, the other variable tends to decrease.

5. How is covariance used in fitting function to evaluate model performance?

Covariance is used in fitting function to evaluate model performance by calculating the correlation coefficient, which is a standardized measure of covariance. A higher correlation coefficient indicates a stronger relationship between the variables and a better fit for the model.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
801
  • Set Theory, Logic, Probability, Statistics
Replies
14
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
13
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
908
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
658
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
721
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
1K
Back
Top