Correlation factor

I don’t talk english very well yet but i hope you can help me anyway.
I want to know how does the root calculate the correlation factor between two variables using GetCorrelationFactor(). Actually i want to know if the factor depends on the binning that I’m using in the Histo that allocate my two variables. Does anybody know?

The histogram itself does not store the individual values, it only stores the bin counts. If you use a TH2::GetCorrelationFactor method, then it must be calculating it from the binned data, and thus depends on the binning. You could try it with different binnings to see if it changes.

You can read the actual code here: (and for the GetCovariance method just below, which is used for the actual computation). As you can see, it uses the stored sum of weights and sum of squared weights.

If you want the correlation factor for unbinned data, a way to do it is to use a TGraph and use the GetCorrelationFactor method there. The TGraph does not bin data, and you can see the code ( needs to loop over the individual data points.