TH2D covariance with error

Hi, experts!
Actually I face some problems when I calculate covariance of TH2D.

I know that we can get error of Mean with GetMeanError.
Is there a way to obtain the error of GetCovariance?

For example, I generate a TH2D with Sumw2 called psi4_psi2, then I calculate:

float covpsi4_psi2 = psi4_psi2->GetCovariance(1,2);

How should I get the errors of the result with this step just like GetMean&GetMeanError?

Thanks in advance!


We don’t have in ROOT such a function to compute the error on the full covariance matrix. You can compute the error only on the standard deviations (diagonal element of your covariance matrix).

I would suggest you to use a bootstrapping method to estimate these uncertainty, it would be probably anyway more reliable, since there are no prior assumption on the data distribution. You would need to generate many different histograms according to what you have in your original one and see the spread you get in the obtained covariance matrix.

Best regards


Hi, Lorenzo

Sorry for the late reply.

As you say, the bootstrapping method is a perfect way to gain errors, I will have a try.

Thanks for your advice.