# Covariance matrix with asymmetric uncertainties

1. Oct 20, 2015

### Daaavde

Hello everyone, I'm currently building the covariance matrix of a large dataset in order to calculate the Chi-Squared. The covariance matrix has this form:

\begin{bmatrix}
\sigma^2_{1, stat} + \sigma^2_{1, syst} & \rho_{12} \sigma_{1,syst} \sigma_{2, syst} & ... \\
\rho_{12} \sigma_{1,syst} \sigma_{2, syst} & \sigma^2_{2, stat} + \sigma^2_{2, syst} & ... \\
... & ... & ...
\end{bmatrix}

However, all my data points have asymmetrix uncertainties ($d^{+ \sigma^+_n}_{- \sigma^-_n}$) where ($\sigma^+_n \neq \sigma^-_n$).
How do I calculate the Chi-Squared in this case?

2. Oct 20, 2015

### Staff: Mentor

If your uncertainties are asymmetric, reducing them to two numbers can be dangerous because you probably don't have a perfect Gaussian distribution of the likelihood towards each side separately. You could use the uncertainty that applies in your case (pick the one for the right direction), but a likelihood-based analysis might be better.

3. Oct 20, 2015

### Daaavde

I thought about picking the uncertainty that applies to the different cases (lower uncertainty if fit lower than data point or viceversa), but the problem is that I'm running the covariance matrix in a minimizer to find the best fit parameters for my test formula.

Currently I'm generating my matrix (500x500) outside the minimizer (the minimizer loop the values of the parameters of my fit formula, so that only the difference vectors need to be recalculated at each iteration), but picking the right uncertainties to use in building the covariance matrix would mean constructing a different covariance matrix at each iteration. Is there a way to avoid that?

I'm interested in the likelihood-based analysis you mentioned, how would it solve the asymmetric uncertainty problem?

4. Oct 20, 2015

### Staff: Mentor

Where do your uncertainties come from and what do you fit how?
Likelihood

5. Nov 1, 2015

### Daaavde

My uncertainties are systematic and statistical uncertainties on datapoints representing the flux of cosmic protons as a function of energy. The systematic uncertainties come from different factors related to the detector, resolution and MC.

I'm currently performing a global fit including different experiments measuring the flux of cosmic protons. In order to do that I'm comparing a formula (GSHL) predicting the flux of cosmic protons with the actual data (their difference is the numerator of my Chi-Squared). The cosmic ray formula depends on four parameters. By minimizing the Chi-Squared (looping through different values of the four parameters) I intend to determine the best fit values for the four parameters and their relative uncertainties.

6. Nov 1, 2015

### Staff: Mentor

The minimizer probably uses this covariance matrix to produce a likelihood estimate, and maximizes this likelihodd (more likely: minimizes the negative logarithm of it). Approaches I see:
- use symmetric uncertainties to get an estimate accurate enough to know which direction your deviation has for each bin, then plug in the correct direction and re-run. Should work if the asymmetries are not too large.
- Figure out if your minimization program allows to calculate the likelihood externally, where you can pick the right direction in every iteration.

The second approach also allows to include more complex uncertainty estimates. The asymmetric errors are problably just an approximation to a more complex likelihood function, and directly using this function would be more accurate.