# Creating NxN Correlation Matrix for Two Dist. w/ N Bins

Hi –

I have two different TH1D’s (one is a kinematic dist. before unfolding, and the other is the kinematic dist. after unfolding). I need to create a 2D correlation matrix where each cell has a value rho_(x_i)(y_j) where (x_i) indexes a bin of the first dist. and (y_j) indexes a bin of the second dist. (Rho_(x_i)(y_j) is the linear/Pearson correlation coefficient for the two variables (x_i) and (y_j).) Note that these two kinematic distributions do not correspond to only two variables. If there are N bins in both the first and second distributions, my matrix would be NxN. Any bin in either histogram is governed latently by an underlying Poisson distribution where the mean parameter can be thought of as the number of counts in said bin. (The statistics in a histogram bin can be thought of as Poissonian.) The corresponding standard deviation would be the square root of that count value, under basic circumstances.

So you see that for bin (x_i) in the first dist. and bin (y_j) in the second distribution I do not have a full Poisson that represents both, I only have the number of counts in each of these bins. Since I know the underlying distribution as well as the errors on bins (x_i) and (y_j), however, I should be able to calculate a correlation coefficient between these two variables. This would be the value of rho_(x_i)(y_j) in the correlation matrix I’m trying to compute.

Now the TH2::GetCovariance method:
https://root.cern.ch/doc/master/TH2_8cxx_source.html#l01043
requires a complete set of values (i.e. a distribution) for each of any two variables X and Y when trying to compute Cov(X,Y). This calculation would be what’s done for a single cell of the correlation matrix I am trying to compute, but as I explain, I do not have full Poisson distributions for each of the bins in either of the two kinematic distributions, only the count values.

How would one calculate these rho_(x_i)(y_j) elements without having full distribution data for (x_i) and (y_j)? Is this possible? Does RooUnfold have any machinery for dealing with a problem like this?

Thanks,
Andrew

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.