Let's analyze the two methods of computing the correlation between two random variables (X) and (Y), given that (Y) has a true correlation of (\rho = 0.15) with (X), and that in each of the (N_r) repetitions, (Y) is observed with an additive noise component that is uncorrelated with (X) and has a constant variance (\sigma^2_n).
Method 1: Correlation Across All Observations
In this method, we concatenate all (N_t \times N_r) observations of (Y) and compute the correlation with the (N_t \times N_r) observations of (X). Let's denote the observed (Y) values in each repetition as (Y_{i,j}), where (i = 1, \ldots, N_t) and (j = 1, \ldots, N_r).
The sample mean of (X) and (Y) over all observations are:
[
\bar{X} = \frac{1}{N_t \times N_r} \sum_{i=1}^{N_t} \sum_{j=1}^{N_r} X_{i,j}
]
[
\bar{Y} = \frac{1}{N_t \times N_r} \sum_{i=1}^{N_t} \sum_{j=1}^{N_r} Y_{i,j}
]
The sample covariance between (X) and (Y) is:
[
\text{Cov}(X, Y) = \frac{1}{N_t \times N_r - 1} \sum_{i=1}^{N_t} \sum_{j=1}^{N_r} (X_{i,j} - \bar{X})(Y_{i,j} - \bar{Y})
]
The sample standard deviations of (X) and (Y) are:
[
s_X = \sqrt{\frac{1}{N_t \times N_r - 1} \sum_{i=1}^{N_t} \sum_{j=1}^{N_r} (X_{i,j} - \bar{X})^2}
]
[
s_Y = \sqrt{\frac{1}{N_t \times N_r - 1} \sum_{i=1}^{N_t} \sum_{j=1}^{N_r} (Y_{i,j} - \bar{Y})^2}
]
The Pearson correlation coefficient is then:
[
r_{XY} = \frac{\text{Cov}(X, Y)}{s_X s_Y}
]
Method 2: Correlation After Averaging (Y)
In this method, we first average the (Y) values across each repetition, and then compute the correlation between (X) and these averaged (Y) values. Let (\bar{Y}j) be the average of (Y) values in the (j)-th repetition:
[
\bar{Y}j = \frac{1}{N_t} \sum{i=1}^{N_t} Y{i,j}
]
The sample mean of (\bar{Y}j) over all repetitions is:
[
\bar{\bar{Y}} = \frac{1}{N_r} \sum{j=1}^{N_r} \bar{Y}_j
]
The sample covariance between (X) and (\bar{Y}j) is:
[
\text{Cov}(X, \bar{Y}) = \frac{1}{N_r - 1} \sum{j=1}^{N_r} (X_j - \bar{X})(\bar{Y}_j - \bar{\bar{Y}})
]
The sample standard deviations of (X) and (\bar{Y}j) are:
[
s_X = \sqrt{\frac{1}{N_t \times N_r - 1} \sum{i=1}^{N_t} \sum_{j=1}^{N_r} (X_{i,j} - \bar{X})^2}
]
[
s_{\bar{Y}} = \sqrt{\frac{1}{N_r - 1} \sum_{j=1}^{N_r} (\bar{Y}_j - \bar{\bar{Y}})^2}
]
The Pearson correlation coefficient is then:
[
r_{X\bar{Y}} = \frac{\text{Cov}(X, \bar{Y})}{s_X s_{\bar{Y}}}
]
Ratio of Method 1 to Method 2
The ratio of the variances of the sample means of (Y) across repetitions to the variance of a single observation of (Y) is:
[
\frac{\text{Var}(\bar{Y}j)}{\text{Var}(Y{i,j})} = \frac{\sigma^2_n / N_t}{\sigma^2_n} = \frac{1}{N_t}
]
Thus, the ratio of the squared standard deviations (s^2_{\bar{Y}} / s^2_Y) converges to (1/N_t) as (N_r) becomes large. Therefore, the ratio of the correlation coefficients (r_{XY} / r_{X\bar{Y}}) simplifies to:
[
\frac{r_{XY}}{r_{X\bar{Y}}} \approx \sqrt{\frac{N_t}{N_t - 1}}
]
This formula shows how the correlation computed across all observations (Method 1) compares to the correlation computed after averaging (Y) across repetitions (Method 2), as a function of the number of observations per repetition (N_t).