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

10 ビュー (過去 30 日間)
Ede gerlderlands
Ede gerlderlands 2013 年 2 月 10 日
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 件のコメント
Ede gerlderlands
Ede gerlderlands 2013 年 2 月 10 日
I mean Correlation coefficients...
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 Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by