Skip to main content
added 603 characters in body
Source Link
DeltaIV
  • 18.4k
  • 7
  • 78
  • 122

Ok, this is not a complete answer, but formulas were too long for comments, and, since I think your question is very interesting, I'm posting my thoughts anyway, in the hope that someone will take it from here and build a better answer.

It's clear that computing the classic correlation coefficient just won't work, because $-0.99\pi$ and $0.99\pi$ are very different values if seen as linear data, when they actually correspond to very similar angles. I propose to compute the versors $\nu_{x_i}=(\sin(x_i),\cos(x_i))$$\mathbf{v}_{x_i}=(\sin(x_i),\cos(x_i))$ and $\nu_{y_i}=(\sin(y_i),\cos(y_i))$$\mathbf{v}_{y_i}=(\sin(y_i),\cos(y_i))$ and their sample means $$\overline{\nu_x}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(x_i),\cos(x_i)), \quad\overline{\nu_y}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(y_i),\cos(y_i))$$ $$\overline{\mathbf{v}_x}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(x_i),\cos(x_i)), \quad\overline{\mathbf{v}_y}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(y_i),\cos(y_i))$$

Then compute the average of the dot product of the centered versors, divided by the product of their norms:

$$\overline{d}=\frac{1}{N}\sum\limits_{i=1}^N\left(\nu_{x_i}-\overline{\nu_x}\right)\cdot\left(\nu_{y_i}-\overline{\nu_y}\right)$$$$\overline{d}=\frac{1}{N}\sum\limits_{i=1}^N\frac{\left(\mathbf{v}_{x_i}-\overline{\mathbf{v}_x}\right)\cdot\left(\mathbf{v}_{y_i}-\overline{\mathbf{v}_y}\right)}{\lVert\left(\mathbf{v}_{x_i}-\overline{\mathbf{v}_x}\right)\rVert \lVert \left(\mathbf{v}_{y_i}-\overline{\mathbf{v}_y}\right) \rVert }$$

A centered versor is actually not a real versor (its norm is not necessarily 1). For this reason, we divide the dot product among two centered versors by the product of the norms of the centered versors. This normalized dot product is guaranteed to be in $[-1,1]$, which implies that also $\overline{d}\in[-1,1]$. If two centered versors are parallel, then the corresponding normalized dot product will be $\pm1$. If they are orthogonal, it will be 0. Thus it$\overline{d}$ seems to me an interesting index of linear correlation among $x$ and $y$. I don't know how to build a test from here, but you could try with bootstrapsimulation: generate random $x$ and $y$ with no correlation, compute $\overline{d}$ and see which percentage of cases falls in $[-a,a]$ with $|a|<1$.

Ok, this is not a complete answer, but formulas were too long for comments, and, since I think your question is very interesting, I'm posting my thoughts anyway, in the hope that someone will take it from here and build a better answer.

It's clear that computing the classic correlation coefficient just won't work, because $-0.99\pi$ and $0.99\pi$ are very different values if seen as linear data, when they actually correspond to very similar angles. I propose to compute the versors $\nu_{x_i}=(\sin(x_i),\cos(x_i))$ and $\nu_{y_i}=(\sin(y_i),\cos(y_i))$ and their sample means $$\overline{\nu_x}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(x_i),\cos(x_i)), \quad\overline{\nu_y}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(y_i),\cos(y_i))$$ Then compute the average dot product of the centered versors:

$$\overline{d}=\frac{1}{N}\sum\limits_{i=1}^N\left(\nu_{x_i}-\overline{\nu_x}\right)\cdot\left(\nu_{y_i}-\overline{\nu_y}\right)$$

If two centered versors are parallel, then the dot product will be $\pm1$. If they are orthogonal, it will be 0. Thus it seems to me an interesting index of linear correlation among $x$ and $y$. I don't know how to build a test from here, but you could try with bootstrap: generate random $x$ and $y$ with no correlation, compute $\overline{d}$ and see which percentage of cases falls in $[-a,a]$ with $|a|<1$.

Ok, this is not a complete answer, but formulas were too long for comments, and, since I think your question is very interesting, I'm posting my thoughts anyway, in the hope that someone will take it from here and build a better answer.

It's clear that computing the classic correlation coefficient just won't work, because $-0.99\pi$ and $0.99\pi$ are very different values if seen as linear data, when they actually correspond to very similar angles. I propose to compute the versors $\mathbf{v}_{x_i}=(\sin(x_i),\cos(x_i))$ and $\mathbf{v}_{y_i}=(\sin(y_i),\cos(y_i))$ and their sample means $$\overline{\mathbf{v}_x}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(x_i),\cos(x_i)), \quad\overline{\mathbf{v}_y}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(y_i),\cos(y_i))$$

Then compute the average of the dot product of the centered versors, divided by the product of their norms:

$$\overline{d}=\frac{1}{N}\sum\limits_{i=1}^N\frac{\left(\mathbf{v}_{x_i}-\overline{\mathbf{v}_x}\right)\cdot\left(\mathbf{v}_{y_i}-\overline{\mathbf{v}_y}\right)}{\lVert\left(\mathbf{v}_{x_i}-\overline{\mathbf{v}_x}\right)\rVert \lVert \left(\mathbf{v}_{y_i}-\overline{\mathbf{v}_y}\right) \rVert }$$

A centered versor is actually not a real versor (its norm is not necessarily 1). For this reason, we divide the dot product among two centered versors by the product of the norms of the centered versors. This normalized dot product is guaranteed to be in $[-1,1]$, which implies that also $\overline{d}\in[-1,1]$. If two centered versors are parallel, then the corresponding normalized dot product will be $\pm1$. If they are orthogonal, it will be 0. Thus $\overline{d}$ seems to me an interesting index of linear correlation among $x$ and $y$. I don't know how to build a test from here, but you could try with simulation: generate random $x$ and $y$ with no correlation, compute $\overline{d}$ and see which percentage of cases falls in $[-a,a]$ with $|a|<1$.

Source Link
DeltaIV
  • 18.4k
  • 7
  • 78
  • 122

Ok, this is not a complete answer, but formulas were too long for comments, and, since I think your question is very interesting, I'm posting my thoughts anyway, in the hope that someone will take it from here and build a better answer.

It's clear that computing the classic correlation coefficient just won't work, because $-0.99\pi$ and $0.99\pi$ are very different values if seen as linear data, when they actually correspond to very similar angles. I propose to compute the versors $\nu_{x_i}=(\sin(x_i),\cos(x_i))$ and $\nu_{y_i}=(\sin(y_i),\cos(y_i))$ and their sample means $$\overline{\nu_x}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(x_i),\cos(x_i)), \quad\overline{\nu_y}=\frac{1}{N}\sum\limits_{i=1}^N(\sin(y_i),\cos(y_i))$$ Then compute the average dot product of the centered versors:

$$\overline{d}=\frac{1}{N}\sum\limits_{i=1}^N\left(\nu_{x_i}-\overline{\nu_x}\right)\cdot\left(\nu_{y_i}-\overline{\nu_y}\right)$$

If two centered versors are parallel, then the dot product will be $\pm1$. If they are orthogonal, it will be 0. Thus it seems to me an interesting index of linear correlation among $x$ and $y$. I don't know how to build a test from here, but you could try with bootstrap: generate random $x$ and $y$ with no correlation, compute $\overline{d}$ and see which percentage of cases falls in $[-a,a]$ with $|a|<1$.