Correlation coefficient for robust fit and regress fitting are they equal?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuesta aceptada
the cyclist
el 10 de Feb. de 2013
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 comentarios
the cyclist
el 10 de Feb. de 2013
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().
Más respuestas (0)
Ver también
Categorías
Más información sobre Descriptive Statistics en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!