# How to choose a correlation measure when Pearson is close to 1 and Spearman close to -1?

I have two large datasets from nonlinear control systems. I am trying to correlate the error with the control action taken.

If the error is plotted as fx and the control action as fy we end up with this:

We can see that fx from t = 0 to t = 1244 is decreasing. It is hard to see in the figure, but from t = 1245 to t = 9500 the error is slightly increasing towards 0 but never actually achieving it. On the other hand, fy is always decreasing.
There are changes in every single observation from fx and fy but they are very subtle.

The correlation between fx and fy is very different from Pearson and Spearman's coefficients. Since, for the most part, fx increases and fy decreases, the latter coefficient produced a more expected value than Pearson's. Pearson: 0.998, Spearman: -0.699.
Just out of curiosity, Kendall tau is -0.788.

I decided then to do a scatter plot with the correlations. Points being (x, y) from fx and fy respectively:

The pearson correlation is so close to being perfectly linear that it is actually causing me to question the logic used above to explain the expected negative value and go for it.

I've read this question many times before asking this one up. I decided to do so because I'm not so sure why would Pearson's coefficient produce such a value when there is so much data indicating a negative trend.

I would rather ask more than just a single question for this:
Q1: Am I doing/assuming something wrong?
Q2: Should I stick with my logic and use Spearman's or consider Pearson's instead?

Edit: I've made a histogram of both error (fx) and control action (fy) observations. The majority of occurrences is during the stage where the error is negative and increasing and the control action is positive and decreasing. The data is really skewed, so there is a really significant concentration of points in the left tail of the Pearson plot. Is that perhaps the reason why I should use Spearman?

Histogram:

Pearson's left tail where lies the highest concentration of points:

• Are your measurements linearly spaced or log spaced? This will have big implications for pearsons as it is based on magnitude of values and only a small portion of your graph contributes the biggest changes in magnitude. – ReneBt Apr 8 '18 at 7:35
• @Alexis I will try to upload the data and link it here. – Alex Newman Apr 8 '18 at 22:02
• @AlexNewman Are you using the simplified formula for Spearman's $r_{S} = 1 - \frac{6\sum^{n}_{i=1}{d^{2}}}{n\left(n^{2}-1\right)}$? Because that formula does not work when you have tied ranks, and your data appear to possibly have mostly tied ranks (those upper tails). In such a case you should calculate Spearman's $r_{S}$ by (a) ranking both variables (independently), and (b) calculating Pearson's $r$ on the ranks. – Alexis Apr 8 '18 at 23:11
• @Alexis. No. I'm actually taking the Pearson's using the ranks. – Alex Newman Apr 8 '18 at 23:55
• @Alexis the error is x and control action y data. They're just in different files. – Alex Newman Apr 9 '18 at 0:25

Your last graph—$y$ vs $x$—provides the insight:
2. Spearman's correlation coefficient is also inappropriate, because your data are not monotonically associated: in your last graph values of $y$ tend to both increase and decrease as a function of $x$, and if you swap $x$ and $y$ axes on you graph (as below), you will see that $x$ first decreases, then increases as a function of $y$ precisely where you said the highest concentration of points are massed. In monotonic function one variable either only fails to increase, or fails to increase as a function of the other, but you have both happening, which violates a fundamental assumption of Spearman's rank correlation coefficient.