Dear Expert,

I have the two variables in the tree. I want to check the correlation between the width of two variables.

I was using TProfile histogram like below:

```
Int_t nentries = (Int_t)tree->GetEntries();
for (Int_t i=0; i<nentries; i++)
{
tree->GetEntry(i);
{
h1->Fill(vari1, vari2);
hprofxy->Fill(vari1, vari2);
}
}
TProfile * hprofx = h1->ProfileX();
TProfile * hprofy = h1->ProfileY();
```

But it gives the correlation between the mean of these variables.

Is there any way to check the correlation between the width of these two variables?

Regards

Chanchal

Dear Chanchai,

Maybe clarify a bit your question:

- It is not clear how you calculate correlations using profile projections.
- Did you mean the correlation between the variables instead of the correlation

between the means ?
- You want the correlation between the width of the variables. Please define width.

In general, correlation between f(x1) and f(x2) could be obtained by performing an error propagation in which things will appear like stdev(x1), stdev(x2) and core(,x1,x2).

-Eddy

Dear @Eddy_Offermann,

Thanks for your reply.

As far as I know, the profile histogram gives the mean value of Y and its error for each bin in X (link).

Therefore I want to ask if is there any way to get the std dev of Y for each bin in X.

Regards

Chanchal

You can specify the profile error type (e.g., see the `option = "s"`

description):

TProfile

TProfile::BuildOptions

TH2::ProfileX

TH2::ProfileY

In case you are interested in the correlation between Y values for bin x_{i} and x_{i+1} just scan the tree gathering the sets { Y(x_{i}) } and { Y(x_{i+1}) } and calculate the correlation coefficient