# Normalized Square Error vs Pearson correlation as similarity measures of two signals

Which measure should be considered better and when ?

I tested both the measures on some data that I have and I got mixed results i.e. some are showing better results with Pearson and some with the Normalized Squared Error.

By similarity I mean similar shapes of the signals that I have.

I normalized the data before applying the measures to them.

• Assuming that we are working with samples and not continuous-time signals, could you include in your question the formulas that you use for the mean-square error and the Pearson correlation coefficient? You might see a lot of similarity in them especially if you have "normalized" the data so that $$\sum_{i=1}^{N-1}(x[i])^2 = \sum_{i=1}^{N-1}(y[i])^2 = 1$$ or $$\sum_{i=1}^{N-1}(x[i]-\bar{x})^2 = \sum_{i=1}^{N-1}(y[i]-\bar{y})^2 = 1$$ where $\bar{x}$ and $\bar{y}$ are the average values of the signals. – Dilip Sarwate Jun 6 '13 at 21:40
• Between what values ​should the MSEr be? – Luis Carlos Speletta Mar 9 '18 at 5:38

It depends on the normalization that you perform on the data. Note that for computing the Pearson correlation coefficient you subtract the means of the signals. This is normally not the case if you simply compute a mean squared error between the signals, unless mean removal is part of your normalization procedure. I assume you compute the Pearson correlation coefficient as

$$r=\frac{\sum_i(x_i-m_x)(y_i-m_y)}{\sqrt{\sum_i(x_i-m_x)^2}\sqrt{\sum_i(y_i-m_y)^2}}$$

where $x_i$ and $y_i$ are the data to be compared, and $m_x$ and $m_y$ are their sample means. If the sample means are different, this will have no influence on the correlation coefficient $r$. Different means will, however, influence the mean squared error between the signals:

$$MSE=\frac{1}{n}\sum_{i=1}^{n}(x_i-y_i)^2$$

unless the normalization takes care of it.

If you assume that both signals have zero mean (or that the mean has been removed by normalization), and that both signals have been normalized to have an average power of 1

$$\frac{1}{n}\sum_{i=1}^{n}x_i^2=1,\quad \frac{1}{n}\sum_{i=1}^{n}y_i^2=1$$

then both error measures simplify to

$$r=\frac{1}{n}\sum_{i=1}^{n}x_iy_i,\quad MSE=2\left (1-\frac{1}{n}\sum_{i=1}^{n}x_iy_i\right)=2(1-r)$$

This means that with an appropriate normalization which removes the mean of both signals and normalizes their power to unity, both error measures are equivalent and one can be computed from the other.

Summarizing, in general the Pearson correlation coefficient gives you a better idea of the similarity of two signals. If you normalize the signals appropriately, then the MSE is equivalent to the correlation coefficient $r$ and there is a simple relation between them.