Correlation between two non-linear vectors

8 次查看(过去 30 天)
I got two vectors from mixed models with coefficients below.
I want to find out if there is any correlation between the both non linear vectors (poly 2).
Can I trust the function corrcoef?
Or is there any other test for the association e.g. t-test?
a1 = -1.357;
b1 = 0.1038;
c1 = -0.0015;
x1 = linspace(20,40,200) ;
y1 = 10.^(a1+ b1*x1+c1*x1.^2);
plot(x1,y1,'-','color','r');hold on;
a2 = -0.1953;
b2 = -0.0221;
c2 = 6.045e-04;
x2 = linspace(20,40,200) ;
y2 = 10.^(a2+ b2*x2+c2*x2.^2);
plot(x2,y2,'-','color','b');
[y1_y2,p_y1_y2]= corrcoef(y1,y2);
y1_y2:
1 0.471552593883940
0.471552593883940 1
p_y1_y2
1 1.59789801156464e-12
1.59789801156464e-12 1
Plot of the two vectors y1 and y2.
Scatter plot of y1 (y axis) and y2-(x axis)

回答(1 个)

dpb
dpb 2019-7-13
Can I trust the function corrcoef?"
Well, you can trust it to have computed what it says it computes which is the estimate of their linear dependence. Certainly the 0.45 doesn't look unreasonable as the two both have an overal positive linear slope while the curvatures are positive and negative, respectively, and certainly the difference plot shows a definite trend; it's not at all random in nature so there is a model that _could_ explain the difference almost exactly.
The question is what is the null hypothesis you would like to test? That determines the statistic if there is one to anwer the question.
  5 个评论
dpb
dpb 2019-7-15
Well, if they were perfectly linearly correlated, Rsq would have been 1 or near that...so, that it's only 50% says they're not particularly well correlated. But, they're far more than just random association as can clearly be seen by inspection.
It still isn't clear just what you're trying to say about them, specifically.
John D'Errico
John D'Errico 2019-7-15
Can you trust corrcoef? Well, yes. It does what it says it does. But it is not designed to handle nonlinear problems. It assumes the relationship you pose to it is linear, with noise. When you have lack of fit, thus significant nonlinearity, you have failed the major assumption behind use of corrcoef.
So what do you have? There is essentially no noise at all. So any deviation from linear relationships is purely in terms of lack of fit, pure nonlinearity. corrcoef is not a good tool to measure whatever it is you are looking to measure. Is there a good tool? Hard to say, since we are not given sufficient information to know. But corrcoef is not really the right thing, because it is trying to view any deviation from linearity as noise, and that deviation is far from random noise in your case.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics 的更多信息

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by