2
$\begingroup$

X,Y are r.v's exactly related by some unknown non-linear relationship.

Does there exist a neat analog of Correlation, that gives some information about a this relationship?

$\endgroup$
  • 1
    $\begingroup$ @whuber Okay, maybe just an example of quadratic relationship. I want to get a feel for the methods people use in this area. $\endgroup$ – Cris Stringfellow Mar 14 '13 at 4:23
  • 1
    $\begingroup$ Cris, are you now saying that $X$ and $Y$ are known to have a quadratic relationship (perhaps up to some random iid error) or are you saying that this is the relationship but it is unknown? If you mean the latter, then your edit hasn't changed anything. If you mean the former, then the answer is "regression," which is abundantly answered in hundreds of questions here. $\endgroup$ – whuber Mar 14 '13 at 4:27
  • 1
    $\begingroup$ @whuber Okay so in the case of the former one can just try out different functions and use regression. Makes sense. One could simply try out a whole bunch of different polynomial, exponential, trigonometric models. There can't be that many templates, and regression can find the parameters. That answers that part. For the latter case where there is no 'closed form' relationship... I guess, it is data mining. $\endgroup$ – Cris Stringfellow Mar 14 '13 at 4:34
  • 1
    $\begingroup$ It's not quite like that, Cris. In the former case all you try is a quadratic regression: there's no call for anything else. (There are infinitely many "templates," anyway, and an infinite subset of them will fit the data perfectly, so the process of trying out lots of things in an aimless or automatic way is a sterile, ultimately misleading endeavor.) In the latter case you're essentially discussing a theory of everything, which includes data mining, cross-validation, model selection, machine learning, exploratory data analysis, and much more. $\endgroup$ – whuber Mar 14 '13 at 5:05
  • 1
    $\begingroup$ @whuber: Isn't Symbolic Regression doing exactly what you describe? Using templates to find a best fit in an automatic way? e.g. Something like the Eureqa Package from Cornell creativemachines.cornell.edu/eureqa Or is that different? $\endgroup$ – curious_cat Mar 14 '13 at 6:48
2
$\begingroup$

Were you looking for something like $Distance Correlation$?

http://en.wikipedia.org/wiki/Distance_correlation

This will be non-zero for any sort of relationship between your $x$ and $y$. Therefore this can trap arbitrary non-linear relationships though interpreting the values is harder than interpreting correlation.

If this is what you need try the "energy" library in R.

set.seed(1234)
x<-rnorm(1000,0,1)
y<-x^2
cor(x,y)
[1] -0.03908369
library(energy)
dcor(x,y, R=500))
[1] 0.5478997

#to get a p-value for the distance correlation:
dcov.test(x,y)

        dCov test of independence

data:  index 1, replicates 500
nV^2 = 140.74, p-value = 0.001996
sample estimates:
     dCov 
0.3751596 
$\endgroup$
  • $\begingroup$ This sounds good. $\endgroup$ – Cris Stringfellow Mar 14 '13 at 10:23
  • $\begingroup$ Curious cat I am guessing that the reason the distance covariance gives a score 50 times greater than the correlation is because one can say a normal distribution is 'somewhat close in shape to a parabola.', but that this relationship is not a linear one, though it can be somewhat detected by distance corelation. Does that interpretation work, intuitively? $\endgroup$ – Cris Stringfellow Mar 14 '13 at 10:56
  • $\begingroup$ @Chris: Could be. I can't say. I don't know enough about the theory behind it. $\endgroup$ – curious_cat Mar 14 '13 at 19:01
0
$\begingroup$

Correlation using Spearmans (captures non-linear relationships)

corr = df.corr("spearman")

In the case of monotonic relationship, the variables tend to move in the same relative direction, but not necessarily at a constant rate. In a linear relationship, the variables move in the same direction at a constant rate. In some cases, variables increasing concurrently, but not at the same rate. This relationship is monotonic, but not linear.

The Pearson correlation coefficient for these data is 0.843, but the Spearman correlation is higher 0.948.

enter image description here

Note: It doesn't capture quadratic

$\endgroup$
  • $\begingroup$ The figure illustrates a case where Spearman's correlation captures a non-linear relationship because the relationship is monotonic; however, readers should be aware that Spearman's correlation does not do a good job of capturing non-monotonic relationships such as quadratics. $\endgroup$ – Reinstate Monica Jul 1 at 21:55
  • $\begingroup$ @Sycorax I agree. It doesn't capture quadratics $\endgroup$ – Shravankumar Hiregoudar Jul 1 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.