When I call RooFitResult::globalCorr for a variable after a fit using SumW2Error, I get a seg fault. I am using version 6.26/04 from the Anaconda distribution; I have only attempted this in pyROOT. Reproducer follows.

import ROOT as r
ws = r.RooWorkspace("workspace")
model = ws.factory("Gaussian::model(x[0, 10], mu[5, 0, 10], sigma[2, 1, 10])")
data = model.generate(r.RooArgSet(ws.var("x")), 10_000)
res = model.fitTo(data, Save=True)
print(res.globalCorr("mu")) # no issue
res = model.fitTo(data, Save=True, SumW2Error=True)
print(res.globalCorr("mu")) # seg fault

While itâ€™s true that there could be a clear error message, Iâ€™m afraid itâ€™s not possible to get a sum-weights-squared-corrected version of the global correlation coefficients with the output that RooFit gets from Minuit.

As explained in the docs, â€śthe corrected covariance matrix is calculated as V_{corr} = VC^{-1}V, where V is the original covariance matrix and C is the inverse of the covariance matrix calculated using the squared weightsâ€ť. So to get a corrected global correlation, you would need the full 2x2 global covariance matrices that relate to each parameter. However, we donâ€™t know the diagonal terms, i.e. some hypothetical â€śglobal covariancesâ€ť.

I guess if you really need these coefficients, you could do some tedious manual procedure outside minuit, but are they absolutely required? As far as I understand, the global correlation coefficients are only used to check fit stability anyway, or am I missing something?

I have some fits where the parameters are often correlated, but itâ€™s not always obvious in advance which parameters are going to have high correlations. When this happens, I wanted to pick which of them to fix (to improve fit stability/convergence) by checking which had the higher global correlation.

If I understand your explanation, you cannot correct the global correlations from MINUIT because they do not comprise a correctable matrix, but couldnâ€™t you just calculate corrected global correlations from the corrected matrix? From page 356 of the original paper, the global correlation coefficients are defined as \rho_k^2 = 1 - [V_{kk} * (V^{-1})_{kk}]^{-1},
so couldnâ€™t you just define the corrected correlation coefficients as (\rho_{corr})_k^2 = 1 - [(V_{corr})_{kk} * (V_{corr}^{-1})_{kk}]^{-1}
? Or does the formula break down in that case?

(In any case, yes, a sensible error would be nice. By the way, it would be nice if the SumW2Error-corrected errors and correlations were printed, not just the uncorrected onesâ€“itâ€™s disorienting that the stored errors differ from the printed ones.)

Thanks for looking up this formula! Then my assumption of how to global correlations are computed were not correct.

So if indeed all you need to calculate them is the correlation matrix for all parameters (not some different correlation matrix after linearly combining the parameter as I thought before), then thatâ€™s certainly something we should implement in RooFit.

Can you open a GitHub issue in ROOT with a feature request on this, linking this forum thread? Then Iâ€™ll remember to implement it in the next days for the next ROOT patch release.