Correlation with $\theta$ and with $e^{i\theta}$

I have a procedure for generating a random complex number $$z=|z|e^{i\theta}$$ (the procedure is quite complicated, but irrelevant for the question). I want to check whether the modulus and the argument are correlated or not.

I have generated $$10^5$$ samples. I then ask matlab for the Pearson linear correlation coefficient of $$|z|$$ and $$\theta$$ and it gives me $$0.0008$$. This is indeed quite small, so I conclude for no correlation.

However when I ask for the correlation coefficient of $$|z|$$ and $$e^{i\theta}$$, I get $$0.15$$, which is not really that small.

I am not very familiar with statistics, so maybe my intuition is off. But shouldn't the correlation coefficient be small in both cases? Can $$|z|$$ be correlated with $$e^{i\theta}$$ without being correlated with $$\theta$$?

EDIT

I have looked more closely at the histogram of the joint distribution of $$|z|$$ and $$\theta$$ and concluded that they indeed are NOT independent, even though they are uncorrelated. So I know understand what is going on.

• What sort of joint probability distribution of $|z|$ and $\theta$ was used? – Michael Hardy Nov 9 '18 at 17:32
• That is what I want to know. When I make a joint histogram of $z$ and $\theta$, the joint distribution looks like it is a product, so they should be independent. This agrees with correlation being zero between them, but the correlation is not zero between $z$ and $e^{i\theta}$. – thedude Nov 9 '18 at 17:45
• Could you please explain how you get a single real value for the correlation coefficient of a real variable and a complex variable? – whuber Nov 9 '18 at 18:12
• @whuber the coefficient is actually complex, I just wrote the real part because the imaginary part is much smaller (100 times, roughly) – thedude Nov 9 '18 at 18:21
• This raises an interesting question: exactly how do you define $\theta$? Because $\theta$ is really only determined modulo $2\pi,$ it's hard to see how a correlation coefficient between $|z|$ and $\theta$ could have any definite meaning. – whuber Nov 9 '18 at 20:53

This is why in general zero correlation does not imply independence. If $$X$$ and $$Y$$ are independent, $$E[g(X)h(Y)]=E[g(X)]E[h(Y)]$$ in all situations. But, you cannot tell it by only having zero covariance/correlation, i.e. $$E[XY]=E[X]E[Y]$$.