Calculating R-Squared for robustfit

6 ビュー (過去 30 日間)
Christian
Christian 2015 年 5 月 20 日
回答済み: Milad Ekramnia 2019 年 9 月 25 日
In the linear regression function (regress), one may get the R^2 value directly from one of the 'stats' variable in [b, bint, r, rint, stats] = regress(y,X) function
I want to do a robust linear regression with [b,stats] = robustfit(X,Y)
However, it doesn't give me the new/adjusted R^2 from the output variables of the 'robustfit' function.
This workaround works well for the case of only 1 independent variable:
[brob, rob_stats] = robustfit(x,y);
rsquare = corr(y,brob(1)+brob(2)*x)^2
Unfortunately, I have a at least 4 independent variables. I tried this (for 1 constant and 3 independent variables), but it doesn't work and it most likely is not mathematically correct ;-) :
B_Rsqrd(1,j) = corr(Y,b(1)+b(2)*X(:,1)+b(3)*X(:,2)...
+b(4)*X(:,3)+b(5)*X(:,4))^2;
Any help is much appreciated!
Cheers, Christian
  2 件のコメント
Riyadh Muttaleb
Riyadh Muttaleb 2018 年 7 月 27 日
I have the same problem, have gotten the answer?
JM90
JM90 2019 年 5 月 8 日
I have the same problem. Did you find an answer?

サインインしてコメントする。

回答 (1 件)

Milad Ekramnia
Milad Ekramnia 2019 年 9 月 25 日
Same here!

カテゴリ

Help Center および File ExchangeLinear Regression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by