Correlation coefficient for robust fit and regress fitting are they equal?

13 次查看(过去 30 天)
I have done regression analysis for the x and Y using two cases. For the first regression I used 'regress' and for the second case 'robustfit'. How can I get the correlation coefficient of the two? shouldn't they be different? here is the script I tried to work upon..
figure (1)
[a,b]= robustfit(x,y);
plot(x,a(1)+a(2).*x,'g');
figure (2)
[a1, b1]=regress(y, [ones(size(x)) x]) ;
plot(x,a1(1)+a1(2).* x,'r','LineWidth',2);
Thanks for your help

采纳的回答

the cyclist
the cyclist 2013-2-10
If your data don't have any outliers, then the results of a robust regression will be very similar to a plain linear regression.
For example, here is some code comparing the two:
x = rand(20,1);
y = x + 0.3*rand(20,1);
y(1) = 40;
figure
hold on
[a,b]= robustfit(x,y);
plot(x,a(1)+a(2).*x,'g');
[a1, b1]=regress(y, [ones(size(x)) x]) ;
plot(x,a1(1)+a1(2).* x,'r','LineWidth',2);
Notice that I deliberately added an outlier [y(1)= 40], and plotted the lines on the same plot to compare. If you comment out that line y(1) = 40, then those lines will be (nearly) on top of each other.
In the latter case, you may need to use
>> format long
to see that a and a1 are actually a little different from each other.
  4 个评论
the cyclist
the cyclist 2013-2-10
As stated in the documentation, the stats output of the commands
>> [b,bint,r,rint,stats] = regress(...)
and
>> [b,stats] = robustfit(...)
will give a list of lots of statistics. I'm truly not sure what you mean by "correlation coefficients", which is usually something measured between two data variables, not something from a fit. Maybe you mean R^2, which is sometimes referred to as the coefficient of determination? I know that is reported for the regress() command, but not sure for robustfit().

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by