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 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