# Calculate Correlation or Covariance for non-equal Sample Sizes

Question by Guest | 09/02/2014 at 00:58

For my studies in university, I have to calculate correlations and covariances for several series of measurements. Up to now, I always had two samples of equal size from which the measurements were taken.

The problem: Now, I have to samples not having the same size. Therefore, I do not know, how to apply the formula.

Can someone help me? Does someone know, how to compute the correlation and covariance of two non-equal samples?

#### Chematik

Show Profile | Message Computing the covariance and correlation (the covariance is embedded in the correlation formula) depends on the fact, that the measurements are paired. This means, that each value from sample A can be matched with a value from sample B.

If the samples do not have the same size, this is not possible. So, you cannot calculate either the covariance nor the correlation in a reasonable way.

Anyway, the question is, what you really want to calculate in your case and whether it is meaningful is to use the correlation for this. Perhaps, another statistical technique or test would be a better choice.

Of course, the problem can also be that there are missing data in your second measurement because the data was not captured correctly or it was not possible to capture it. In this case, you have the classic "Missing Data Problem", for which there are several solutions. One ansatz would be to remove the whole data row. So, if there are missing values in sample B, using this approach, you have to delete the corresponding values from sample A to make the sample sizes equal.
09/02/2014 at 06:52

## Related Topics

Calculate Hash using PHP