Calculate R squared from a linear regress

2 ビュー (過去 30 日間)
JFz
JFz 2018 年 1 月 22 日
コメント済み: Star Strider 2018 年 1 月 22 日
Hi, I have a set of scattered data and I can use the operator "\" to do a linear fit on the data. But is there a simple matlab function to get the R^2? I am trying to skip the calculation shown on page: https://www.mathworks.com/help/matlab/data_analysis/linear-regression.html
BTW, I don't have machine learning toolbox.
Thanks for any help. If there is no simple matlab function, then I will have to try to calculate by using the sample code shown on the above page.

採用された回答

Star Strider
Star Strider 2018 年 1 月 22 日
It depends on the regression you’re doing. If you have a simple bivariable (as opposed to multivariable) linear regression, you can simply square one of the off-diagonal elements of the (2x2) matrix returned by corrcoef. It will give the same result.
  6 件のコメント
JFz
JFz 2018 年 1 月 22 日
Thank you! This really helps a lot.
Star Strider
Star Strider 2018 年 1 月 22 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Computations についてさらに検索

タグ

製品


Translated by